判斷潤年的規則
是不是這樣子的: 能被4整除,或者能被100整除并能被400整除 ...
作者 chenhonghe 发布于 2003-09-00 分类:php基础编程
Get the RIGHT IP adress of the current user
When you use REMOTE_ADDR for getting the IP of the current user,
sometimes you get the IP of the ISP Cache server.
When this happens, the HTTP_X_FORWARDED_FOR is also set, it
contains the IP of the user.
So with this script, you always get the right IP:
if (getenv(HTTP_X_FORWARDED_FOR)){
$ip=getenv(HTTP_X_FORWARDED_FOR);
}
else {
$ip=getenv(REMOTE_ADDR);
}
For comments please mail me.
Klemens Karssen
john-php@pc.xs4all.nl (16-Aug-2000 01:56)
Note that the X-Forwarded for header might contain multiple addresses, comma separated, if the request was forwarded through multiple proxies.
Finally, note that any user can add an X-Forwarded-For header themselves. The header is only good for traceback information, never for authentication. If you use it for traceback, just log the entire X-Forwarded-For header, along with the REMOTE_ADDR.
dima_@dmitry.ru (07-Jul-2002 12:40)
To get REAL ip, u can also use this:
if(getenv("HTTP_CLIENT_IP")) {
$ip = getenv("HTTP_CLIENT_IP");
} elseif(getenv("HTTP_X_FORWARDED_FOR")) {
$ip = getenv("HTTP_X_FORWARDED_FOR");
} else {
$ip = getenv("REMOTE_ADDR");
}
Thus, we should have real user IP in variable $ip.
问一下下,这样子取IP所有代理的是不是也可以取到真实的IP啊。
可不可靠啊?
逛论坛交流:取得真是ip,"东东"那里找到的,但有不懂。
怎么取得$query=mysql_query("select count(name) from ip",$
哪里找的?我咋不知道?
我以前就用这个,实际证明不可靠,取得太狠了,经常会取到192.168.0.5之类的内部IP,够不够强啊!
太强了
PHP手册中就有
QUOTE: 最初由 冬冬 发布
[B]哪里找的?我咋不知道? [/B]
就在你的那个签名里找到的啊。
那就是说没什么更好的啦。。那java applet能不能取真实的IP哩?
这东西能不能用的啊,行不行的啊。
有当然是可以用啦,,想用就试试吧。。
7 条回复
回复