Hi,
I'm adding a simple security code validation code to a couple of forms on my website because the spam has been insanely high through them lately.
I found a script and tested it on the server and it had worked great. Then when I try to incorporate it into the layout I keep getting this error:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/xxx/public_html/test/form_processor_reorder.php:5) in /home/xxx/public_html/test/audit.php on line 3
I checked line 5 and I didn't see a thing. There's a file included at line 5, but within it there's nothing for sessions or php for that matter. It's all css and javscript in there.
Wierd thing is. It still runs the if and else statement and if the verification was good it sends the email, if not it doesn't send. Just like I want, but for some reason it outputs that error.
Anyways here's the page I'm getting the error on:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>reorder</title>
<?php include("includes.php"); ?>
</head>
<body>
<a name="top"></a>
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="100%">
<tr>
<td width="100%" height="100%" align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="700" height="172">
<tr>
<td width="700" height="172" align="center" valign="top">
<img src="files/images/layout/top_reorder.jpg" border="0" width="700" height="172"><br>
</td>
</tr>
</table>
<?php include("menu.php"); ?>
<table border="0" cellpadding="0" cellspacing="0" width="700" height="385" bgcolor="#ffffff">
<tr>
<td width="700" height="385" align="center" valign="top">
<table border="0" cellpadding="0" cellspacing="0" width="700" height="385">
<tr height="4">
<td colspan="5"></td>
</tr>
<tr>
<td width="4"></td>
<td width="416" align="left" valign="top">
<img src="files/images/layout/titlebar_reorder.jpg" border="0" width="416" height="14"><br>
<br>
<font class="bluebold">Reorder.</font><br>
<?
include ("audit.php");
if (audit()) {
$today = date("M d, Y");
$recipient = "xxx@xxx.com";
$subject = "Reorder Form Submission";
$D1 = $_REQUEST['01'];
$C1 = $_REQUEST['02'];
$S1 = $_REQUEST['03'];
$P1 = $_REQUEST['04'];
$E1 = $_REQUEST['05'];
$Q1 = $_REQUEST['06'];
$P2 = $_REQUEST['07'];
$P3 = $_REQUEST['08'];
$E2 = $_REQUEST['09'];
$R1 = $_REQUEST['10'];
$C2 = $_REQUEST['11'];
$P4 = $_REQUEST['12'];
$S2 = $_REQUEST['13'];
$F1 = $_REQUEST['14'];
$A1 = $_REQUEST['15'];
$forminfo =
"Date: $D1\n
Company Name: $C1\n
Submitters Name: $S1\n
Phone Number: $P1\n
Email Address: $E1\n
Quantity: $Q1\n
Previous Rite Number: $P2\n
Previous PO Number: $P3\n
Exact Repeat: $E2\n
Revised Repeat: $R1\n
Change: $C2\n
Proof Required: $P4\n
Schedule Needed: $S2\n
FOB: $F1\n
Additional Comments: $A1\n
Form Submitted: $today\n\n";
// $formsend = mail("$recipient", "$subject", "$forminfo");
$headers = "From: $E1\r\n";
$headers .= "Reply-to: $E1\r\n";
mail("$recipient", "$subject", "$forminfo", $headers);
echo "<font class=\"blkreg\">Thank you. You have successfully submitted the following information...<br></font>";
echo nl2br($forminfo);
} else {
echo "<font class=\"blkreg\">Incorrect security code. Please try again.<br></font>";
}
?>
<br>
</font>
</td>
<td width="4"></td>
<td width="272" align="left" valign="top" background="files/images/layout/sidebar_dots.jpg"></td>
<td width="4"></td>
</tr>
<tr height="4">
<td colspan="5"></td>
</tr>
</table>
</td>
</tr>
</table>
<?php include("footer.php"); ?>
</td>
</tr>
</table>
</body>
</html>
Here's the code of audit.php:
<?php
function audit() {
session_start();
$digit = $_SESSION['digit'];
$userdigit = $_POST['userdigit'];
session_destroy();
if (($digit == $userdigit) && ($digit > 1)) {
return true;
} else {
return false;
}
}
?>
I've tried a lot of things and found nothing so if someone could please send me in the right direction one way or another I would greatly appreciate it. Thanks in advance!