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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.