All pastes #951646 Raw Edit

Something

public text v1 · immutable
·published 2008-03-21 15:48 UTC
rendered paste body
if (isset($_POST["contact"]))
	{
	$name = $_POST["name"];
	$email = $_POST["email"];
	$subject = $_POST["subject"];
	$message = $_POST["message"];
	$errors = array();
	
	if (empty($name))
		{array_push($errors, "<font class='mtu_neg'>".CONTACT_ERR_NAME."</font>");}
	if (empty($email) || !email_validate($email))
		{array_push($errors, "<font class='mtu_neg'>".CONTACT_ERR_EMAIL."</font>");}
	if (empty($subject))
		{array_push($errors, "<font class='mtu_neg'>".CONTACT_ERR_SUBJECT."</font>");}
	if (empty($message))
		{array_push($errors, "<font class='mtu_neg'>".CONTACT_ERR_MESSAGE."</font>");}
	
	if (sizeof($errors) > 0)
		{
		foreach ($errors as $error)
			{
			echo $error;
			}
		}
	else
		{
		$to_email = "xicrow@hotmail.com";
		$to = $to_email["value"];
		$headers = "To: The Receiver <".$to.">\n".
					"From: The Sender <".$email.">\n".
					"MIME-Version: 1.0\n".
					"Content-type: text/html; charset=iso-8859-1";
		
		if (email_bad_strings($to) || email_bad_strings($name) || email_bad_strings($email) || email_bad_strings($subject) || email_bad_strings($message) || email_newlines($to) || email_newlines($name) || email_newlines($email))
			{
			echo "<font class='mtu_neg'>".CONTACT_ERR_SPAM."</font>";
			}
		else
			{
			if (@mail($to, $subject, $message, $headers))
				{
				echo "<font class='mtu_pos'>".CONTACT_ERR_NO_ERRS."</font>";
				}
			else
				{
				echo "<font class='mtu_neg'>".CONTACT_ERR_FAILED."</font>";
				}
			}
		}
	}