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$
*/
if (!isset($tpl) || !is_object($tpl)) {
$tpl = new Template();
}
else
{
$tpl->reset();
}
if (!isset ($_POST['send'])) {
//Form has not been sent yet
//Create contact form
$sFormAction = $sess->url("front_content.php?idcat=$idcat&idart=$idart&parentid=$parentid");
$tpl->set("s", "NAME", mi18n("Name"));
$tpl->set("s", "EMAIL", mi18n("E-Mail"));
$tpl->set("s", "ABSCHICKEN", mi18n("Abschicken"));
$tpl->set("s", "LOESCHEN", mi18n("Löschen"));
$tpl->generate($cfgClient[$client]["path"]["frontend"]."templates/newsletter.html");
} elseif ($_POST['send'] == 1) {
//Form has been sent
//Check user input
$noerrors = true;
$msg = '';
if ($_POST['Name'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihren Namen ein!")."<br/>";
}
if ($_POST['Name'] == 'Name') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihren Namen ein!")."<br/>";
}
if ($_POST['EMail'] == 'E-Mail') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihre E-Mail Adresse ein!")."<br/>";
}
if ($_POST['EMail'] == '') {
$noerrors = false;
$msg .= mi18n("Bitte geben Sie Ihre E-Mail Adresse ein!")."<br/>";
}
if ($noerrors == false) {
echo "<p>";
//Errors have been found
echo '<strong><div id="headfehlerMSGkf"><img src="http://www.meinedomain.de/cms/images/falseNewsletter.png" />'.mi18n("Beim Versenden sind folgende Fehler aufgetreten:").'</div></strong><br>';
echo '<div class="fehlerMSGkf">'.$msg.'</div><br/>';
echo '<div id="zurueckLink" ><a href="javascript:history.back();">‹ '.mi18n("zurück").'</a></div>';
} else {
#No errors, create and send mail
$mail = new PHPMailer;
$mail_body = '<html><head></head><body bgcolor="#ffffff"><table cellspacing="0" cellpadding="2" border="0">';
if (is_array($_POST)) {
foreach ($_POST as $key => $value) {
if ($key != 'send') {
$mail_body .= "<tr><td>$key</td><td>$value</td></tr>";
}
}
}
$mail_body .= '</table></bo'.'dy></html>';
$mail->Host = "localhost";
$mail->IsHTML(true);
#Get mailer from settings
switch (strtolower("CMS_VALUE[4]")) {
case "smtp" :
$mail->IsSMTP();
$host = "CMS_VALUE[5]";
$user = "CMS_VALUE[6]";
$password = "CMS_VALUE[7]";
if (($host != '') && ($user != '') && ($password != '')) {
$mail->SMTPAuth = true;
$mail->Host = $host;
$mail->Username = $user;
$mail->Password = $password;
}
break;
case "mail" :
$mail->IsMail();
break;
case "sendmail" :
$mail->IsSendmail();
break;
case "qmail" :
$mail->IsQmail();
break;
default :
}
$mail->From = "CMS_VALUE[0]";
$mail->FromName = "CMS_VALUE[2]";
$mail->AddAddress("CMS_VALUE[1]", "");
$mail->Subject = "CMS_VALUE[3]";
$mail->Body = $mail_body;
$mail->WordWrap = 50;
$mail->Send();
//Display message after mail is sent
echo '<div class="meldungKF"><img src="http://www.meinedomain.de/cms/images/rightNewsletter.png" />'.mi18n("Ihr Anliegen wurde uns übermittelt. Vielen Dank!").'</div>'."<br/>";
echo '<div id="zurueckLink" ><a href="javascript:history.back();">‹ '.mi18n("zurück").'</a></div>';
}
}
?>