Размер файла: 3.5Kb
<?php
Error_Reporting(E_ALL & ~E_NOTICE);
Error_Reporting (ERROR | WARNING);
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
extract($HTTP_COOKIE_VARS);
extract($HTTP_SERVER_VARS);
extract($HTTP_SESSION_VARS);
session_name("SESID");
session_start();
require("./mysql.php");
require ("config.php"); //Подключаем настройки сайта. (config.php)
require ("themes/$themes.php"); //Вставляем скин сайта.
require ("ban.php");
echo "<div class='c'>Кто - где?</div>";
$page=$_GET['page'];
if ($page<=0)
{$page=1;}
$i=0;
$q = mysql_query("select DISTINCT name from `count`;");
while($arr = @mysql_fetch_array($q))
{ $az= mysql_query("select * from `count` where name='$arr[name]'order by time desc;");
$array = mysql_fetch_array($az);
$az1= mysql_query("select * from `users` where name='$arr[name]';");
$array1 = mysql_fetch_array($az1);
$where="Главная";
if(preg_match("/who-where.php/i","$array[where]"))
{$where="Кто где?";}
if(preg_match("/search.php/i","$array[where]"))
{$where="Поиске";}
if(preg_match("/index.php/i","$array[where]"))
{$where="Главная";}
if(preg_match("/forum/i","$array[where]"))
{$where="Форуме";}
if(preg_match("/guest/i","$array[where]"))
{$where="Гостевая";}
if(preg_match("/book/i","$array[where]"))
{$where="Библиотеке";}
if(preg_match("/sovet/i","$array[where]"))
{$where="Совет другу";}
if(preg_match("/kartinki/i","$array[where]"))
{$where="Картинках";}
if(preg_match("/melody/i","$array[where]"))
{$where="Мелодиях";}
if(preg_match("/down/i","$array[where]"))
{$where="Скриптах";}
if(preg_match("/mail/i","$array[where]"))
{$where="Отправке писем";}
if(preg_match("/news/i","$array[where]"))
{$where="Новостях";}
$kogda=time()+$sdvigclock*3600;
$kogda=$kogda - $array[time];
$kogda=round($kogda/60);
if($kogda<1){$kogda="<font color='red'>На сайте</font>";}
if($kogda>=1 && $kogda<60){$kogda="$kogda мин. назад";}
if($kogda>=60 && $kogda<1440){$kogda=round($kogda/60); $kogda="$kogda час. назад";}
if($kogda>=1440){$kogda=round($kogda/60/24); $kogda="$kogda дн. назад";}
$mass["$i"]["timez"] = "".$array['time']."";
$mass["$i"]["name"] = "".$arr['name']."";
$mass["$i"]["id"] = "".$array1['id']."";
$mass["$i"]["link"] = "".$array['where']."";
$mass["$i"]["where"] = "".$where."";
$mass["$i"]["kogda"] = "".$kogda."";
$i++;
}
function cmp($a, $b)
{
return strcmp($a["timez"], $b["timez"]);
}
arsort($mass);
reset($mass);
$count = count($mass);
while (list($key, $value) = each($mass)) {
if ($w<=$page*10 & $w>=($page-1)*10)
{
echo "<div class='b'><a href='search.php?user=".$value[id]."'>".$value[name]."</a> ".date("d.m.y (H:i:s)",$value['timez'])." </div><div>".$value[kogda]."</div>";
if ($value[name]!="Guest")
{
echo"<div>В <a href='".substr($value[link],0,15)."'>".$value['where']."</a></div>";
}
}
++$w;
}
if ($count>10 and $count>10*($page))
{
$next=$page+1;
print "<div><a href='who-where.php?page=".$next."'>Вперёд</a></div>";
}
$prev=$page-1;
if ($prev!=0)
{
print "<div><a href='who-where.php?page=".$prev."'>Назад</a></div>";
}
require ("foot.php"); #Вставляем низ сайта. (templates/foot.php)
?>