php 获取用户IP与IE信息程序
php 获取用户IP与IE信息程序
<?php
function onlineip() {
global $_SERVER;
if (getenv('HTTP_CLIENT_IP')) {
$onlineip = getenv('HTTP_CLIENT_IP');
} elseif (getenv('HTTP_X_FORWARDED_FOR')) {
list($onlineip) = explode(',', getenv('HTTP_X_FORWARDED_FOR'));
} elseif (getenv('REMOTE_ADDR')) {
$onlineip = getenv('REMOTE_ADDR');
} else {
$onlineip = $_SERVER['REMOTE_ADDR'];
}
return $onlineip;
}
function imgdecode($string) {
global $_SERVER;
$key = md5(onlineip() . "t" . $_SERVER['HTTP_USER_AGENT']);
$coded = '';
$string = base64_decode($string);
$keylength = strlen($key);
for ($i = 0; $i < strlen($string); $i+= $keylength) {
$coded.= substr($string, $i, $keylength) ^ $key;
}
return $coded;
}教程地址:http://www.phprm.com/code/b7cd2cc99701d17c3b0002e6c976aad9.html
欢迎转载!但请带上文章地址^^