include_once($_SERVER["DOCUMENT_ROOT"] . "/scripts/barred.php");
include_once($_SERVER["DOCUMENT_ROOT"] . "/scripts/sendMail.php");
include_once($_SERVER["DOCUMENT_ROOT"] . "/scripts/dbFuncs.php");
if (session_status() == PHP_SESSION_NONE)
{
session_start();
}
reset($_POST);
$expected = $_SESSION['passcode'];
$passcode = $_POST['code'];
$name = formatVar("name");
$email = formatVar("email");
$comments = formatVar("comments");
$reason = "";
$entryOK = true;
$_SESSION['name'] = $name;
$_SESSION['email'] = $email;
$_SESSION['comments'] = $comments;
if (strcmp($expected, $passcode) != 0)
{
$entryOK = false;
$reason .= "
An error occurred. Please try again.";
}
if (!$name)
{
$entryOK = false;
$reason .= "Please enter your name";
}
if (!$email)
{
$entryOK = false;
$reason .= "Please enter your email address";
}
if (!$comments)
{
$entryOK = false;
$reason .= "Please type a message!";
}
if (!$entryOK)
{
$_SESSION['reason'] = $reason;
header("Location: http://" . $_SERVER['HTTP_HOST'] . "/help/contact.php");
return;
}
$recipient = "stephenjsweeney@battleforthesolarsystem.com";
$message = $comments;
$message .= "\n\n";
$message .= "User Agent: $HTTP_USER_AGENT\n";
$message .= "Referer: $HTTP_REFERER\n";
$message .= "Remote Address: $REMOTE_ADDR\n";
session_destroy();
if (!$_POST["emailConfirm"])
{
if (!sendMail($recipient, "General Feedback", $message, "plain", $email))
{
header("HTTP/1.0 500 Internal Server Error");
header("Location: http://" . $_SERVER['HTTP_HOST'] . "/500.php");
return;
}
}
header("Location: http://" . $_SERVER['HTTP_HOST'] . "/help/thanks.php");
?>