send IP address variable

NateMail, ProcessForm, JavaScript Form Validator, Form Security, etc.
rubycat
Posts: 2
Joined: 09/24/2005 @ 14:50

send IP address variable

Postby rubycat » 09/24/2005 @ 14:57

In NateMail...aside from setting it to true, is there a secret to getting the "send IP address of visitor in email" to work?

Thank you Nate...I appreciate your hard work on this and that you have made it available to the rest of us. :D

Dirk Williams
Posts: 12
Joined: 09/23/2005 @ 17:56

Postby Dirk Williams » 09/26/2005 @ 11:01

This is what Nate told me what to do. First, is changing it to "true" not working?

Try this: add this code at the top of your script just after the opening <?php tag...

$_POST['visitor_ip'] = $_SERVER['REMOTE_ADDR']; ?$HTTP_POST_VARS['visitor_ip'] = $_POST['visitor_ip'];

If you have any problems, post back

Dirk

Nate Baldwin
Site Admin
Posts: 3724
Joined: 04/25/2003 @ 19:05

Postby Nate Baldwin » 09/26/2005 @ 11:43

Yeah, you should be able to just set it to "true" in versions 3.0.9 - 3.0.11. Is it not working that way for you?

rubycat
Posts: 2
Joined: 09/24/2005 @ 14:50

Postby rubycat » 09/26/2005 @ 11:48

I'm using 3.0.10...downloaded it two days ago. Didn't see 3.0.11.

Dirk's method didn't work, with or without the question mark in it (with it, it gives a parse error).

And yeah...sorry to say, setting it to "true" isn't doing anything. Alas, it seemed so simple...:-)

Nate Baldwin
Site Admin
Posts: 3724
Joined: 04/25/2003 @ 19:05

Postby Nate Baldwin » 09/26/2005 @ 19:28

3.0.11 was uploaded over the weekend. You should be fine with 3.0.10 though.

Can't explain why setting the variable to true wouldn't work since it does work here, but here's the line of custom code you can try adding (just after the opening <?php line)...

Code: Select all

$serverVars = (isset($_SERVER)) ? $_SERVER : $HTTP_SERVER_VARS;
$_POST['visitor_IP'] = (isset($serverVars['REMOTE_ADDR'])) ? $serverVars['REMOTE_ADDR'] : "(unknown)";
$HTTP_POST_VARS['visitor_IP'] = $_POST['visitor_IP'];


Unless I just typed that wrong, it should work in both old and new versions of PHP. If it doesn't work, can you send me a copy of your script file using the contact form...
http://www.mindpalette.com/contact/
...and post back with a link to your form page?


Return to “Form Processing (NateMail, ProcessForm)”



Who is online

Users browsing this forum: No registered users and 3 guests

cron