View file cat/cfg.php

File size: 3.83Kb
<?php
error_reporting(0);
$DB_HOST = "localhost";
$DB_USER = "rusorg_cat";
$DB_PASS = "wsx23rftg";
$DB_NAME = "rusorg_cat";
$mailadmin = "[email protected]";
$password = "987";
$site="http://cat.42rus.org";
$index="index.php";
mysql_connect($DB_HOST,$DB_USER,$DB_PASS) or die (mysql_error());
mysql_select_db($DB_NAME);
$datecool=date("d.m.Y");
$q=mysql_query("select `kol` from `cool_nastr`");
$mat_per_page=mysql_result($q,"kol");
$q=mysql_query("select `activsit` from `cool_nastr`");
$active_site=mysql_result($q,"activsit");
$q=mysql_query("select `date` from `cool_pro` order by `ip` desc limit 1");
$olddate=mysql_result($q,"date");
if($olddate!=$datecool){
@mysql_query("update `cool_site` set counter=0, outcounter=0;");
@mysql_query("delete from `cool_pro`");
@mysql_query("insert into `cool_pro` values('0','$datecool','5','5')");}
function print_data($where_data,$page){
global $mat_per_page;
global $active_site;
$where_data=intval($where_data);
$page=intval($page);
if(empty($page)){$page=0;}
if($active_site==1){
if($where_data!="all"){$query=mysql_query("SELECT id FROM `cool_site` where category='$where_data' and activ='1' and counter>'0';");}else{
$query=mysql_query("SELECT id FROM `cool_site` where activ='1' and counter>'0'");}
}else{
if($where_data!="all"){$query=mysql_query("SELECT id FROM `cool_site` where category='$where_data' and activ='1';");}else{
$query=mysql_query("SELECT id FROM `cool_site` where activ='1'");}}
$num_of_rows=mysql_num_rows($query);
$total_mat_number=$num_of_rows;
$total_pages=ceil($total_mat_number/$mat_per_page);
if($active_site==1){
if($where_data!="all"){$prints = mysql_query("select * from `cool_site` where category='$where_data' and activ='1' and counter>'0' order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints=mysql_query("select * from `cool_site` where activ='1' and counter>'0' order by counter desc limit ".$page.",".($page+$mat_per_page).";");}
}else{
if($where_data!="all"){$prints = mysql_query("select * from `cool_site` where category='$where_data' and activ='1' order by counter desc limit ".$page.",".($page+$mat_per_page).";");}else{
$prints=mysql_query("select * from `cool_site` where activ='1' order by counter desc limit ".$page.",".($page+$mat_per_page).";");}}
while($data=mysql_fetch_array($prints)){
print "<b><a href=\"from.php?go=".$data['link']."\">".$data['title']."</a></b><br/>(".$data['link'].")<br/>";
print $data['about']."<br/>";
print "Сегодня IN/OUT:";
print " ".$data['counter']."/".$data['outcounter']."<br/><br/>";
//print "<a href=\"from.php?go=".$data['link']."\">".$data['link']."</a><br/><br/>";
}
for ($i=0; $i<$total_pages; $i++){
$page_number=$i*$mat_per_page;
if($page_number!=$page){print "<a href=\"cat.php?c=$where_data&amp;page=$page_number\">[".($i+1)."]</a>";
}else{
print "<b>".($i+1)."</b>";}}}
function coding_cool($value){
$value1=array("&","$","'","\"","<",">");
$value2=array("&amp;","$$","&#x27;","&quot;","&lt;","&gt;");
$value=str_replace($value1,$value2,$value);
if(get_magic_quotes_gpc()){
$value = stripslashes($value);}
$value = mysql_real_escape_string($value);
return $value;}
function translit_cool($value){
$value1=array("Jo","Zh","Ch","Sh","Sch","Je","Yu","Ya","jo","zh","ch","sh","sch","je","yu","ya","''","A","B","V","G","D","E","Z","I","J","K","L","M","N","O","P","R","S","T","U","F","H","C","Y","a","b","v","g","d","e","z","i","j","k","l","m","n","o","p","r","s","t","u","f","h","c","y","'");
$value2=array("Ё","Ж","Ч","Ш","Щ","Э","Ю","Я","ё","ж","ч","ш","щ","э","ю","я","ъ","А","Б","В","Г","Д","Е","З","И","Й","К","Л","М","Н","О","П","Р","С","Т","У","Ф","Х","Ц","Ы","а","б","в","г","д","е","з","и","й","к","л","м","н","о","п","р","с","т","у","ф","х","ц","ы","ь");
$value=str_replace($value1,$value2,$value);
return $value;}
?>