View file stat.php

File size: 2.14Kb
<?
session_start();

include "file/db.php";
include "file/config.php";
include "style/".$autorize['skin']."/head.php";
include "file/aut.php";
echo "</center><div class='menu'><center>";
print "Статистика";
print "</center></div><div class='tab'>";
$id = $autorize['id'];


$num = 5;
if(empty($_GET['page']) || $_GET['page']<0)$_GET['page']=1;
$page = intval($_GET['page']);
$results = mysql_query('SELECT * FROM `clicks` where `userid` = "'.$id.'"');
$posts = mysql_num_rows($results);
$total = intval(($posts-1)/$num)+1;
if($page>$total) $page = $total;
$start = $page*$num-$num;

$result = mysql_query("SELECT * FROM `clicks` where `userid` = '".$id."' ORDER BY `id` DESC LIMIT $start, $num;");

if(mysql_affected_rows()==0)
{
 echo "<b>Статистика пуста...</b><br/>";
}
else
{
print "<table width='450px' border ='1'><tr><td>Оператор</td><td>Реферер</td><td>User Agent</td><td>Дата</td></tr>";
while($users = mysql_fetch_array($result))
{
print '<tr><td align="left">';
if(!empty($users['oper_name']))
print "".trim(base64_decode($users['oper_name']))."";
else
print "Не определён";
print '</td><td align="center">';
if(!empty($users['referer']))
print '<a href="'.trim($users['referer']).'">'.trim($users['referer']).'</a>';
else
print "Не определён";
print '</td><td align="center">'.trim($users['agent']).'</td><td align="center">'.trim($users['data']).'</td></tr>';
}
print "</table>";

print '<div class="str"><b>Стр:</b>';

$num_pages=ceil($posts/$num);
if($page>$num_pages || $page<1)
{
$page=1;
$start=0;
}
for($pr='', $i=1; $i<=$num_pages; $i++)
{
print $pr=(($i == 1 || $i == $num_pages || abs($i-$page) < 2) ? ($i == $page ? " <b>$i</b> " :
' <a href="'.$_SERVER['SCRIPT_NAME'].'?page='.$i.'&amp;'.session_name().'='.session_id().'">'.$i.'</a> ') : (($pr == ' ... ' || $pr == '')? '' : ' ... '));
}
}


print "</div><img src=\"style/".$autorize['skin']."/home.png\" alt=\"*\"/>";echo "<a href=\"enter.php?".session_name()."=".session_id()."\">Панель</a><div class='hr'></div></div>";
include "style/".$autorize['skin']."/foot2.php";
?>