Jump to content


Photo

PHP form secure


  • Please log in to reply
2 replies to this topic

#1 Rickzkm

Rickzkm
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 10 May 2006 - 07:46 PM

Hello There,

I have php submit form and im getting quite few blank emails in. I was wondering if anyone could help me secure this form. Im new to php and this forum and i am open to any suggestions.

Code:
<?
require "emailtemplate.php";
function SendMail($for = "", $subject = "", $text = "", $email="")
{
$text = StrTr($text, "\x8A\x8D\x8E\x9A\x9D\x9E",
"\xA9\xAB\xAE\xB9\xBB\xBE");
$headers= "From: $email\nMIME-Version: 1.0\nContent-Type: text/html; charset=\"iso-8859-1\"\n";
$headers .= "X-Sender: <"; $headers .= $email; $headers .= ">\n";
$headers .= "X-Mailer: PHP\n";
$headers .= "X-Priority: 1\n";
$headers .= "Return-Path: <"; $headers .= $email; $headers .= ">\n";
if (!@Mail($for, $subject, $text, $headers)) {return false;}
return true;
}
if (SendMail("onlineorders@mydomain.com,".$youremail."", "Order - Send from IP adress: $REMOTE_ADDR", $mailbody, "onlineordersmydomain.com"))
echo "<br>Your order has been sent to mydomain and a copy of your order has been sent to your email address.<br>";
else
echo "<br>Your order has not been sent to mydomain - transfer failed.<br>";

?>

#2 Caesar

Caesar
  • Members
  • PipPipPip
  • Advanced Member
  • 1,025 posts

Posted 10 May 2006 - 07:53 PM

Add image verification to the form....not to mention making required fields to avoid blank submissions.
PHP Ninja

#3 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 10 May 2006 - 07:56 PM

yeah... you should not even allow them to send the email if a field is blank.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users