brickholius
11-01-2004, 12:51 PM
How can I use form mail (having users submit a form on my webpage with info) and have it also include their IP address. I understand how to do the basic form mail but how do i make it so i records their ip addresss and includes it in the email that is sent to the admin?
brickholius
What language will you use to write the script?
<input type=hidden name="env_report" value="REMOTE_HOST,REMOTE_ADDR">
This works in the generic PERL FormMail script (which is not recommended, BTW), and it's something you should be able to use?
brickholius
11-01-2004, 01:19 PM
Why is formmail bad? What do you suggest and will the code below work with your suggestion?
Originally posted by bear
<input type=hidden name="env_report" value="REMOTE_HOST,REMOTE_ADDR">
This works in the generic PERL FormMail script (which is not recommended, BTW), and it's something you should be able to use?
The original FormMail script from Matts script archives was (and still remains) incredibly easy for spammers to subvert. There was another version released (not by Matt) that had this corrected, but I honestly don't know if it's really perfected or not.
That code will work with FormMail, and it's use is documented within the script. With a little effort, you should be able to figure out how to use it with another script as well.
xgoth3
11-01-2004, 06:21 PM
Why don't you try with PHP? its much easier.
brickholius
11-01-2004, 07:00 PM
Do you have a script or can you suggest one?
xgoth3
11-01-2004, 07:34 PM
This is a very simple example:
<?php
if($HTTP_POST_VARS['proc']=='go'){
#define your email
$MyEmail='myuser@mydomain.com'; //you have to change this with your email where you want to get the form info.
#email headers
$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n"; //you could change this to "text/html" if you want
$headers .= "From: $name: IP($IP) <$email>\r\n";
#add all posts to message
$posts=$HTTP_POST_VARS;
$message.="\n";
while(list($k,$v)=each($posts)){
$message.="\n$k: $v";
}
#mail
$send=mail($MyEmail,$subject,$message,$headers);
}
?>
<form method="post">
name:<input type="text" name="name"><br>
email:<input type="text" name="email"><br>
subject:<input type="text" name="subject"><br>
message:<textarea name="message" cols="50" rows="20"></textarea><br>
<input type="submit" value="Send">
<input type="hidden" name="proc" value="go">
<input type="hidden" name="IP" value="<?=$REMOTE_ADDR;?>">
</form>
I hope you find it usefull
Jason-Hosts
11-01-2004, 08:04 PM
This is a good script I found, it sends the users IP with it - phpmailto [dot] xeweb [dot] net
soz cant post URL's yet ;)
jasong
11-01-2004, 08:38 PM
Try searching the forums! :)
http://www.webhostingtalk.com/showthread.php?s=&threadid=336445