sql_query("select * from text where id='contact'"); $text = $db->fetched_array(); $smarty->assign("text",$text[0]); $db->sql_query("select * from text where id='captcha'"); $text2 = $db->fetched_array(); $smarty->assign("text2",$text2[0]); $db->sql_query("select * from banners where sid='contact' order by position"); $slides = $db->fetched_array(); $smarty->assign("slides",$slides); $db->sql_query("select * from cats order by position"); $cats = $db->fetched_array(); $smarty->assign("cats",$cats); if(isset($_POST['name']) and isset($_POST['message']) and isset($_POST['postal']) and isset($_POST['email']) and isset($_POST['phone'])) { if($_POST['secretNumber']!=$_SESSION['key']) { $smarty->assign("name",$_POST['name']); $smarty->assign("email",$_POST['email']); $smarty->assign("phone",$_POST['phone']); $smarty->assign("postal",$_POST['postal']); $smarty->assign("body",$_POST['message']); $smarty->assign("err","Wrong number!"); } else { $db->sql_query("select * from vars where id='admin_email'"); $email = $db->fetch_item("value"); $to_email=$email; $subject = "Contact Form Submission from ".S_PROJECT_NAME; $from_name = S_PROJECT_NAME; $from_email = S_EMAIL; $to_name = "Website administrator"; $headers = "From: $from_name<$from_email>\n"; $headers .= "Reply-To: <$from_email>\n"; $headers .= "MIME-Version: 1.0\n"; $message = "Contact form has been submited by ".$_POST['name'].", ".$_POST['email']."\n\n\n"; $message .= "Name: ".$_POST['name']."\n"; $message .= "Phone: ".$_POST['phone']."\n"; $message .= "Postal code: ".$_POST['postal']."\n"; $message .= "E-Mail: ".$_POST['email']."\n"; $message .= "Comments: ".$_POST['message']."\n"; mail("$to_name<$to_email>", $subject, $message, $headers); $displaymessage=""; $smarty->assign("message",$displaymessage); } } $smarty->display("contact.html"); ?>