I've got a quite ridiculous problem with a captcha image and session variable.
http://paholo.com/npdev/tests/contact_us2.php?add=1&confirm=new#contact
I've used this same "Contact us" script numerous other times but clearly something is now off with it. It just won't store the $_session['captchacode']
when I run the make_captcha.php
inside the script.
I have session_start()
on both themake_captcha.php
and the contact_us2.php
script.
I know there is a simple answer here but I just can't see it.
<?php session_start(); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Lotus Properties - a Los Angeles Apartment Property Management & Real Estate Company</title>
<?php include_once('includes/functions-nomysql.php'); ?>
</head>
<body>
<h2>Contact Us</h2>
<div id="contactform">
<?php
$add = $_GET['add'];
$confirm = $_GET['confirm'];
if (($add == "1") AND ($confirm == "new"))
{
echo $_POST["contact_captcha"];
echo $_SESSION["session_captchaText"];
if (($_POST["contact_captcha"] == $_SESSION["session_captchaText"]) AND ($_POST["contact_captcha"] != "" ))
{
if ($_SERVER["REQUEST_METHOD"] <> "POST")
{ // check for a true message post
die("You can only reach this page by posting from the html form");
}
}
else
{
$error = "yes";
$message .= ('<span class="red">Please Enter the Confirmation Code</span><br />');
}
if ($error == "yes")
{
?>
<p>Please Make Corrections to the Contact Us Form</p>
<p><?php echo $message; ?></p>
<form action="contact_us2.php?add=1&confirm=new#contact" method="POST">
<p>Please Confirm this Code <br /><img src="http://www.paholo.com/npdev/tests/includes/make_captcha.php" /> <br /><input type="text" name="contact_captcha" value="enter code" size="10" width="220" height="50" /></p>
<p><input type="submit" name="submit" value="Send" /></p>
</form>
<?php
}
else
{
$mailuser = "$contact_email";
$header = "Return-Path: mail@lotusproperties.com\r\n";
$header .= "From: Lotus Properties Contact Us <mail@lotusproperties.com>\r\n";
$header .= "Content-Type: text/html;";
$mail_body = ('Thank you for sending in your Contact Us request to <a href="http://www.lotusproperties.com">Lotus Properties</a>. We will respond to your message as soon as possible. Thank you.');
if (mail ($mailuser, 'Contact Us', $mail_body, $header))
{
echo ('<p>Your Message has been Sent</p>');
}
else
{
echo ('<p>Problem sending message. <a href="contact_us.php">Try again</a></p>');
}
}
}
else
{
?>
<form action="contact_us2.php?add=1&confirm=new#contact" method="post" >
<p>Please Confirm this Code <br /><img src="http://www.paholo.com/npdev/tests/includes/make_captcha.php" /> <br /><input type="text" name="contact_captcha" value="enter code" size="10" width="2开发者_JAVA百科20" height="50" /></p>
<p><input type="submit" name="submit" value="Send" /></p>
</form>
<?php
}
?>
</div><!-- end of contact form -->
</body>
</html>
精彩评论