h***i 发帖数: 11 | 1 我想在网页中实现下面的功能:
web server:阿帕奇
language: cgi/perl 5.0
想在用户点击我的网页时,记录用户的ip地址。
现在我用 $env{remote_addr} (at lease something like this)
但是得到的是用户的proxy的地址。(如果用户使用了代理的话)
如何得到真实的ip地址?
例子:www.5460.net的留言簿,就可以检测用户的真实抵制。
谢谢了。 | M******t 发帖数: 309 | 2 http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=884&lngWId=8
看看这个,不过是php的code,应该差不太多
【在 h***i 的大作中提到】 : 我想在网页中实现下面的功能: : web server:阿帕奇 : language: cgi/perl 5.0 : 想在用户点击我的网页时,记录用户的ip地址。 : 现在我用 $env{remote_addr} (at lease something like this) : 但是得到的是用户的proxy的地址。(如果用户使用了代理的话) : 如何得到真实的ip地址? : 例子:www.5460.net的留言簿,就可以检测用户的真实抵制。 : 谢谢了。
| s**********i 发帖数: 711 | 3 as I answered to hobli already, there are many proxy
servers don't forward the "real" IP... it's pretty
much useless to do much about IP.
【在 M******t 的大作中提到】 : http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=884&lngWId=8 : 看看这个,不过是php的code,应该差不太多
| p******f 发帖数: 162 | 4
as shi's said, not all proxy forwards real client ip address, but
if the proxy does include the real client ip in the http request,
apache/perl will not hide it, so that means in theory, you can do
(with apache/perl) whatever 5460 can do, no more, no less.
actually doing it is not difficault, check the http request sent
by proxy, (using a sniffer like tcpdump or nfrep) see whating in
the request header.
print out all the env of your perl script, you may find the real ip
in some env variable, or
【在 h***i 的大作中提到】 : 我想在网页中实现下面的功能: : web server:阿帕奇 : language: cgi/perl 5.0 : 想在用户点击我的网页时,记录用户的ip地址。 : 现在我用 $env{remote_addr} (at lease something like this) : 但是得到的是用户的proxy的地址。(如果用户使用了代理的话) : 如何得到真实的ip地址? : 例子:www.5460.net的留言簿,就可以检测用户的真实抵制。 : 谢谢了。
| h***i 发帖数: 11 | 5
thx a lot! I really learn something valuable! :)
【在 p******f 的大作中提到】 : : as shi's said, not all proxy forwards real client ip address, but : if the proxy does include the real client ip in the http request, : apache/perl will not hide it, so that means in theory, you can do : (with apache/perl) whatever 5460 can do, no more, no less. : actually doing it is not difficault, check the http request sent : by proxy, (using a sniffer like tcpdump or nfrep) see whating in : the request header. : print out all the env of your perl script, you may find the real ip : in some env variable, or
| h***i 发帖数: 11 | 6
thx a lot, it really helps!!
【在 M******t 的大作中提到】 : http://www.pscode.com/vb/scripts/ShowCode.asp?txtCodeId=884&lngWId=8 : 看看这个,不过是php的code,应该差不太多
|
|