Jump to content

IP Address not displaying in contact form.


Loougle

Recommended Posts

I have been reading all day on this, and yet I still am not getting it correct. I have read a handful of posts on here and other places and i'm about to pull my hair out, I finally made everything and it's working I just need the IP address to display when they submit their contact information.

 

<p style: align="center"><form action="mail.php" method="POST">

<?php

$ipi = getenv("REMOTE_ADDR");

$httprefi = getenv ("HTTP_REFERER");

$httpagenti = getenv ("HTTP_USER_AGENT");

?>

 

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />

<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />

<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

<div align="center">

<p class="style1">Name</p>

<input type="text" name="name">

<p class="style1">Email</p>

<input type="text" name="email">

<p class="style1">Phone</p>

<input type="text" name="phone">

<p class="style1">Debtor</p>

<input type="text" name="debtor">

<br />

<br />

<p class="style1">I hear by agree that the information I have provided is true, accurate and the information I am submitting is <br />

not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms:</p>

<select name="agree" size="1">

<option value="Agree">Agree</option>

<option value="Disagree">Disagree</option>

</select>

<br />

<br />

<p class="style1">Employee ID:</p>

<input type="text" name="employee">

 

<br />

 

<input type="submit" value="Send"><input type="reset" value="Clear">

</div>

</form>

 

 

and then the mail.php form is

 

<?php

$ip = $_POST['ip'];

$httpref = $_POST['httpref'];

$httpagent = $_POST['httpagent'];

$name = $_POST['name'];

$email = $_POST['email'];

$phone = $_POST['phone'];

$debtor = $_POST['debtor'];

$agree = $_POST['agree'];

$employee = $_POST['employee'];

$formcontent=" From: $name \n Email: $email \n Phone: $phone \n Debtor: $debtor \n I hear by agree that the information I have provided is true, accurate and the information I am submitting is not fraudulent. Please click the agree button that you adhere to Commercial Recovery Authority Inc.'s terms: $agree \n Employee ID: $employee \n IP: $ip";

$recipient = "mail@crapower.com";

$subject = "Online Authorization Form";

$mailheader = "From: $email \r\n";

mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");

echo "Thank You!" . " -" . "<a href='index.php' style='text-decoration:none;color:#ffcb00;'> Return Home</a>";

$ip = $_POST['visitoraddress']

?>

 

I need help

 

Link to comment
Share on other sites

First of all, you should not populate the IP address in the form and then use the posted values. Users can easily modify any data they want in a form - even hidden fields. Just get the IP address on the page that processed the data, then the user cannot modify it. Of course, they can always spook their IP address, but there is nothing you can do about that.

Link to comment
Share on other sites

Try the following

 

$ip        = $_SERVER['REMOTE_ADDR'];

$httpref   = trim($_POST['httpref']);
$httpagent = trim($_POST['httpagent']);
$name     = trim($_POST['name']);
$email    = trim($_POST['email']);
$phone    = trim($_POST['phone']);
$debtor   = trim($_POST['debtor']);
$agree    = trim($_POST['agree']);
$employee = trim($_POST['employee']);

$formcontent = "From: $name \n
                Email: $email \n
                Phone: $phone \n
                Debtor: $debtor \n
                I hear by agree that the information I have provided is true, accurate and the
                information I am submitting is not fraudulent. Please click the agree button
                that you adhere to Commercial Recovery Authority Inc.'s terms: $agree\n
                Employee ID: $employee \n
                IP: $ip";
$recipient  = "mail@crapower.com";
$subject    = "Online Authorization Form";
$mailheader = "From: $email \r\n";
mail($recipient, $subject, $formcontent, $mailheader) or die("Error!");
echo "Thank You! -<a href=\"index.php\" style=\"text-decoration:none;color:#ffcb00;\">Return Home</a>";
//$ip = $_POST['visitoraddress'];

Link to comment
Share on other sites

  • 4 weeks later...
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.