query($sql); $rxemail = mysql_result($result, 0, "email"); $rxname = mysql_result($result, 0, "name"); } $mail = "Dear $rxname,\n\n"; $mail .= "A very nice person has just contacted me, here is the info:\n"; $mail .= "Name: $_POST[name]\n"; $mail .= "Email: $_POST[email]\n\n"; $mail .= "Message: $_POST[message]\n\n"; $mail .= "Thanks,\n"; $mail .= "The EUCU Website.\n"; $headers = 'From: website@eucu.org.uk' . "\r\n" . 'Reply-To: website@eucu.org.uk' . "\r\n" . 'X-Mailer: Kahawa: PHP/' . phpversion(); $akismet->setCommentAuthor($_POST['name']); $akismet->setCommentAuthorEmail($_POST['email']); $akismet->setCommentContent($_POST['message']); $akismet->setPermalink('http://www.eucu.org.uk'); if ($akismet->isCommentSpam()) { if (mail("website@eucu.org.uk", "[POSSIBLE SPAM?] EUCU: Contact Form - $_POST[name]", $mail, $headers)) { $msg = "

Thanks! We've forwarded your message to $rxname.

"; $msg .= "

They should get back to you shortly.

"; } else { $msg = "Sorry, something broke. Please try again later or email us directly."; } } else { if (mail("chris@ceejaycee.net, $rxemail", "EUCU: Contact Form - $_POST[name]", $mail, $headers)) { $msg = "

Thanks! We've forwarded your message to $rxname.

"; $msg .= "

They should get back to you shortly.

"; } else { $msg = "Sorry, something broke. Please try again later or email us directly."; } } } else { $selected = "selected"; if (isset($_GET['sendto'])) { $selected = ""; } $sql = "SELECT * FROM contacts ORDER BY id"; $result = $mysql->query($sql); $msg = "

Use the form below to contact EUCU. If you want to contact a specific person, please use the dropdown box to select their name.

"; $msg .= "

If you have any difficulties with this form, please email website@eucu.org.uk directly.

"; $msg .= ""; $msg .= ''; $msg .= ''; $msg .= ''; $msg .= ''; $msg .= ''; $msg .= ''; $msg .= '
To:
Name:
Email:
Message:'; // $msg .= '
What is 40 + 2? (This stops bad spammers!)
 
'; } //////////////////////////////////////////////////////////////////////////////// // define some variables, so that if they are not using we don't get errors $insideSections = array(); $sectionPages = array(); //////////////////////////////////////////////////////////////////////////////// // get the nav bar links $sql = "SELECT * FROM sections WHERE parent = 'ROOT'"; $result = $mysql->query($sql); $navSections = array(); while ($row = mysql_fetch_array($result)) { $navSections[$row['id']]['id'] = $row['id']; $navSections[$row['id']]['name'] = $row['name']; } //////////////////////////////////////////////////////////////////////////////// // Assign contents to variables for the template $smarty->assign('title', "Contact Us"); // This is the page title, as displayed in the title bar $smarty->assign('content', $msg); // This is the page content! $smarty->assign('navSections', $navSections); // This is the links for the navigation bar $smarty->assign('insideSections', $insideSections); // This is for the sub-sections of this section $smarty->assign('sectionPages', $sectionPages); // This is for all the pages which belong to this category //////////////////////////////////////////////////////////////////////////////// $smarty->display('page.tpl'); ?>