<?php
########################################
## WAP-ENGINE ##
########################################
## ##
## Автор : CHUMA (Токарев Владимир) ##
## e-mail : [email protected] ##
## WAP : http://wap-engine.ru ##
## ##
########################################
## ВЫ НЕ ИМЕЕТЕ ПРАВО ##
## ИЗМЕНЯТЬ КОД СКРИПТА ##
## ДЛЯ ДАЛЬНЕЙШЕГО РАСПРОСТРАНЕНИЯ! ##
###############################
$err404 = $_SERVER['REQUEST_URI'];
if(isset($_SESSION['seslogin']))
{
$user_f = @file($dob_url.'/data/users/'.$_SESSION['seslogin'].'.php');
$login = trim($user_f[2]);
}
else
{
$login = "Гость";
}
#########
$date = date('d.m.Y / H:i:s', time() + ($sdvigclock*3600));
$kuda = $_SERVER['REQUEST_URI'];
$model = $_SERVER['HTTP_X_OPERAMINI_PHONE_UA'];
$ip = $_SERVER['REMOTE_ADDR'];
$ip_lll = $_SERVER['HTTP_X_FORWARDED_FOR'];
$ip_ll = explode(',', $ip_lll);
$ip_l = $ip_ll[0];
$browser = $_SERVER['HTTP_USER_AGENT'];
$otkuda = $_SERVER['HTTP_REFERER'];
$m_polozh = $m_polozhenie;
if($err404 == '/index.php?err=404')
{
}
else
{
$fw = $dob_url.'/data/log_stat.txt';
$f = fopen("$fw",'a');
flock($f,2);
fwrite($f,"$login|$m_polozh|$date|$browser|$model|$ip|$ip_l|$otkuda|$kuda\n");
fclose($f);
}
###
$ip = filter($_SERVER['REMOTE_ADDR']);
$time = 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'; }
if(stristr($browser, 'Bing'))
{ $brauzer = 'Bing'; }
$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['seslogin']))
{
$user_f = @file($dob_url.'/data/users/'.$_SESSION['seslogin'].'.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);
unset($user_online);
$user_online = file($user_online_data);
}
$user_online_count = count($user_online);
if(isset($_SESSION['sespass']) && isset($passw) && $_SESSION['sespass'] == $passw)
{
$str_user = $login.'|'.$time.'|'.$m_polozhenie.'|'.$ip.'|'.$brauzer;
}
for($i = 0; $i < $user_online_count; $i++)
{
$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[] = $str_user;
}
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("\r\n", $user_online_out_arr);
if($err404 == '/index.php?err=404')
{
}
elseif($nevidim_admins == "1")
{
}
else
{
write_to_file($user_online_data, "$date\r\n$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);
unset($online);
$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[] = $str;
}
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("\r\n", $online_out_arr);
if($err404 == '/index.php?err=404')
{
}
else
{
write_to_file($online_data, "$date\r\n$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"title="Пользователи online на сайте">'.$user_count.'</a>|<a href="'.$dob_url.'/modules/kabinet/guests_online.php?'.session_name().'='.session_id().'" class="cc"title="Гости online на сайте">'.$count.'</a>)';
?>