Файл: modules/counter/online.php
Строк: 135
<?php
########################################
##               WAP-ENGINE             ##
########################################
##                                    ##
##  Автор : CHUMA (Токарев Владимир)  ##
##  e-mail : crazychuma@gmail.com     ##
##  WAP : http://wap-engine.ru        ##
##                                    ##
########################################
##         ВЫ НЕ ИМЕЕТЕ ПРАВО         ##
##        ИЗМЕНЯТЬ КОД СКРИПТА        ##
##  ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ!  ##
########################################
$ip = filter($_SERVER['REMOTE_ADDR']);
$time = (date('G',time()) * 3600) + (date('i',time()) * 60) + date('s',time());
$date = date('d.m.Y', time() + ($sdvigclock*3600));
$browser = filter($_SERVER['HTTP_USER_AGENT']);
$brauzer = strtok($browser,' ');
if(stristr($browser, 'Yandex'))
 { $brauzer = 'Yandex'; }
if(stristr($browser, 'Google'))
 { $brauzer = 'Google'; }
if(stristr($browser, 'Rambler'))
 { $brauzer = 'Rambler'; }
if(stristr($browser, 'Aport'))
 { $brauzer = 'Aport'; }
if(stristr($browser, 'Yahoo'))
 { $brauzer = 'Yahoo'; }
if(stristr($browser, 'msn'))
 { $brauzer = 'Bing(MSN)'; }
if(stristr($browser, 'ia_archiver'))
 { $brauzer = 'Alexa'; }
if(stristr($browser, 'Mail'))
 { $brauzer = 'Mail'; }
if(stristr($browser, 'Teoma'))
 { $brauzer = 'Ask'; }
if(stristr($browser, 'Lycos'))
 { $brauzer = 'Lycos'; }
if(stristr($browser, 'WebAlta'))
 { $brauzer = 'WebAlta'; }
if(stristr($browser, 'Scooter'))
 { $brauzer = 'AltaVista'; }
if(stristr($browser, 'MLBot'))
 { $brauzer = 'MLBot'; }
if(stristr($browser, 'Baidu'))
 { $brauzer = 'Baidu'; }
       
$user = trim($ip.'|'.$brauzer);
unset($login);
$online_data = $dob_url.'/data/ip_online.txt';
$user_online_data = $dob_url.'/data/user_online.txt';
####################
if(isset($_SESSION['login']))
 {
  $user_f = @file($dob_url.'/data/users/'.$_SESSION['login'].'.php');
  $login = trim($user_f[2]);
  $passw = trim($user_f[4]);
 }
####################
$user_online = file($user_online_data);
if(trim($user_online['0']) != $date)
 {
  write_to_file($user_online_data, $date);
  $user_online = file($user_online_data);
 }
 
$user_online_count = count($user_online);
if(isset($_SESSION['pass']) && isset($passw) && $_SESSION['pass'] == $passw)
 {
  $str_user = $login.'|'.$time.'|'.$m_polozhenie.'|'.$ip.'|'.$brauzer;
 }
for($i = 0; $i < $user_online_count; $i++)
 {
  $tmp = explode('|', $user_online[$i]);
  if($tmp[1] > $time - 300 && $tmp[1] < $time + 300)
   {
    if(!empty($login) && strstr(trim($tmp['0']), $login))
     {
      $user_online_out_arr[] = trim($tmp[0].'|'.$time.'|'.$m_polozhenie.'|'.$tmp[3].'|'.$tmp[4]);
     }
    elseif(!strstr(trim($tmp[3].'|'.$tmp[4]), $user))
     {
      $user_online_out_arr[] = trim($tmp[0].'|'.$tmp[1].'|'.$tmp[2].'|'.$tmp[3].'|'.$tmp[4]);
     }
    $aa .= trim($tmp[0]).'|';
   }
 }
if(!empty($login) && !strstr($aa, $login))
 {
  $user_online_out_arr[] = $str_user;
 }
 
$user_online_out = @implode("rn", $user_online_out_arr);
write_to_file($user_online_data, "$datern$user_online_out");
   
$user_count = count($user_online_out_arr);
####################
$online = file($online_data); 
if(trim($online['0']) != $date)
 {
  write_to_file($online_data, $date);
  
  $online = file($online_data);
 }
$online_count = count($online);
$str = $user.'|'.$time.'|'.$m_polozhenie;
for($i = 0; $i < $online_count; $i++)
 {
  $tmp = explode('|', $online[$i]);
  $t = trim($tmp[2]);
  if($t > $time - 300 && $t < $time + 300)
   {
    if(strstr(trim($tmp[0].'|'.$tmp[1]), $user) && empty($login))
     {
      $online_out_arr[] = trim($tmp[0].'|'.$tmp[1].'|'.$time.'|'.$m_polozhenie);
     }
    elseif(!strstr(trim($tmp[0].'|'.$tmp[1]), $user))
     {
      $online_out_arr[] = trim($tmp[0].'|'.$tmp[1].'|'.$tmp[2].'|'.$tmp[3]);
     }
    $a .= trim($tmp[0].'|'.$tmp[1]).'||';
   }
 }
if(empty($login) && !strstr($a, $user))
 {
  $online_out_arr[] = $str;
 }  
$count = count($online_out_arr);
$online_out = @implode("rn", $online_out_arr);
write_to_file($online_data, "$datern$online_out");
####################
$all_count = $user_count + $count;
echo 'Онлайн: '.$all_count.' [<a href="'.$dob_url.'/modules/kabinet/users_online.php?'.session_name().'='.session_id().'" class="cc">'.$user_count.'</a>|<a href="'.$dob_url.'/modules/kabinet/guests_online.php?'.session_name().'='.session_id().'" class="cc">'.$count.'</a>]';
?>