Jump to content

Users IP - Submit


mynamesleo

Recommended Posts

First get the IP address of the user and then assign it to a variable.

[code]
<?php

$domain = GetHostByName($REMOTE_ADDR);

?>
[/code]

pass this value to a  hidden variable.

[code]

<input type="hidden" name="domain" value="<?php echo $domain;?>"

[/code]

when u submit the form this value is also getting passed. so u can use there..

another option is , storing IP address in a session variable. so you can use any where in your scripts.


Link to comment
https://forums.phpfreaks.com/topic/26148-users-ip-submit/#findComment-119559
Share on other sites

The $REMOTE_ADDR varible relies on register_globals to be on. Use $_SERVER['REMOTE_ADDR'] variable instead.

If you just want to capture the persons, IP address then there's no reason to put it in the form (as a hidden field) to begin with. Just grab it after the form is submitted.

Please note that getting the real IP address is a little more complicated that just using that one server variable (because of proxy use).

Link to comment
https://forums.phpfreaks.com/topic/26148-users-ip-submit/#findComment-119619
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.