以前有朋友留言要美博园 的上网ip检测代码,美博园有几种ip检测方式,前文公布了一种基本的检测ip方式 美博园上网ip检测实用代码之一 ,本文是美博园首页下方 美博园ip检测ipcheck 的代理ip查看代码,代理查看更详细,这些ip检测代码公布于此,供自己建立网页的朋友检测ip之用,代码如下:
<?php if ($_SERVER["HTTP_X_FORWARDED_FOR"] != "") {
$IP = $_SERVER["HTTP_X_FORWARDED_FOR"];
$proxy = $_SERVER["REMOTE_ADDR"];
$host = @gethostbyaddr($_SERVER["HTTP_X_FORWARDED_FOR"]);
} else {
$IP = $_SERVER["REMOTE_ADDR"];
$host = @gethostbyaddr($_SERVER["REMOTE_ADDR"]);
} ?>
<?php echo("REMOTE_ADDR : " . $_SERVER['REMOTE_ADDR'] . "\n"); ?><br />
<?php echo("REMOTE_HOST : " . $_SERVER['REMOTE_HOST'] . "\n"); ?><br />
<?php echo("Server Host : " . $host . "\n"); ?><br />
<?php echo("Remote Port : " . $_SERVER["REMOTE_PORT"] . "\n"); ?><br />
<?php echo("Request Method : " . $_SERVER["REQUEST_METHOD"] . "\n"); ?><br />
<?php echo("Server Protocol : " . $_SERVER["SERVER_PROTOCOL"] . "\n"); ?><br />
<?php echo("HTTP_X_FORWARDED_FOR : " . $_SERVER['HTTP_X_FORWARDED_FOR'] . "\n"); ?><br />
<?php echo("HTTP_VIA : " . $_SERVER['HTTP_VIA'] . "\n"); ?><br />
<?php echo("HTTP_CLIENT_IP : " . $_SERVER['HTTP_CLIENT_IP'] . "\n"); ?><br />
<?php echo("HTTP_PROXY_CONNECTION : " . $_SERVER['HTTP_PROXY_CONNECTION'] . "\n"); ?><br />
<?php echo("FORWARDED_FOR : " . $_SERVER['FORWARDED_FOR'] . "\n"); ?><br />
<?php echo("X_FORWARDED_FOR : " . $_SERVER['X_FORWARDED_FOR'] . "\n"); ?><br />
<?php echo("X_HTTP_FORWARDED_FOR : " . $_SERVER['X_HTTP_FORWARDED_FOR'] . "\n"); ?><br />
<?php echo("HTTP_FORWARDED : " . $_SERVER['HTTP_FORWARDED'] . "\n"); ?><br />
<?php echo("HTTP_REFERER : " . $_SERVER['HTTP_REFERER'] . "\n"); ?><br />
<?php echo("HTTP_USER_AGENT : " . $_SERVER['HTTP_USER_AGENT'] . "\n"); ?><br /></p>
via 美博园 http://feedproxy.google.com/~r/allinfa/~3/zC6K-x6FRdw/allinfa-ip-detection-code-part-two.html
No comments:
Post a Comment