Contact Form help

  • ecu3333
  • Born
  • Born
  • ecu3333
  • Posts: 4

Post 3+ Months Ago

I have a contact form for my church's website and the form works perfect except it returns the sender's IP address in lieu of the here@home.com format. Can anyone help me change this? thanks.

php form info
Code: [ Select ]
<form action="mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px; width:300px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">
  Send To:<br />
  <select name="sendto">
    <option value="recipient_1">Recipient #1</option>
    <option value="recipient_2">Recipient #2</option>
    <option value="recipient_3">Recipient #3</option>
  </select>
  <br />
  <br />
  Your e-mail:<br />
  <input name="from" type="text" id="from" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['from'];?>"/>
  <br />
  <br />
  Subject:<br />
  <input name="subject" type="text" id="subject" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;" value="<?php echo $_GET['subject'];?>"/>
  <br />
  <br />
  Type verification image:<br />
  <input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"/>
  <img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
  <br />
  <!-- if the variable "wrong_code" is sent from previous page then display the error field -->
  <?php if(isset($_GET['wrong_code'])){?>
  <div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div>
  <br />
  <?php ;}?>
  Message:<br />
  <textarea name="message" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:300px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"><?php echo $_GET['message'];?></textarea>
  <input name="Submit" type="submit" style="margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value="Send Message"/>
                </form>
  1. <form action="mailer.php" method="post" name="form1" id="form1" style="margin:0px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px; width:300px;" onsubmit="MM_validateForm('from','','RisEmail','subject','','R','verif_box','','R','message','','R');return document.MM_returnValue">
  2.   Send To:<br />
  3.   <select name="sendto">
  4.     <option value="recipient_1">Recipient #1</option>
  5.     <option value="recipient_2">Recipient #2</option>
  6.     <option value="recipient_3">Recipient #3</option>
  7.   </select>
  8.   <br />
  9.   <br />
  10.   Your e-mail:<br />
  11.   <input name="from" type="text" id="from" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px; font-family:Verdana, Arial, Helvetica, sans-serif;font-size:11px;" value="<?php echo $_GET['from'];?>"/>
  12.   <br />
  13.   <br />
  14.   Subject:<br />
  15.   <input name="subject" type="text" id="subject" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;" value="<?php echo $_GET['subject'];?>"/>
  16.   <br />
  17.   <br />
  18.   Type verification image:<br />
  19.   <input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid #CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"/>
  20.   <img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it in the box" width="50" height="24" align="absbottom" /><br />
  21.   <br />
  22.   <!-- if the variable "wrong_code" is sent from previous page then display the error field -->
  23.   <?php if(isset($_GET['wrong_code'])){?>
  24.   <div style="border:1px solid #990000; background-color:#D70000; color:#FFFFFF; padding:4px; padding-left:6px;width:295px;">Wrong verification code</div>
  25.   <br />
  26.   <?php ;}?>
  27.   Message:<br />
  28.   <textarea name="message" cols="6" rows="5" id="message" style="padding:2px; border:1px solid #CCCCCC; width:300px; height:100px; font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px;"><?php echo $_GET['message'];?></textarea>
  29.   <input name="Submit" type="submit" style="margin-top:10px; display:block; border:1px solid #000000; width:100px; height:20px;font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; padding-left:2px; padding-right:2px; padding-top:0px; padding-bottom:2px; line-height:14px; background-color:#EFEFEF;" value="Send Message"/>
  30.                 </form>


here is the mailer.php
Code: [ Select ]
<?php
 
// load the variables from address bar
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];
 
// remove the backslashes that normally appears when entering " or '
$message = stripslashes($message);
$subject = stripslashes($subject);
$from = stripslashes($from);
 
// check to see if verificaton code was correct
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
    // if verification code was correct send the message and show this page
    $recipients = array(
 
'recipient_1' => 'ecu33@hotmail.com',
'recipient_2' => 'ecu33@hotmail.com.',
'recipient_3' => 'ecu33@hotmail.com'
 
);
 
$my_email = $recipients[$_REQUEST['sendto']];
 
    mail($my_email, 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
    // delete the cookie so it cannot sent again by refreshing this page
    setcookie('tntcon','');
} else {
    // if verification code was incorrect then return to contact page and show error
    header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
    exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-Mail Sent</title>
<style type="text/css">
<!--
body,td,th {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
}
-->
</style></head>
 
<body>
Email sent. Thank you.<br />
<br />
Return to <a href="www.pilot.com">home page</a> ?
</body>
</html>
 
  1. <?php
  2.  
  3. // load the variables from address bar
  4. $subject = $_REQUEST["subject"];
  5. $message = $_REQUEST["message"];
  6. $from = $_REQUEST["from"];
  7. $verif_box = $_REQUEST["verif_box"];
  8.  
  9. // remove the backslashes that normally appears when entering " or '
  10. $message = stripslashes($message);
  11. $subject = stripslashes($subject);
  12. $from = stripslashes($from);
  13.  
  14. // check to see if verificaton code was correct
  15. if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
  16.     // if verification code was correct send the message and show this page
  17.     $recipients = array(
  18.  
  19. 'recipient_1' => 'ecu33@hotmail.com',
  20. 'recipient_2' => 'ecu33@hotmail.com.',
  21. 'recipient_3' => 'ecu33@hotmail.com'
  22.  
  23. );
  24.  
  25. $my_email = $recipients[$_REQUEST['sendto']];
  26.  
  27.     mail($my_email, 'Online Form: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
  28.     // delete the cookie so it cannot sent again by refreshing this page
  29.     setcookie('tntcon','');
  30. } else {
  31.     // if verification code was incorrect then return to contact page and show error
  32.     header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
  33.     exit;
  34. }
  35. ?>
  36. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  37. <html xmlns="http://www.w3.org/1999/xhtml">
  38. <head>
  39. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  40. <title>E-Mail Sent</title>
  41. <style type="text/css">
  42. <!--
  43. body,td,th {
  44.     font-family: Arial, Helvetica, sans-serif;
  45.     font-size: 12px;
  46. }
  47. -->
  48. </style></head>
  49.  
  50. <body>
  51. Email sent. Thank you.<br />
  52. <br />
  53. Return to <a href="www.pilot.com">home page</a> ?
  54. </body>
  55. </html>
  56.  


Thank you to all who contribute to this website.
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • ecu3333
  • Born
  • Born
  • ecu3333
  • Posts: 4

Post 3+ Months Ago

It works now. Hopefully someone can use this.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 141 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.