Файл: category.php
Строк: 108
<?php
##########################################################
# За дополнениями обращайтесь: #
# icq 449-424-588 #
# email: Dimonnet@inbox.ru #
##########################################################
# coding by ___хакер___ (MaZaFaKa) #
##########################################################
# запрещено распространять каталог без согласия автора!!!#
##########################################################
include "inc.php";
include "head.php";
print "<div align="center"><div class=a>";
$today = date("d-m-Y");
//Проверяем наличие логов на сегодня если нет то очищаем таблицы и ведем статистику снова
$rs = @mysql_query("select `cid`, `ci` from `logs` where `day`='$today' and `ci`='$ci';");
if (@mysql_num_rows($rs) == 0)
{
@mysql_query("truncate table `logs`;");
@mysql_query("update `users` set `from`='0', `in`='0' where `ci`='$ci';");
}
//Ведем статистику если был переход с сайта
if (!empty($id))
{
$ip = getenv(REMOTE_ADDR);
$rf = @mysql_query("select `cid` from `logs` where `ip`='$ip' and `type`='in' and `day`='$today' and `cid`='$id' and `ci`='$ci';");
if (@mysql_num_rows($rf) == 0)
{
$count = @mysql_query("select `in` from `users` where `id`='$id' and `activ`='yes' and `ci`='$ci';");
$its = @mysql_fetch_array($count);
//Если сайт неактивен то не захламляем логи
if (@mysql_num_rows($count) !== 0)
@mysql_query("insert into `logs` values(0,'$ip','in','$today','$id','$ci');");
$new = $its['in']+1;
@mysql_query("update `users` set `in`='$new' where `id`='$id' and `activ`='yes' and `ci`='$ci';");
}
$fs = $its['from'];
$n = $its['category'];
}
if (empty($n))
{
print "<meta http-equiv='refresh' content='2;URL=index.php?ci=$ci&st=$st'/>";
print "<font color="#FF0000">Такого сайта нет в каталоге!<br/></font>";
}
else
{
$cname = @mysql_query("select `name` from `categories` where `id`='$n' and `ci`='$ci' limit 1;");
$ctnames = @mysql_fetch_array($cname);
$lst = @mysql_query("select `id` from `users` where `category`='$n' and `activ`='yes' and `ci`='$ci';");
$all = @mysql_num_rows($lst);
print "<div style="text-align: center">
<div class="contur_rek"><div class="header_rek"><b>".$ctnames['name']." ($all)</b></div></div></div>";
if (!empty($id))
{
$qs = @mysql_query("select `id` from `users` where `from`>'$fs' and `activ`='yes';");
$high = @mysql_num_rows($qs);
$highst = $high/10;
$s = floor($highst);
}
$pg = $s*10;
$num = $pg;
$sites = @mysql_query("select `url`, `sname`, `about`, `from`, `in`, `ci` from `users` where `category`='$n' and `activ`='yes' and `ci`='$ci' order by `from` desc limit $pg,10;");
print "<div align="left">";
if(@mysql_num_rows($sites) == 0)
print "<font color="#FF0000">Категория пуста!<br/></font>";
while($sp = @mysql_fetch_array($sites))
{
$num = $num+1;
print "<div class="contur"><div class="header"><b><a href="go.php?st=$st&ci=$ci&url=".$sp['url']."">$num. ".$sp['sname']."</a></b><br/>";
print "<small>".$sp['about']."</small><br/>";
print "Ушло: ".$sp['from'].", Пришло: ".$sp['in']."</div></div>";
}
$s = $s+1;
$p = $pg+10;
if ($pg = 0)
{
$p = 10;
}
if ($all > $p){
print "<a href="category.php?n=$n&s=$s&ci=$ci&st=$st">След.</a><br/>";
}
if ($s != 1)
{
$s = $s - 2;
print "<a href="category.php?n=$n&s=$s&ci=$ci&st=$st">Пред.</a><br/>";
}
$str = floor($all/10);
if ($str > 1)
print "<form method="post" action="category.php?n=$n&ci=$ci&st=$st">Перейти к странице(0-$str):<br><input name="s" maxlength="3" size="5" value=""><input value=">>" name="go" type="submit"></form>";
print "<a href="registration.php?cat=$n&ci=$ci&st=$st">Регистрация</a><br/>";
print "<a href="index.php?ci=$ci&st=$st">К категориям</a>";
}
include "foot.php";
print "</div>";
echo "</body></html>";
?>