php question
Date: 05/25/07
(Computer Geeks) Keywords: php, html
Why does the second test not work?
ignore the space in the <>. it was the only way to get the code to show.
?php
session_start();
$number = $_POST['verify'];
$test = md5($number);
if ($test == $_SESSION['image_random_value']){
$name=$_POST['name'];
$number=$_POST['number'];
$email="email@email.com";
$reply_email =$_POST['email'];
$headers="Reply-to: <$email>\r\n";
$subject="Appointment";
$body[0]="$name would like an appointment on \n";
$body[1]=" $date \n";
$body[2]="They can be contacted at $number";
$body[3]="Their email is $reply_email";
$body=$body[0].$body[1].$body[2].$body[3];
if (strpos($reply_email, '@') !== FALSE && strlen($reply_email) > 6){
mail($email,$subject,$body,$headers);
echo "Email has been sent";
}
else {
echo "< html>";
echo "< head>";
echo "< meta http-equiv='Content-Type' content='text/html' charset='iso-8859-1'>";
echo "< /head>";
echo "";
echo "< form method='post' action='email2.php'>";
echo "< p>Name:";
echo "< input name='name' type='text' id='name' />";
echo "< /p>";
echo "< p>Number:";
echo "< input name='number' type='text' id='number' maxlength='12' />";
echo "< /p>";
echo "< p>email:";
echo "< input name='email' type='text' id='email' maxlength='150' /> Input a correct email ";
echo "< /p>";
echo "< p>";
echo "Date and time your would like the appointment.";
echo "< input name='date' type='text' id='date' />";
echo "< /p>";
echo "< p>Verify your human:";
echo "< input name='verify' type='text' id='verify' maxlength='5' /> ";
echo "< /p>";
echo "< p>";
echo "< input type='submit' name='Submit' value='Email' />";
echo "< /p>";
echo "< /form>";
echo "< /body>";
echo "< /html>";
}
}
if ($test != $_SESSION['image_random_value']){
echo "< html>";
echo "< head>";
echo "< meta http-equiv='Content-Type' content='text/html' charset='iso-8859-1'>";
echo "< /head>";
echo "< body>";
echo "< form method='post' action='email2.php'>";
echo "< p>Name:";
echo "< input name='name' type='text' id='name' />";
echo "< /p>";
echo "< p>Number:";
echo "< input name='number' type='text' id='number' maxlength='12' />";
echo "< /p>";
echo "< p>email:";
echo "< input name='email' type='text' id='email' maxlength='150' />;
echo "< /p>";
echo "< p>";
echo "Date and time your would like the appointment.";
echo "< input name='date' type='text' id='date' />";
echo "< /p>";
echo "< p>Verify your human:";
echo "< input name='verify' type='text' id='verify' maxlength='5' /> Incorrect number " ;
echo "< /p>";
echo "< p>";
echo "< input type='submit' name='Submit' value='Email' />";
echo "< /p>";
echo "< /form>";
echo "< /body>";
echo "< /html>";
}
?
Source: http://community.livejournal.com/computergeeks/1075137.html