Location: PHPKode > scripts > ImageVine Image Hosting Script > ImageVine/Script/contact.php
<?php

/*

    File Name: contact.php
	Project: ImageVine
	Author: ScriptVine.com
	Revision: 1a

*/


// include header
include("header.php");

// set page name
$page = "contact";

// set page title
$page_title = "Contact Us";

// reset vars used in script
$is_error = 0;
$is_success = 0;
$message = "";

// attempt to send contact form
if(isset($_POST['task']) && $_POST['task'] == "doSend")
{
    // setup form validation
	$validation->addValidation("email", "req", "Please enter your email address.");
	$validation->addValidation("email", "email", "Please enter a valid email address.");
	$validation->addValidation("name", "req", "Please enter your name.");
	$validation->addValidation("message", "req", "Please enter a message to send.");
	$validation->addValidation("subject", "req", "Please enter a subject");
	
	// run validation
	if(!$validation->ValidateForm())
	{
	    $is_error = 1;
		$message = "<strong>The following errors have occurred:</strong><br />";
		foreach($validation->GetErrors() as $inpname => $inp_err)
		{
		    $message .= "$inp_err<br />";
		} 
	}else
	
	// no errors, send contact form
	if($is_error != 1)
	{
	    // send contact form to site admin
	    send_generic($config['admin_email'],   
		             $_POST['email'], 
					 "New contact form request", 
					 $_POST['subject'] . "\n\n" . $_POST['message'],
					 $search = "",
					 $replace = "");
					 
					 
		// set success
		$is_success = 1;
		$message = "Your message has been successfully sent.";
	}
}

// assign smarty vars
$smarty->assign("is_error", $is_error);
$smarty->assign("is_success", $is_success);
$smarty->assign("message", $message);

// include footer
include("footer.php");

?>
Return current item: ImageVine Image Hosting Script