您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息
免费发信息

php 取得客户端IP地址代码

2024/4/27 21:22:17发布5次查看
<?
//开源代码
function getip(){
if (getenv("http_client_ip") && strcasecmp(getenv("http_client_ip"), "unknown"))
$ip = getenv("http_client_ip"); //开源
else if (getenv("http_x_forwarded_for") && strcasecmp(getenv("http_x_forwarded_for"), "unknown"))
$ip = getenv("http_x_forwarded_for"); //
else if (getenv("remote_addr") && strcasecmp(getenv("remote_addr"), "unknown"))
$ip = getenv("remote_addr");
else if (isset($_server[@#remote_addr@#]) && $_server[@#remote_addr@#] && strcasecmp($_server[@#remote_addr@#], "unknown"))
//
$ip = $_server[@#remote_addr@#];
else
$ip = "unknown";
return($ip);
}
?>
判断邮箱地址  
<?
function checkemail($inaddress)
{
return (ereg("^([a-za-z0-9_-])+@([a-za-z0-9_-])+(.[a-za-z0-9_-])+",$inaddress));
} //phpfensi.com
?>
<?
function getip() { //获取ip
if ($_server["http_x_forwarded_for"])
$ip = $_server["http_x_forwarded_for"]; //
else if ($_server["http_client_ip"])
$ip = $_server["http_client_ip"];
else if ($_server["remote_addr"])
$ip = $_server["remote_addr"]; //
else if (getenv("http_x_forwarded_for"))
$ip = getenv("http_x_forwarded_for");
else if (getenv("http_client_ip"))
$ip = getenv("http_client_ip"); //
else if (getenv("remote_addr"))
$ip = getenv("remote_addr");
else
$ip = "unknown";
return $ip;
}
?>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录