|
|
@ -194,24 +194,63 @@ function db__antisql($str) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*****log******/ |
|
|
|
/*****log******/ |
|
|
|
function yimian__log($table, $val, $index = ""){ |
|
|
|
function yimian__log($table, $val, $index = "", $cnt = null){ |
|
|
|
|
|
|
|
|
|
|
|
if($index != "") db__pushData(db__connect("log"), $table, $val, $index); |
|
|
|
if(!isset($cnt)) $cnt = db__connect("log"); |
|
|
|
else db__pushData(db__connect("log"), $table, $val); |
|
|
|
if($index != "") db__pushData($cnt, $table, $val, $index); |
|
|
|
|
|
|
|
else db__pushData($cnt, $table, $val); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** get from address **/ |
|
|
|
/** get from address **/ |
|
|
|
function get_from(){ |
|
|
|
function get_from(){ |
|
|
|
|
|
|
|
|
|
|
|
if($_SERVER['HTTP_REFERER']) return $_SERVER['HTTP_REFERER']; |
|
|
|
if($_SERVER['HTTP_REFERER']) return $_SERVER['HTTP_REFERER']; |
|
|
|
elseif($_REQUEST['from']) return $_REQUEST['from']; |
|
|
|
elseif($_REQUEST['from']) return $_REQUEST['from']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function get_from_domain(){ |
|
|
|
function get_from_domain(){ |
|
|
|
|
|
|
|
|
|
|
|
$str = str_replace("http://","",get_from()); |
|
|
|
$str = str_replace("http://","",get_from()); |
|
|
|
$str = str_replace("https://","",$str); |
|
|
|
$str = str_replace("https://","",$str); |
|
|
|
$strdomain = explode("/",$str); |
|
|
|
$strdomain = explode("/",$str); |
|
|
|
return $strdomain[0]; |
|
|
|
return $strdomain[0]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* get IP */ |
|
|
|
|
|
|
|
function getIp() |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (isset($_SERVER)) { |
|
|
|
|
|
|
|
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
|
|
|
|
|
|
$arr = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($arr as $ip) { |
|
|
|
|
|
|
|
$ip = trim($ip); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($ip != 'unknown') { |
|
|
|
|
|
|
|
$realip = $ip; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (isset($_SERVER['HTTP_CLIENT_IP'])) { |
|
|
|
|
|
|
|
$realip = $_SERVER['HTTP_CLIENT_IP']; |
|
|
|
|
|
|
|
} else if (isset($_SERVER['REMOTE_ADDR'])) { |
|
|
|
|
|
|
|
$realip = $_SERVER['REMOTE_ADDR']; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$realip = '0.0.0.0'; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else if (getenv('HTTP_X_FORWARDED_FOR')) { |
|
|
|
|
|
|
|
$realip = getenv('HTTP_X_FORWARDED_FOR'); |
|
|
|
|
|
|
|
} else if (getenv('HTTP_CLIENT_IP')) { |
|
|
|
|
|
|
|
$realip = getenv('HTTP_CLIENT_IP'); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
$realip = getenv('REMOTE_ADDR'); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preg_match('/[\\d\\.]{7,15}/', $realip, $onlineip); |
|
|
|
|
|
|
|
$realip = (!empty($onlineip[0]) ? $onlineip[0] : '0.0.0.0'); |
|
|
|
|
|
|
|
return $realip; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|