query($sql), 0, "title"); $sql = sprintf("INSERT INTO eucu_event_data (day, time, eventId, name, email, mobile) VALUES ('%s', '%s', '%s', '%s', '%s', '%s')", makeSafe($_POST['day']), makeSafe($_POST['time']), makeSafe($_POST['eventId']), makeSafe($_POST['name']), makeSafe($_POST['email']), makeSafe( $_POST['mobile']) ); $result = $mysql->query($sql); if ($result) { $msg = "
Thanks. You have been signed up. We'll be in touch nearer the time to give you info on how to help!
"; $msg .= ''; $mail = "Dear Freshers week person\n\n"; $mail .= "A very nice person has signed up to help during Fresher's Week, here is the info:\n"; $mail .= "Name: $_POST[name]\n"; $mail .= "Email: $_POST[email]\n"; $mail .= "Mobile: $_POST[mobile]\n"; $mail .= "Event: $the_event_name\n"; if ($_POST['time'] != "") $mail .= "Time: $_POST[time]\n"; if ($_POST['day'] != "") $mail .= "Day: $_POST[day]\n\n"; $mail .= "Thanks,\n"; $mail .= "The EUCU Website.\n"; $headers = 'From: chris@ceejaycee.net' . "\r\n" . 'Reply-To: chris@ceejaycee.net' . "\r\n" . 'X-Mailer: Kahawa: PHP/' . phpversion(); mail("chris@ceejaycee.net, L.A.Jackson@sms.ed.ac.uk", "EUCU: Event Helper Signup - $_POST[name]", $mail, $headers); } else { $msg = "Sorry, something broke. Please try again later or email us directly."; } //////////////////////////////////////////////////////////////////////////////// // 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', "Event Signup"); // 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'); } else { // can't find any info header("Location: index.php"); } ?>