Quick Code Request

Soldato
Joined
30 Jun 2003
Posts
2,807
Location
Berkshire
Right designing a site and need to create a form on it, it needs a script where when the form is submitted it will also submit the ip address it was sent from,

Thanks in advance
 
With which language? What else is on the form? Where is it being submitted to?

Code:
$_SERVER['REMOTE_ADDR']
will give you the user's IP in PHP, as a start.
 
If doing in PHP:

$IP = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"];
$proxy = $HTTP_SERVER_VARS["REMOTE_ADDR"];
$host = @gethostbyaddr($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]);

You'll get something that will look like this...

313.88.1.99 <--IP addy of user.
62.31.224.1 <--IP addy of server.
313-88-1-99.bas.cvx.blueyonder.co.uk <-- Users host addy.

The host address will look slightly different depending on the ISP/server.

eg.
cache01.drkw.com
cache-mtc-ak02.proxy.aol.com
furness-gw.phila.k12.pa.us
194.238.179.180

This is assuming you already have the form in place?
 
Back
Top Bottom