Просмотр файла opsos.php

Размер файла: 5.35Kb
<?php
#  Сщетчик переходов с статистикой по операторам ver 1.0
#  Автор скрипта Корнилов Александр aka GrOb
#  e-mail: [email protected]; [email protected]
#  ICQ: 191-171
#  WAP: http://o5wap.ru


 include('config.php');
 include('header.php');
 if(!isset($_GET['go'])){
 header("Location: ".$site."");
 exit;}
 $go=preg_replace("/[^0-9]/","",$_GET['go']);
 if (empty($_SESSION['pass'])) $_SESSION['pass']=$_GET['pass'];
 if ($_SESSION['pass']!=$admin)
 {
 echo $div['header'].'ОШИБКА!'.$div['end'];
 echo $div["div"]."Доступ запрещен!<br/>Или истекла сессия";
 echo $div['end'].$div['news'];
 echo "Пароль:";
 echo '<form action="'.$_SERVER['PHP_SELF'].'" method="GET">';
 echo '<input name="pass" type="password"/><br/>';
 echo '<input class="ibutton" type="submit" value="Войти"/></form>';
 include ("footer.php");
 exit();
 }
 $d=date('d');
 $m=date('m');
 $y=date('Y');

$q = @mysql_query("select * from `click_opsos` where `uid`='".$go."' and `d`='".$d."' and `m`='".$m."' and `y`='".$y."';");
$reg=@mysql_num_rows($q);
$field=@mysql_fetch_array($q);
$hits=$field['hits'];
$opsos_=$field['0'];
$all=$hits-$opsos_;
$op_procent=@ceil($all/($hits/100));
$neop_procent=100-$op_procent;

$q2 = @mysql_query("select * from `click_opsos_mes` where `uid`='".$go."' and `m`='".$m."' and `y`='".$y."';");
$field2=@mysql_fetch_array($q2);
$hits_mes=$field2['hits'];
$mes_0=$field2['0'];
if(empty($mes_0))$mes_0=0;
$all_mes=$hits_mes-$mes_0;
$op_procent_mes=@ceil($all_mes/($hits_mes/100));
$neop_procent_mes=100-$op_procent_mes;


$q3 = @mysql_query("select * from `click_opsos_total` where `uid`='".$go."';");
$field3=@mysql_fetch_array($q3);
$hits_total=$field3['hits'];
$total_0=$field3['0'];
if(empty($total_0))$total_0=0;
$all_total=$hits_total-$total_0;
$op_procent_total=@ceil($all_total/($hits_total/100));
$neop_procent_total=100-$op_procent_total;


$qe = @mysql_query("select * from `click_user` where `id`='".$go."';");
$fielde=@mysql_fetch_array($qe);
$name=conv($fielde['name_link']);


 echo $div['header'];
 echo $name." go=".$go."<br/>\n";
 echo "<big>Операторы: ".$op_procent."% (".$all." из ".$hits.")</big><br/>";
 echo $div['end'];
 echo $div['news'];
 echo '<a href="'.$_SERVER['PHP_SELF'].'?go='.$go.'&amp;'.session_name().'='.session_id().'">Обновить</a> - ';
 echo '<a href="admin.php?'.session_name().'='.session_id().'">В Статистику</a> - ';
 echo "<a href=\"opsos_day.php?go=".$go."&amp;m=".date('m')."&amp;".session_name()."=".session_id()."\">За ".whatMonth(date('m'))."</a>";

 echo '<small><table border="0" cellpadding="3" bgcolor="#CCCCCC">';
 echo "<tr>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">Опсос</td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">Сегодня</td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\"><a href=\"opsos_day.php?go=".$go."&amp;m=".date('m')."&amp;".session_name()."=".session_id()."\">".whatMonth(date('m'))."</a></td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">Всего</td>
 </tr>";

 echo "<tr>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\"><b>Операторы</b></td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">".$op_procent."% <small>(".$all." из ".$hits.")</small></td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">".$op_procent_mes."% <small>(".$all_mes." из ".$hits_mes.")</small></td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">".$op_procent_total."% <small>(".$all_total." из ".$hits_total.")</small></td>
 </tr>";

 echo "<tr>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\"><b>IP НЕТ В БД </b>(".$neop_procent."%)</td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">".(100-$op_procent)."% <small>(".($hits-$all)." из ".$hits.")</small></td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">".(100-$op_procent_mes)."% <small>(".($mes_0)." из ".$hits_mes.")</small></td>
 <td align=\"center\" class=\"p\" bgcolor=\"#E8E8FF\">".(100-$op_procent_total)."% <small>(".($total_0)." из ".$hits_total.")</small></td>
 </tr>";

 for ($a=1;$a<27;$a++){
    $oper=$a;
    include ("spop.php");

     $host=$field[$a];
     $host=ceil($host);

     $host_mes=$field2[$a];
     $host_mes=ceil($host_mes);

     $host_total=$field3[$a];
     $host_total=ceil($host_total);

   if($a==1||$a==3||$a==5||$a==7||$a==9||$a==11||$a==13||$a==15||$a==17||$a==19||$a==21||$a==23||$a==25||$a==27||$a==29||$a==31){
    $color='#FFFF84';
    }else  $color='#BFFFFF';

   echo "<tr>
   <td align=\"center\" class=\"p\" bgcolor=\"".$color."\">$oper_name</td>
   <td align=\"center\" class=\"p\" bgcolor=\"".$color."\">".$host."</td>
   <td align=\"center\" class=\"p\" bgcolor=\"".$color."\">".$host_mes."</td>
   <td align=\"center\" class=\"p\" bgcolor=\"".$color."\">".$host_total."</td>

   </tr>";

 }

 echo '</table></small>';
 echo '<a href="'.$_SERVER['PHP_SELF'].'?go='.$go.'&amp;'.session_name().'='.session_id().'">Обновить</a> - ';
 echo '<a href="admin.php?'.session_name().'='.session_id().'">В Статистику</a> - ';
 echo "<a href=\"opsos_day.php?go=".$go."&amp;m=".date('m')."&amp;".session_name()."=".session_id()."\">За ".whatMonth(date('m'))."</a>";

 include('footer.php');
 @mysql_close($sesDB);
?>