View file run.php

File size: 8.39Kb
<?php
include"nm.php";
session_name("sid");
session_start();
 ////////////////////////////////////
//       Автор:  Swen               //
//  Statistics_of_visitings-v_2.5    //
//   http://wipsoft.ru               //
//       15.12.2008                 //
 ////////////////////////////////////
if($_SESSION['admin_name']=="")
{ header("Location: $error"); exit(); }
else
{
if($admin_name!=$_SESSION['admin_name'] && $admin_password!=$_SESSION['admin_password'])
{ header("Location: $error"); exit(); }}
include('head.php');

echo"<tr>";
echo"<td class=\"row1\">";
echo"<span class=\"yellow\">";
if($set==0) echo'Вчера'; if($set==1) echo'Сегодня'; if($set==2) echo'За неделю';  if($set==3) echo'За месяц'; if($set==4) echo'Общая';
echo"</span>";
echo"</td>";
echo"</tr>";

$pnumber=$amount;
if($s == "")
$s=1; $begin=($s-1)*$pnumber;

if($set=="0") // dt
{
$data=date("d");
$mes=date("m");

if($data == 01)
{ 
if($mes == 01) { $xdn = 31; }
if($mes == 02) { $xdn = 31; }
if($mes == 03) { $xdn = 28; }
if($mes == 04) { $xdn = 31; }
if($mes == 05) { $xdn = 30; }
if($mes == 06) { $xdn = 31; } //май
if($mes == 07) { $xdn = 30; }
if($mes == 08) { $xdn = 31; }
if($mes == 09) { $xdn = 31; } //август
if($mes == 10) { $xdn = 30; }
if($mes == 11) { $xdn = 31; }
if($mes == 12) { $xdn = 30; } //ноябрь

$mesx = $mes-1;

if($mesx <= "10")
   {
$nk=0;
$Dt="$xdn$nk$mesx";
   }
   else
   {
$Dt="$xdn$mesx";
   }

// первый месяц года
if($mes == "01")   
{ 
$nk=12;
$Dt="$xdn$nk";
}

}
else
{

if($data <= "10")
   {
$nk=0;
$x=$data-1;
$Dt="$nk$x$mes";
   }
   else
   {
$x=$data-1;
$Dt="$x$mes";
   }
}

$thm=mysql_query("select * from stat WHERE dt='".mysql_escape_string($Dt)."' ORDER BY alt DESC limit $begin, $pnumber;");
$tot=mysql_query("select count(*) from stat WHERE dt='".mysql_escape_string($Dt)."' ;");
}

if($set=="1") // dt
{
$Dt=date("dm");
$thm=mysql_query("select * from stat WHERE dt='".mysql_escape_string($Dt)."' ORDER BY alt DESC limit $begin, $pnumber;");
$tot=mysql_query("select count(*) from stat WHERE dt='".mysql_escape_string($Dt)."' ;");
}

if($set=="2") // dt
{
$Ms=date("my");
$thm=mysql_query("select * from stat WHERE nd!='' ORDER BY alt DESC limit $begin, $pnumber;");
$tot=mysql_query("select count(*) from stat WHERE nd!='' ;");
}

if($set=="3") // dt
{
$Ms=date("my");
$thm=mysql_query("select * from stat WHERE ms='".mysql_escape_string($Ms)."' ORDER BY alt DESC limit $begin, $pnumber;");
$tot=mysql_query("select count(*) from stat WHERE ms='".mysql_escape_string($Ms)."' ;");
}

if($set=="4") // ms
{
$thm=mysql_query("select * from stat ORDER BY alt DESC limit $begin, $pnumber;");
$tot=mysql_query("select count(*) from stat ;");
}
if($thm && $tot)
	{

while($theme = mysql_fetch_array($thm))
{
echo"<tr>";
echo"<td class=\"row1\">";
echo "<small>".$theme['time']."</small><br>";
echo"<span class=\"red\">";
echo "".$theme['info']."<br>";
 ////////////////////////////////////
//       Автор:  Swen               //
//  Statistics_of_visitings-v_2.5    //
//   http://wipsoft.ru               //
//       15.12.2008                 //
 ////////////////////////////////////
echo "<small>".$theme['tims']."</small><br>";
echo "<small>Посещений: <b>".$theme['alt']."</b></small><br>";
echo"<small>";
echo"<a href=\"delst.php?set=$set&amp;nm=".$theme['nm']."\">[Уд] </a>";
echo"<a href=\"ban.php?set=$set&amp;nm=".$theme['nm']."\">[Бан]</a>";
echo"</small>";
echo"</td>";
echo"</tr>";
}
///////////////////////////////////////////////////////////////////////////////////////
if($set==1)   {
echo"<tr>";
echo"<td class=\"row1\">";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xost="".$totalx['xost']."";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xit="".$totalx['xit']."";
echo"<small><u>За сегодня</u></small><br>";
echo"<span class=\"cp\">"; echo "Хосты: ";  echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xost]<br>";  echo"</span>";
echo"<span class=\"cp\">"; echo "Хиты: ";   echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xit]<br>";  echo"</span>";
echo"</td>";
echo"</tr>"; }

if($set==2)   {
echo"<tr>";
echo"<td class=\"row1\">";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xost="".$totalx['nxost']."";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xit="".$totalx['nxit']."";
echo"<small><u>За неделю</u></small><br>";
echo"<span class=\"cp\">"; echo "Хосты: ";  echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xost]<br>";  echo"</span>";
echo"<span class=\"cp\">"; echo "Хиты: ";   echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xit]<br>";  echo"</span>";
echo"</td>";
echo"</tr>"; }
 ////////////////////////////////////
//       Автор:  Swen               //
//  Statistics_of_visitings-v_2.5    //
//   http://wipsoft.ru               //
//       15.12.2008                 //
 ////////////////////////////////////
if($set==3)   {
echo"<tr>";
echo"<td class=\"row1\">";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xost="".$totalx['mxost']."";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xit="".$totalx['mxit']."";
echo"<small><u>За месяц</u></small><br>";
echo"<span class=\"cp\">"; echo "Хосты: ";  echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xost]<br>";  echo"</span>";
echo"<span class=\"cp\">"; echo "Хиты: ";   echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xit]<br>";  echo"</span>";
echo"</td>";
echo"</tr>"; }

if($set==4)   {
echo"<tr>";
echo"<td class=\"row1\">";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xost="".$totalx['vxost']."";
$totx=mysql_query("select * from chet WHERE ch='1' ;");
$totalx=mysql_fetch_array($totx);
$xit="".$totalx['vxit']."";
echo"<small><u>Всего</u></small><br>";
echo"<span class=\"cp\">"; echo "Хосты: ";  echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xost]<br>";  echo"</span>";
echo"<span class=\"cp\">"; echo "Хиты: ";   echo"</span>"; echo"<span class=\"yellow\">"; echo"[$xit]<br>";  echo"</span>";
echo"</td>";
echo"</tr>"; }
//////////////////////////////////////////////////////////////////////////////////////////
echo"<tr>";
echo"<td class=\"row1\">";
$total=mysql_fetch_array($tot);
$number = (int) ($total['count(*)']/$pnumber);
if($total['count(*)'] >= ($pnumber+1))
	{

if((float) ($total['count(*)']/$pnumber)-$number !=0) $number++;
echo"<span class=\"red\">";
if($s == 1) echo"&lt;&lt;.Пред. |";
echo"</span>";

if($begin>0) {
echo "<a href=\"run.php?s=".($s-1)."&amp;set=$set\">&lt;&lt;.Пред.</a>";
echo"<span class=\"red\">|</span>"; }

if($total['count(*)']>$begin+$pnumber) {
echo"<span class=\"red\">|</span>";
echo "<a href=\"run.php?s=".($s+1)."&amp;set=$set\">След.&gt;&gt;</a>"; }

echo"<span class=\"red\">";
if($number == $s) echo"| След.&gt;&gt;";
echo"</span>";

$all=ceil($total['count(*)'] / $pnumber); $i=1;   $c="";   $tt=$s;
while($i<=$all){
if($i<=3  || $i==$tt- 1  || $i==$tt || $i==$tt+1  || $i>=$all-2)
{$ii="<a href=\"run.php?s=".$i."&amp;set=$set\">".$i."</a>";
if($i==$tt) { if($i!=$all){ $c.= "<b>$i</b>,";}
else{$c.= "<b>$i</b>";} 
 ////////////////////////////////////
//       Автор:  Swen               //
//  Statistics_of_visitings-v_2.5    //
//   http://wipsoft.ru               //
//       15.12.2008                 //
 ////////////////////////////////////
}
else { if($i!=$all){ $c.= "$ii,";} else{$c.= "$ii";} }}
else{$c.= "."; } $i++; }
$c=preg_replace("/[,][.]+/", "...",$c);
echo"<span class=\"red\">";
echo "<br>$c";
echo"</span>";
echo"</td>";
echo"</tr>";

echo"<tr>";
echo"<td class=\"row1\">";
echo"<span class=\"red\">";
echo"<b>Всего : ".$total['count(*)']."</b><br>";
echo"</span>"; } }
echo '<a href="./">Статистика</a>';
echo"</td>";
echo"</tr>";
include('foot.php');
 ////////////////////////////////////
//       Автор:  Swen               //
//  Statistics_of_visitings-v_2.5    //
//   http://wipsoft.ru               //
//       15.12.2008                 //
 ////////////////////////////////////
?>