Просмотр файла loads/inc/log.php

Размер файла: 9.12Kb
<?php

#Error_Reporting(E_ALL & ~E_NOTICE);
#Error_Reporting (ERROR | WARNING);
error_reporting (E_ALL);
session_start();

include_once "baza.php";

function checks($message){
$message=htmlspecialchars($message, ENT_QUOTES);
$message = trim($message);
$message=preg_replace ("|[\r\n]+|si","<br>",$message);
$message=str_replace("'","&#39;",$message);
$message=str_replace("\"","",$message);
$message=str_replace("\$","",$message);
$message=str_replace(">","",$message);
$message=str_replace("<","",$message);
$message=str_replace("mysql","mуsql", $message);
$message=str_replace("query","quеry", $message);
$message=stripslashes(trim($message));
return $message; }

if(!empty($login) && !empty($password) && !empty($browser)){
$login=checks($login);
$password=checks($password); }

if(!empty($_SESSION['login']) && !empty($_SESSION['password'])){
$login=checks($_SESSION['login']);
$password=checks($_SESSION['password']); }
elseif (!empty($_COOKIE['cook_login']) && !empty($_COOKIE['cook_pass'])){
$login=checks($_COOKIE['cook_login']);
$password=checks($_COOKIE['cook_pass']); }

if(empty($login)){ $login=''; }else{
$select_tbl=mysql_query("SELECT * FROM `admin` where login='".$login."'"); }

if(!empty($select_tbl)){
$array=mysql_fetch_array($select_tbl);
$string='';
if(!empty($array['login'])){  $nlogin=checks($array['login']); }else{ $nlogin=''; }
$npassword=checks($array['password']);  }
if(!empty($npassword)){ $npassword=checks($npassword); }

if(empty($_SESSION['login'])){ $_SESSION['login']=''; }
if($_SESSION['login']!=="" && md5(md5($_SESSION['password']))!=="" && md5(md5($_SESSION['password']))==$npassword && $_SESSION['login']==$nlogin){
$session=1;      }else{		$session=''; }



if (!empty($_COOKIE['cook_login']) && !empty($_COOKIE['cook_pass']) && $_COOKIE['cook_pass']==@$npassword && $_COOKIE['cook_login']==$nlogin){

$login=checks($_COOKIE['cook_login']);
$password=checks($_COOKIE['cook_pass']);
$session=1;      }else{ $session=''; }


# ________________________________________________________
# ________________________________________________________
# ________________________________________________________

if($_cnf_['w']=="y" && $session!==1){
echo'<br><center>Загруз-центр временно закрыт! Приносим свои извинения.</center><br><br>';
exit; }



if (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && preg_match("|^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$|", $_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];}
elseif(isset($_SERVER['HTTP_CLIENT_IP']) && preg_match("|^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$|", $_SERVER['HTTP_CLIENT_IP'])) {
$ip = $_SERVER['HTTP_CLIENT_IP'];}
else {$ip = preg_replace("|[^0-9.]|", "", $_SERVER['REMOTE_ADDR']);}


$USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
// 	JAVA
if(stristr($USER_AGENT,'Opera/9.6') && stristr($USER_AGENT,'Mini') && stristr($USER_AGENT,'J2ME')){
$USER_AGENT = 'OperaMini/4.1'; }
if(stristr($USER_AGENT,'Opera/8.01') && stristr($USER_AGENT,'Mini') && stristr($USER_AGENT,'J2ME')){
$USER_AGENT = 'OperaMini/Hi-Fi'; }
// 	PPC
if(stristr($USER_AGENT,'Opera/9.51') && stristr($USER_AGENT,'Windows') && stristr($USER_AGENT,'PPC')){
$USER_AGENT = 'Opera/9.51 (КПК)'; }
if(stristr($USER_AGENT,'Mozilla/4.0') && stristr($USER_AGENT,'Windows') && stristr($USER_AGENT,'Opera 8.65')){
$USER_AGENT = 'Opera/8.65 (КПК)'; }
if(stristr($USER_AGENT,'Mozilla/4.0') && stristr($USER_AGENT,'Windows CE') && stristr($USER_AGENT,'IEMobile')){
$USER_AGENT = 'Internet Explorer (КПК)'; }
if(stristr($USER_AGENT,'Mozilla/4.0') && stristr($USER_AGENT,'Windows CE') && stristr($USER_AGENT,'PPC') && stristr($USER_AGENT,'MSIE 4.01')){
$USER_AGENT = 'UCWEB (КПК)'; }
if(stristr($USER_AGENT,'NetFront') && stristr($USER_AGENT,'PDA')){
$USER_AGENT = 'NetFront (КПК)'; }
// 	PC
if(stristr($USER_AGENT,'Opera/10') && stristr($USER_AGENT,'Windows NT')){
$USER_AGENT = 'Opera/10 (ПК)'; }
if(stristr($USER_AGENT,'Opera/9.6') && stristr($USER_AGENT,'Windows NT')){
$USER_AGENT = 'Opera/9.6x (ПК)'; }
if(stristr($USER_AGENT,'Opera/9.5') && stristr($USER_AGENT,'Windows NT')){
$USER_AGENT = 'Opera/9.5x (ПК)'; }
if(stristr($USER_AGENT,'Opera/9.2') && stristr($USER_AGENT,'Windows NT')){
$USER_AGENT = 'Opera/9.2x (ПК)'; }
if(stristr($USER_AGENT,'Mozilla/5.0') && stristr($USER_AGENT,'Windows NT')){
$USER_AGENT = 'FireFox (ПК)'; }
if(stristr($USER_AGENT,'Mozilla/4.0') && stristr($USER_AGENT,'Windows NT')){
$USER_AGENT = 'Internet Explorer (ПК)'; }
// 	Sony Ericsson
if(stristr($USER_AGENT,'SonyEricsson') && stristr($USER_AGENT,'W705')){
$USER_AGENT = 'SonyEricsson W705'; }
if(stristr($USER_AGENT,'SonyEricsson') && stristr($USER_AGENT,'P910i')){
$USER_AGENT = 'SonyEricsson P910i'; }
if(stristr($USER_AGENT,'SonyEricsson') && stristr($USER_AGENT,'M600i')){
$USER_AGENT = 'SonyEricsson M600i'; }
if(stristr($USER_AGENT,'SonyEricsson') && stristr($USER_AGENT,'W810i')){
$USER_AGENT = 'SonyEricsson W810i'; }
if(stristr($USER_AGENT,'SonyEricsson') && stristr($USER_AGENT,'K800i')){
$USER_AGENT = 'SonyEricsson K800i'; }
if(stristr($USER_AGENT,'SonyEricsson') && stristr($USER_AGENT,'K500i')){
$USER_AGENT = 'SonyEricsson K500i'; }
if(stristr($USER_AGENT,'SonyEricsson') && stristr($USER_AGENT,'W300i')){
$USER_AGENT = 'SonyEricsson W300i'; }
// 	Nokia
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'N78')){
$USER_AGENT = 'Nokia N78'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'5320d')){
$USER_AGENT = 'SonyEricsson 5320d'; }
if(stristr($USER_AGENT,'Series 60') && stristr($USER_AGENT,'Opera 8.65')){
$USER_AGENT = 'Opera 8.65/S60'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'6600')){
$USER_AGENT = 'Nokia 6600'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'3230')){
$USER_AGENT = 'Nokia 3230'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'6630')){
$USER_AGENT = 'Nokia 6630'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'6680')){
$USER_AGENT = 'Nokia 6680'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'6260')){
$USER_AGENT = 'Nokia 6260'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'7610')){
$USER_AGENT = 'Nokia 7610'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'N-Gage') && stristr($USER_AGENT,'Series60')){
$USER_AGENT = 'Nokia N-Gage/S60'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'6681')){
$USER_AGENT = 'Nokia 6681'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'6670')){
$USER_AGENT = 'Nokia 6670'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'N90')){
$USER_AGENT = 'Nokia N90'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'N70')){
$USER_AGENT = 'Nokia N70'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'7650')){
$USER_AGENT = 'Nokia 7650'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'3650')){
$USER_AGENT = 'Nokia 3650'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'3660')){
$USER_AGENT = 'Nokia 3660'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'N72')){
$USER_AGENT = 'Nokia N72'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'6120')){
$USER_AGENT = 'Nokia 6120'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'N91')){
$USER_AGENT = 'Nokia N91'; }
if(stristr($USER_AGENT,'Nokia') && stristr($USER_AGENT,'E51')){
$USER_AGENT = 'Nokia E51'; }
// SAMSUNG
if(stristr($USER_AGENT,'SAMSUNG') && stristr($USER_AGENT,'E250')){
$USER_AGENT = 'Samsung E250'; }

// БОТЫ
if(stristr($USER_AGENT,'http://www.google.com/bot.html') && stristr($USER_AGENT,'Googlebot')){
$USER_AGENT = 'Google-Bot'; }


$USER_AGENT = str_replace("'","",$USER_AGENT);
$USER_AGENT = str_replace('"','',$USER_AGENT);
$USER_AGENT = str_replace("<","",$USER_AGENT);
$USER_AGENT = str_replace(">","",$USER_AGENT);
$USER_AGENT = str_replace(";",",",$USER_AGENT);
$USER_AGENT = str_replace("_GET","",$USER_AGENT);
$USER_AGENT = str_replace("_POST","",$USER_AGENT);
$USER_AGENT = str_replace("_COOKIE","",$USER_AGENT);
$USER_AGENT = str_replace("copy","",$USER_AGENT);
$USER_AGENT = str_replace("unlink","",$USER_AGENT);
$USER_AGENT = str_replace("\"","",$USER_AGENT);
$USER_AGENT = str_replace("|[\r\n]+|si","",$USER_AGENT);
$USER_AGENT = str_replace("$","",$USER_AGENT);
$USER_AGENT = str_replace("include","",$USER_AGENT);
$USER_AGENT = str_replace("require","",$USER_AGENT);
$USER_AGENT = str_replace("!","",$USER_AGENT);
$USER_AGENT = str_replace("()","",$USER_AGENT);

if(empty($_SERVER['HTTP_REFERER'])){ $USER_REF='Unknown!'; }else{ $USER_REF=checks($_SERVER['HTTP_REFERER']); }
$px = explode('.',$ip);
$ip2 = $px[0].'.'.$px[1].'.'.$px[2];
$ip = $px[0].'.'.$px[1].'.'.$px[2].'.'.$px[3];

if(mysql_num_rows(mysql_query("SELECT * FROM visits WHERE ips='$ip2'"))){}else{
mysql_query("INSERT INTO visits (ips, ip, browser, referer) values ('".checks($ip2)."', '".checks($ip)."', '".checks($USER_AGENT)."', '$USER_REF')");
}


if(isset($_GET['sort'])){
	if($_GET['sort']=='ves' || $_GET['sort']=='name' || $_GET['sort']=='time' || $_GET['sort']=='dwns'){}else{ exit('<br>Ошибка!'); }
	$_SESSION['ssort']=$_GET['sort'];
					}
//




?>