Output:
Code: Alles auswählen
<?php
/**
* $RCSfile$
*
* Description: Contact Form Output
*
* @version 1.0.0
* @author Andreas Lindner
* @copyright four for business AG <www.4fb.de>
*
* {@internal
* created 2005-08-12
* modified 2008-04-11 Rudi Bieller Changes concerning new layout
* }}
*
* $Id$
*/
#Includes
cInclude("classes", "class.phpmailer.php");
if (!isset($tpl) || !is_object($tpl)) {
$tpl = new Template();
}
if (!isset ($_POST['send'])) {
#Form has not been sent yet
cInclude('classes', 'class.article.php');
cInclude('classes', 'class.template.php');
//------------------------------------------------------------------------------
$zahl1 = rand(1, 20);
$zahl2 = rand(1, 11);
$ergebnis = ($zahl1 + $zahl2);
//------------------------------------------------------------------------------
#Create contact form
$sFormAction = $sess->url("front_content.php?idcat=$idcat&idart=$idart&parentid=$parentid");
$tpl->set("s", 'form_action', $sFormAction);
$tpl->set("s", 'ERGEBNIS', $ergebnis);
// $tpl->set("s", "ANREDE", mi18n("Anrede"));
// $tpl->set("s", "ANREDE_OPTION1", mi18n("Herr"));
// $tpl->set("s", "ANREDE_OPTION2", mi18n("Frau"));
$tpl->set("s", "NAME", mi18n("Name"));
// $tpl->set("s", "VORNAME", mi18n("Vorname"));
$tpl->set("s", "FIRMA", mi18n("Firma"));
// $tpl->set("s", "STRASSE", mi18n("Straße/Nr."));
// $tpl->set("s", "PLZORT", mi18n("PLZ/Ort"));
// $tpl->set("s", "TELEFON", mi18n("Telefon"));
$tpl->set("s", "EMAIL", mi18n("E-Mail"));
$tpl->set("s", "ANLIEGEN", mi18n("Nachricht"));
$tpl->set("s", "SPAMTEXT", "Ergebnis eintragen: ");
$tpl->set("s", 'SPAMSCHUTZ_1', $zahl1);
$tpl->set("s", 'SPAMSCHUTZ_2', $zahl2);
$tpl->set("s", "PFLICHTFELDER", mi18n("Bitte alle Felder ausfüllen"));
$tpl->set("s", "ABSCHICKEN", mi18n("abschicken"));
// $tpl->set("s", "LOESCHEN", mi18n("löschen"));
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/kontaktformular.html");
} elseif ($_POST['send'] == 1) {
#Form has been sent
#Check user input
$noerrors = true;
$msg = '';
$test1 = $_POST['spam'];
$test2 = $_POST['ergebnis'];
if ($_POST['spam'] <> $_POST['ergebnis']) {
$noerrors = false;
$msg .= mi18n("Bitte rechnen Sie richtig!")."<br/>";
}
if ($_POST['Name'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihren Namen ein!")."<br/>";
}
$email = $_POST['EMail'] ;
$name = $_POST['Name'] ;
$subject = $_POST['subject'] ;
if ($_POST['EMail'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihre E-Mail-Adresse ein!")."<br/>";
}
if ($noerrors == false) {
echo "<div id='infobox' class='infobox infored'>";
echo "<img src='http://xxxxxx.de/cms/images/icons/info_attention_red.png'>";
echo "<p>";
#Errors have been found
echo "<strong>".mi18n("Beim Versenden sind folgende Fehler aufgetreten:")."</strong><br/>";
echo $msg.'<br/>';
echo '<a href="javascript:history.back();">‹ '.mi18n("zurück").'</a>';
echo "</div>";
echo "<script language='JavaScript'>document.getElementById('infobox').scrollIntoView(true);</script>";
} else {
#No errors, create and send mail
$mail = new phpmailer;
// $mail_body = '<html><head></head><body bgcolor="#ffffff">';
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if ($key != 'send') {
$mail_body .= "$value\n\n";
}
}
}
// $mail_body .= '</bo'.'dy></html>';
$mail->Host = "localhost";
$mail->IsHTML(true);
#Get mailer from settings
$from="From:".$email."\n";
$from .= "Reply-To: ".$email."\n";
$from .= "X-Mailer: PHP/" . phpversion(). "\n";
$from .= "X-Sender-IP: $REMOTE_ADDR\n";
$from .= "Content-Type: text/html";
mail('xxxx@xxxxxn.de', $subject, $mail_body, $from);
#Display message after mail is sent
echo mi18n("<div id='infobox' class='infobox infogreen'><img src='http://xxxxxxx.de/cms/images/icons/info_checkmark_green.png'><h3>Ihre Anfrage wurde uns übermittelt.</h3>
<p>Vielen Dank! Wir melden uns bald bei Ihnen.")."</p></div>";
echo "<script language='JavaScript'>document.getElementById('infobox').scrollIntoView(true);</script>";
}
}
?>