spam return true; } if($time - $_POST['time'] > 12 * 3600){ // user needed more than 12 hours to fill the form -> spam return true; } // check baits if(!empty($_POST['email'])){ return true; } if(!empty($_POST['url'])){ return true; } return false; } /** prints the contact form * @return string */ //---------------------------------------- function printForm(){ //---------------------------------------- global $errors; $f = new Template(TEMPLATE_DIR."subparts/abo.html"); $f->removeBlock("SUCCESS"); $f->removeBlock("SPAM"); $f->setVar("ACTION", getCurrentUrl()); if(sizeof($errors) > 0){ $e = "FEHLER:"; $f->setVar("ERRORS", $e); } else{ $f->setVar("ERRORS", " "); } if($_POST['gender'] == "Frau"){ $f->setVar("GENDER_F", "selected=\"selected\""); $f->setVar("GENDER_M", ""); } else if($_POST['gender'] == "Herr"){ $f->setVar("GENDER_M", "selected=\"selected\""); $f->setVar("GENDER_F", ""); } else{ $f->setVar("GENDER_M", ""); $f->setVar("GENDER_F", ""); } $f->setVar("FIRSTNAME", $_POST['firstname']); $f->setVar("SURNAME", $_POST['surname']); $f->setVar("STREET", $_POST['street']); $f->setVar("ZIP", $_POST['zip']); $f->setVar("CITY", $_POST['city']); $f->setVar("PHONE", $_POST['phone']); $f->setVar("MAIL", $_POST['mail']); $f->setVar("TIME", time()); return $f->toString(); } /** prints the success view * @return string */ //------------------------------------------ function printSuccess(){ //------------------------------------------ $f = new Template(TEMPLATE_DIR."subparts/abo.html"); $f->removeBlock("FORM"); $f->removeBlock("SPAM"); return $f->toString(); } /** prints the spam view * @return string */ //------------------------------------------ function printSpam(){ //------------------------------------------ $f = new Template(TEMPLATE_DIR."subparts/abo.html"); $f->removeBlock("FORM"); $f->removeBlock("SUCCESS"); return $f->toString(); } /** sends the form data via e-mail */ //------------------------------------------ function sendToOffice(){ //------------------------------------------ $to = "kulturhaus@bruckmuehle.at"; $subject = "Abo-Bestellung"; $from = "FROM: kulturhaus@bruckmuehle.at"; $body .= "Bestellung für des 3er Abo:\n\n"; $body .= "Anrede: $_POST[gender]\n"; $body .= "Vorname: $_POST[firstname]\n"; $body .= "Nachname: $_POST[surname]\n"; $body .= "Straße: $_POST[street]\n"; $body .= "PLZ: $_POST[zip]\n"; $body .= "Ort: $_POST[city]\n"; $body .= "Telefon: $_POST[phone]\n"; $body .= "E-Mail: $_POST[mail]\n"; @mail($to, $subject, utf8_decode($body), $from); @mail("contact@mlenzelbauer.at", "Kopie: $subject", utf8_decode($body), $from); } /** sends the form data via e-mail */ //------------------------------------------ function sendToCustomer(){ //------------------------------------------ if (!empty($_POST['mail'])) { $to = $_POST['mail']; $subject = "Abo-Bestellung Kulturhaus Bruckmühle"; $from = "FROM: kulturhaus@bruckmuehle.at"; if($_POST['gender'] == "Frau"){ $body = "Sehr geehrte Frau " . $_POST['firstname'] . " " . $_POST['surname'] . ", \n\n"; } else if($customer['gender'] == "Herr"){ $body = "Sehr geehrter Herr " . $_POST['firstname'] . " " . $_POST['surname'] . ", \n\n"; } else{ $body = "Sehr geehrte(r) Herr/Frau " . $_POST['surname'] . ", \n\n"; } $body .= "Ihre Ticketbestellung für das 3er Abo 'Starke Frauen in der Bruckmühle' wurde erfolgreich abgeschlossen. "; $body .= "Folgende Tickets wurden für Sie reserviert: \n\n"; $body .= "__________________________________________\n\n"; $body .= "The Rounder Girls - \"Women\"\n07.02.2013 20:00\nKategorie A\n\n"; $body .= "\"FRAUEN AUS DEM HINTERHALT\" SIMPSON, PASCHKE, SCHEITZ\n09.03.2013 20:00\nKategorie A\n\n"; $body .= "DORNROSEN \"Volle Kanne\"\n30.04.2013 20:00\nKategorie A\n\n"; $body .= "__________________________________________\n\n"; $body .= "Gesamtsumme:\tEUR 52,80\n"; $body .= "Die Tickets werden Ihnen innerhalb von zwei Werktagen per Post zugestellt.\n\n"; $body .= "Mit freundlichen Grüßen,\n"; $body .= "Ihr Bruckmühle Team\n\n"; $body .= "__________________________________________\n\n"; $body .= "Kulturhaus Pregarten Bruckmühle\n"; $body .= "Bahnhofstraße 12\n"; $body .= "4230 Pregarten\n"; $body .= "E-mail: kulturhaus@bruckmuehle.at\n"; $body .= "http://www.kulturhaus-bruckmuehle.at\n\n"; $body .= "UID: ATU 49258501\n"; $body .= "FB: FN 190621a\n"; $body .= "DVR: 0550868\n"; $body .= "__________________________________________"; @mail($to, $subject, utf8_decode($body), $from); @mail("contact@mlenzelbauer.at", "Kopie: $subject", utf8_decode($body), $from); } } /** converts the $_POST value to "ja" or "nein" * @param value checkbox value * @return "ja" or "nein" */ //-------------------------------------------- function yesOrNo($value){ //-------------------------------------------- if(isset($value) && !empty($value)){ return "ja"; } return "nein"; } ?>