JScript 得到IP的函数,有错吗?
function GetIp(){
var realip = new String(Request.ServerVariables( "HTTP_X_FORWARDED_FOR "));
var proxy = new String(Request.ServerVariables( "REMOTE_ADDR "));
if(realip.length> 0){
return realip;
}
else{
return proxy;
}
}
不知道哪错了.....求高手
------解决方案--------------------function GetIp(){
var realip = " ";
realip = new String(Request.ServerVariables( "HTTP_X_FORWARDED_FOR "));
var proxy = new String(Request.ServerVariables( "REMOTE_ADDR "));
if(proxy.length==0){
return realip;
}
else{
return proxy;
}
}