Page 1 of 1

wan-ip how to?

Posted: Thu Feb 25, 2010 4:12 am
by shadowslash
can anybody share some light to my problem?

How do I get the WAN-IP of the current user of my application? I need this to implement IP blocking for abusive actions that users would take. Thanks a lot all!

*Drinking coffee in the morning...* Image

Re: wan-ip how to?

Posted: Thu Feb 25, 2010 9:22 pm
by RRobert

Code: Select all

Basic function to get the external IP address.

function getIP
   local tIP
   
   try
      put URL "http://checkip.dyndns.org" into tIP
      put word 6 of tIP into tIP
      put replaceText(tIP,"</body></html>","") into tIP
   end try
   
   return tIP
end getIP
You could also setup your own check IP script.

Code: Select all

checkip.php

<?php

$ip=$_SERVER['REMOTE_ADDR'];
echo "IP Address: $ip";

?>
Robert

Re: wan-ip how to?

Posted: Fri Feb 26, 2010 2:27 am
by shadowslash
RRobert wrote:

Code: Select all

checkip.php

<?php

$ip=$_SERVER['REMOTE_ADDR'];
echo "IP Address: $ip";

?>
Robert
Lol, I managed to get a fix done 10 minutes after my post above, I used a my revServer-powered hosting to retrieve the IP of the user by simply putting $REMOTE_ADDR... Image

EDIT:
Don't you just love spammers? I don't. Image