include/contents/contact.php
<?php
# Copyright by: Manuel Staechele
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
function check_valide_mail($email) {
if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
return false;
}
$email_array = explode("@", $email);
$local_array = explode(".", $email_array[0]);
for ($i = 0; $i < sizeof($local_array); $i++) {
if
(!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&
↪'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$",
$local_array[$i])) {
return false;
}
}
if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) {
$domain_array = explode(".", $email_array[1]);
if (sizeof($domain_array) < 2) {
return false;
}
for ($i = 0; $i < sizeof($domain_array); $i++) {
if
(!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|
↪([A-Za-z0-9]+))$",
$domain_array[$i])) {
return false;
}
}
}
return true;
}
$title = $allgAr['title'].' :: Kontakt';
$hmenu = 'Kontakt';
$design = new design ( $title , $hmenu );
$design->header();
$erg = db_query("SELECT v2,t1,v1 FROM prefix_allg WHERE k = 'kontakt'");
$row = db_fetch_assoc($erg);
$k = explode('#',$row['t1']);
$name = '';
$mail = '';
$subject = '';
$wer = '';
$text = '';
$fehler = '';
### CONFIG
$mailadr = true; // Check Mailaddress //> true = Yes, false = No
if(isset($_POST['submit'])){
if(empty($_POST['name'])){
$fehler .= '• Es wurde kein Name angegeben!<br>';
}
if($_POST['mail'] != ''){
if($mailadr){
$fehler .= ( check_valide_mail($_POST['mail']) == true ? '' : '• Es wurde keine gültige E-Mail Adresse angeben!<br>');
}
}else{
$fehler .= '• Es wurde keine E-Mail-Adresse angegeben!<br>';
}
if(empty($_POST['subject'])){
$fehler .= '• Es wurde kein Betreff eingegeben!<br>';
}
if(empty($_POST['txt'])){
$fehler .= '• Es wurde kein Nachrichtentext eingegeben!<br>';
}
if(chk_antispam ('contact') != true){
$fehler .= '• Der AntiSpam Code war nicht korrekt!<br>';
}
if ($fehler == '' AND !empty($_POST['wer'])) {
$name = $_POST['name'];
$mail = escape_for_email($_POST['mail']);
$betreff = escape_for_email($_POST['subject'], true);
$wer = $_POST['wer'];
$text = strip_tags($_POST['txt']);
$wero = FALSE;
foreach($k as $a) {
$e = explode('|',$a);
if (md5($e[0]) == $wer) {
$wero = TRUE;
$wer = $e[0];
break;
}
}
if (strpos ($text, 'Content-Type:') === FALSE
AND strpos($text, 'MIME-Version:') === FALSE
AND strpos($mail, '@') !== FALSE AND $wero === TRUE
AND strlen($name) <= 30 AND strlen($mail) <= 30
AND strlen($text) <= 5000
AND $mail != $name AND $name != $text AND $text != $mail) {
$subject = "Kontakt über ".$_SERVER['HTTP_HOST'];
$inhalt = $name." hat Ihnen eine Nachricht über ".$_SERVER['HTTP_HOST']." gesendet. \n\n";
$inhalt .= "Betreff: ".$betreff." \n\n";
$text .= " \n\nViele Grüße von \n";
$text .= $name." (".$mail.") ";
$text = $inhalt.$text;
icmail ($wer,$subject,$text, $name." <".$mail.">");
echo 'Ihre Anfrage per Email wurde erfolgreich versendet!';
$name = '';
$mail = '';
$subject = '';
$wer = '';
$text = '';
} else {
$name = $_POST['name'];
$mail = $_POST['mail'];
$subject = $_POST['subject'];
$wer = $_POST['wer'];
$text = $_POST['txt'];
echo $lang['emailcouldnotsend'];
}
} else {
$name = $_POST['name'];
$mail = $_POST['mail'];
$subject = $_POST['subject'];
$wer = $_POST['wer'];
$text = $_POST['txt'];
echo 'Aufgrund folgender Fehler, wurde die Email nicht versendet:<br>'.$fehler;
}
}
$tpl = new tpl ( 'contact.htm' );
$tpl->out(0);
$i = 1;
foreach($k as $a) {
$e = explode('|',$a);
if ($e[0] == '' OR $e[1] == '' ) { continue; }
if ($i == 1) { $c = 'checked'; } else { $c = ''; }
$tpl->set_ar_out( array ('KEY' => md5($e[0]), 'VAL' => $e[1], 'c' => $c) , 1 );
$i++;
}
$tpl->set('name', $name);
$tpl->set('mail', $mail);
$tpl->set('subject', $subject);
$tpl->set('text', $text);
$tpl->set('ANTISPAM', get_antispam('contact',1));
$tpl->out(2);
$design->footer();
?>
contents/templates/contact.htm
<form action="?contact" method="POST">
<table width="100%" border="0" cellspacing="0" cellpadding="3" align="center">
<tr>
<td valign="top" width="50%">Empfänger auswählen:</td>
<td width="50%">{EXPLODE}
<input id="w{KEY}" {c}="" type="radio" name="wer" value="{KEY}" style="float: left; border:0px; background-color:#fff;"><label for="w{KEY}">
{VAL}</label><br style="clear: both;" />
{EXPLODE}</td>
</tr>
<tr><td colspan="2"> </td></tr>
<tr>
<td width="50%">Ihr Name:</td>
<td width="50%">
<input type="text" name="name" value="{name}" style="width: 100%"></td>
</tr>
<tr>
<td width="50%">Ihre E-mail:</td>
<td width="50%">
<input type="text" name="mail" value="{mail}" style="width: 100%"></td>
</tr>
<tr>
<td width="50%">Betreff:</td>
<td width="50%">
<input type="text" name="subject" value="{subject}" style="width: 100%"></td>
</tr>
<tr>
<td width="50%" valign="top">Nachricht:</td>
<td width="50%">
<textarea name="txt" style="width: 100%; overflow:auto;" rows="8">{text}</textarea></td>
</tr>
{ANTISPAM}
<tr>
<td> </td>
<td>
<input name="submit" type="submit" value=" Absenden "></td>
</tr>
</table>
</form>
Zuletzt modifiziert von Lord|Schirmer am 02.02.2011 - 22:35:53