因为最近各地网监要求信息发布网站,记录访客ip和端口号,被逼无奈花了一晚上终于搞好了,这个是apache下获取访客ip和端口号的函数,可以先用以下代码测试一下,怎么存在数据库就自己发挥吧
小站长难做啊……
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>PHP程序获取访客客户端TCP/IP端口的方法</title>
</head>
<style>
td{
font-size:9pt;
}
</style>
<body>
<?php $ip=$_SERVER['REMOTE_PORT'];?>
<?php $ipp= $_SERVER["REMOTE_ADDR"];?>
<?php $ipr= $ipp.":".$ip;?>
<table width="787" height="259" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="259" valign="bottom" background="images/bg.jpg">
<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">客户端TCP/IP端口: <?php echo $ipr;?><br>
<br></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
评论列表: