wan-ip how to?

Bringing the internet highway into your project? Building FTP, HTTP, email, chat or other client solutions?

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

wan-ip how to?

Post by shadowslash » Thu Feb 25, 2010 4:12 am

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
Parañaque, Philippines
Image
Image

RRobert
Posts: 151
Joined: Sat Feb 28, 2009 8:20 pm

Re: wan-ip how to?

Post by RRobert » Thu Feb 25, 2010 9:22 pm

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

shadowslash
Posts: 344
Joined: Tue Feb 24, 2009 6:14 pm
Contact:

Re: wan-ip how to?

Post by shadowslash » Fri Feb 26, 2010 2:27 am

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
Last edited by shadowslash on Fri Feb 26, 2010 8:28 am, edited 1 time in total.
Parañaque, Philippines
Image
Image

Post Reply