I've never seen this one before, hopefully you can help me out here.
I get the following:
- Code: Select all
Warning: Cannot modify header information - headers already sent by (output started at ......../bathroomwriter.com/inc/connnect.php:22) in ......../bathroomwriter.com/inc/mailer.php on line 23
Here's the code for connect.php - the code allowing me to connect to my database.
- Code: Select all
#I took out this bit for security purposes...
////////////// Do not edit below/////////
connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
?>
and here's the code for mailer.php - the contact form that sends to email.
- Code: Select all
<?php
// load the variables form address bar
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verification = $_REQUEST["verification"];
// 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($verification).'a4xn' == $_COOKIE['tntcon']){
// if verification code was correct send the message and show this page
mail("webmaster@bathroomwriter.com", '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', ' ' ); <<<<<This is line 23<<<<<
} else {
// if verification code was incorrect then return to contact page and show error
header("Location:".$_SERVER['HTTP_REFERER']."&wrong_code=true");
exit;
}
?>
<p>Your message has been successfully delivered. <br />
Thank-you.</p>
Any clue as to why this is happening?
It sends the email just fine, but it doesn't reset the cookie, which allows the user to refresh the page as much as they like and resending the email while they do it.
Thanks in advance



