hey guys, anybody willing to help me cleanup my email code?
mail.php
mail-sent.php
mail.php
Code:
<?php include("header.php") ?> <form method="post" action="mail-sent.php"> <?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 ?>" /> Your Name: <input type="text" name="name" size="35" /> Your Email: <input type="text" name="from" size="35" /> Subject: <input type="text" name="subject" size="35" /> Message: <input type="text" name="message" size="300" /> <input type="submit" value="Send Message" /> </form> <?php include("footer.php") ?>
Code:
<?php include("header.php") ?> <?php if(!$from == "" && (!strstr($from,"@") || !strstr($from,"."))) { echo "<h2>Message Not sent - Please Enter a VALID email address</h2>\n"; $badinput = "<h2>Feedback was NOT submitted</h2>\n"; } if(empty($name) || empty($from) || empty($message )) { echo "<h2>Message Not sent - Please fill in all fields</h2>\n"; } echo $badinput; $todayis = date("g:i a, l, j F, Y, "); $subject = "FROM KWAH.FANTASTWAP.NET: $subj "; $message = stripcslashes($message); $feedback = " From: $name ($from)\n $todayis [EST] \n Subject: $subj \n Message: $feedback \n Message sent from a $httpagent \n IP = $ip \n Referral : $httpref \n "; $from = "From: $from\r\n"; mail("kwah90@gmail.com", $subject, $message, $from); ?> <p align="center"> Thank You! Your message has been sent to Site Admin at <?php echo $todayis ?>. You should revieve a reply shortly, but if not, i ask that you contact me again because your feedback is important to the site. Details of your message can be found below, or alternatively, select the link below: [url="/index2.php"][ BACK ][/url] <hr> Time/Date: <?php echo $todayis ?> From: <?php echo $name ?> ( <?php echo $from ?> ) Subject: <?php echo $subj ?> Message: <?php $msgout = str_replace("\r", " ", $message); echo $msgout; ?> </p> <?php include("footer.php") ?>
Comment