WARNUNG!
Das Kontaktformular ist noch ungesichert, bitte sichern sie es gegen unbefugte Zugriffe ab oder wenden sie sich an ihren Administrator!
'."\n");
}
$viewmode='include';
include_once('condb_view.php');
$mk_entry_arr1 = array( 'hidden' => ';name;value;job',
'text' => ';id_sel;;;name;value;pF;error_msg;mail_tag;job;;;',
'textarea' => ';id_sel;;;name;value;pF;error_msg;mail_tag;;;',
'checkbox' => ';id_sel;;;name;value;pF;error_msg;mail_tag;mk_pF;;;',
'radio' => ';id_sel;;;name;value;pF;error_msg;mail_tag;mk_pF;;;',
'select' => ';id_sel;;;name;value;pF;error_msg;mail_tag;;;');
$mk_entry_arr2 = array( 'id_sel', 'name', 'value', 'mk_pF', 'pF', 'job', 'error_msg');
$reload=true;
//buttons:
for ($mf_array = 0; $mf_array < count($global_contact_db); $mf_array++) {
//abfragen wie die namen und werte der buttons lauten
if ($global_contact_db[$mf_array][0] == 'submit') {
if ($global_contact_db[$mf_array][3] == 'submit') {
$mf_sub_name = $global_contact_db[$mf_array][4];
$mf_sub_name = $_REQUEST[$mf_sub_name];
$mf_sub_value = $global_contact_db[$mf_array][5];
}
}
if ($global_contact_db[$mf_array][0] == 'submit-img') {
if ($global_contact_db[$mf_array][3] == 'submit') {
$mf_sub_name = $global_contact_db[$mf_array][5];
if (!empty($_REQUEST[$global_contact_db[$mf_array][4]])) {
$mf_sub_value = $global_contact_db[$mf_array][5];
}
}
}
//stell die vorherigen eingabewerte wieder her
$mk_temp = $global_contact_db[$mf_array];
$mk_temp2 = explode(';',$mk_entry_arr1[$global_contact_db[$mf_array][0]]);
for ($mk_entry_temp=1; $mk_entry_temp < count($mk_temp)-1; $mk_entry_temp++) {
for ($mk_entry_t2=0; $mk_entry_t2 < 7; $mk_entry_t2++) {
if (($mk_entry_arr2[$mk_entry_t2] == $mk_temp2[$mk_entry_temp]) && ($mk_temp2[$mk_entry_temp] != 'value')) {
//stell die vorherigen eingabewerte wieder her
if ($mk_temp2[$mk_entry_temp] == 'name' && ($global_contact_db[$mf_array][0] != 'radio' ) && ($global_contact_db[$mf_array][0] != 'checkbox' )){
$reload_value = $mk_temp[$mk_entry_temp];
$global_contact_db[$mf_array][$mk_entry_temp+1]=htmlentities($_REQUEST[$mk_temp[$mk_entry_temp]]);
}
//schau nach ob einige felder andere zu Pflichtfeldern machen
if ( !empty($mk_temp[$mk_entry_temp]) &&($mk_temp2[$mk_entry_temp] == 'mk_pF') && !empty($_REQUEST[$global_contact_db[$mf_array][4]])){
$mf_temp_pF[$mk_entry_temp]=$mk_temp[$mk_entry_temp];
}
/// alt & defekt:
//if (($global_contact_db[$mf_array][5] == 'on') && ($mk_temp2[$mk_entry_temp] == 'mk_pF')) {
// if(!empty($mk_temp[$mk_entry_temp])){
// //$mf_temp_pF[$mk_entry_temp]=$mk_temp[$mk_entry_temp];
// }
//}
}
}
}
if ($global_contact_db[$mf_array][0] == 'select') {
if (!empty($global_contact_db[$mf_array][5])) {
for ($mk_option_sel=1; $global_contact_db[$mf_array+$mk_option_sel][0] == 'option' ; $mk_option_sel++) {
if ( $global_contact_db[$mf_array+$mk_option_sel][1] == $global_contact_db[$mf_array][5] ) {
$global_contact_db[$mf_array+$mk_option_sel][2] = 'true';
}
else {
$global_contact_db[$mf_array+$mk_option_sel][2] = 'false';
}
}
}
}
}
/* * * * * * * * * * *
* Kontrolle *
* der Vollständigkeit*
* der Angaben *
* * * * * * * * * * */
for ($mf_array = 0; $mf_array < count($global_contact_db); $mf_array++) {
$mk_temp = $global_contact_db[$mf_array];
$mk_temp2 = explode(";",$mk_entry_arr1[$global_contact_db[$mf_array][0]]);
if (!empty($mf_temp_pF)) { // wenn nicht leer, dann ueberschreibe....
$mf_temp_pF = explode(';',implode(';',$mf_temp_pF));
for ($mk_cpF = 0; $mk_cpF < count($mf_temp_pF); $mk_cpF++) {
if ($global_contact_db[$mf_array][1] == $mf_temp_pF[$mk_cpF]) {
$global_contact_db[$mf_array][6] = 'true'; // fuer bearbeitung
$mailsend_is_enable[$mf_array] = $mf_array;
$mk_temp[6] = 'true'; // fuer ansicht
}
}
}
for ($mk_entry_temp=1; $mk_entry_temp < count($mk_temp)-1; $mk_entry_temp++) {
for ($mk_entry_t2=0; $mk_entry_t2 < 7; $mk_entry_t2++) {
if (($mk_entry_arr2[$mk_entry_t2] == $mk_temp2[$mk_entry_temp]) && ($mk_temp2[$mk_entry_temp] != 'value')) {
if (($mk_temp2[$mk_entry_temp] == 'pF') && ($global_contact_db[$mf_array][6] == 'true')) {
if (($mf_sub_name == $mf_sub_value) && ($global_contact_db[$mf_array][0] == 'radio') or ($global_contact_db[$mf_array][0] == 'checkbox') && ($mf_sub_name == $mf_sub_value)) {
if (empty($_REQUEST[$global_contact_db[$mf_array][4]])) {
$alt_elements[] = $global_contact_db[$mf_array][1];
}
}
if (($mf_sub_name == $mf_sub_value) && empty($global_contact_db[$mf_array][5])) {
$alt_elements[] = $global_contact_db[$mf_array][1];
}
}
if (($mk_temp2[$mk_entry_temp] == 'job')) {
switch ($global_contact_db[$mf_array][0]) {
case 'hidden':
break;
case 'text':
if ($global_contact_db[$mf_array][9] == 'captcha') {
if (($mf_sub_name == $mf_sub_value) && !check_captcha($global_contact_db[$mf_array][5] )) {
$alt_elements[] = $global_contact_db[$mf_array][1];
$global_contact_db[$mf_array][5]='';
}
}
if ($global_contact_db[$mf_array][9] == 'e-mail') {
if (($mf_sub_name == $mf_sub_value) && !empty($global_contact_db[$mf_array][5]) && $global_contact_db[$mf_array][6] == 'true' && !testmail($global_contact_db[$mf_array][5])) {
$alt_elements[] = $global_contact_db[$mf_array][1];
$global_contact_db[$mf_array][5]=''; // hier koennte antatt Leerstring auch 'ungültige Mailaddresse' stehen
}
else {
$mailsend_conf['sender'] = $global_contact_db[$mf_array][5];
$mailsend_conf['case'][1] = $global_contact_db[$mf_array][6];
if (!empty($mailsend_is_enable[$mf_array]) && $mailsend_is_enable[$mf_array] == $mf_array) {
$mailsend_conf['case'][2] = 'true';
}
else {
$mailsend_conf['case'][2] = 'false';
}
}
}
if ($global_contact_db[$mf_array][9] == 'subject') {
$mailsend_conf['subject'] = $global_contact_db[$mf_array][5];
if (!empty($global_contact_db[count($global_contact_db)-1][2])) {
$mailsend_conf['subject'] = $global_contact_db[count($global_contact_db)-1][2].' '.$mailsend_conf['subject'];
}
}
break;
}
}
}
}
}
}
/* * * * * * * * * *
* Error-Message *
* * * * * * * * * */
for ($mf_error_array = 0; $mf_error_array < count($alt_elements); $mf_error_array++) {
$mk_imp_error = implode ( ';', $alt_elements);
$mk_imp_error = explode ( ';', $mk_imp_error);
$mk_error_id = $mk_imp_error[$mf_error_array];
}
for ($mf_array = 0; $mf_array < count($global_contact_db); $mf_array++) {
if ($global_contact_db[$mf_array][1] == $mk_error_id) {
if (empty($mk_error_msg)) {
$mk_error_msg = $global_contact_db[$mf_array][7];
}
}
}
if (($mf_sub_name != $mf_sub_value) || !empty($alt_elements)) {
if (!isset($mk_error_msg)) {
$mk_error_msg='';
}
mkform($global_contact_db, $alt_elements, $mk_error_msg);
}
else {
if(!isset($mailsend_conf['subject']) || empty($mailsend_conf['subject'])) {
if (!empty($global_contact_db[count($global_contact_db)-1][2])) {
$mailsend_conf['subject'] = $global_contact_db[count($global_contact_db)-1][2];
}
else {
$mailsend_conf['subject'] = 'Anfrage im Kontaktformular';
}
}
if(!empty($global_contact_db[count($global_contact_db)-1][3])) {
$mailsend_conf['origin'] = $global_contact_db[count($global_contact_db)-1][3];
if(!empty($global_contact_db[count($global_contact_db)-1][4])) {
$mailsend_conf['origin'] = $global_contact_db[count($global_contact_db)-1][4].' <'.$mailsend_conf['origin'].'>';
}
}
else {
$mailsend_conf['origin'] = '';
}
if(!empty($global_contact_db[count($global_contact_db)-1][5])) {
$mailsend_conf['to'] = $global_contact_db[count($global_contact_db)-1][5];
}
else {
$mailsend_conf['to'] = '';
}
switch($global_contact_db[count($global_contact_db)-1][1]) {
case 'true':
// mail wird auf jeden fall verschickt
break;
case 'false':
$mailsend_conf['sender']='';
break;
case 'if_enabled':
if ($mailsend_conf['case'][2] != 'true') {
$mailsend_conf['sender']=''; // wenn feld nicht durch eine checkbox zum pflichtfeld wurde, dann wird keine mail verschickt
}
break;
}
// eingegebene werte auslesen:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* "text" => ";id_sel;;;name;value;pF;error_msg;mail_tag;job;;;", *
* "textarea" => ";id_sel;;;name;value;pF;error_msg;mail_tag;;;", *
* "checkbox" => ";id_sel;;;name;value;pF;error_msg;mail_tag;mk_pF;;;", *
* "radio" => ";id_sel;;;name;value;pF;error_msg;mail_tag;mk_pF;;;", *
* "select" => ";id_sel;;;name;value;pF;error_msg;mail_tag;;;"); *
* 01------234----5-----6--7---------8--------9ab *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$mail_index=0;
$mailsend_conf['msg'] = '';
for ($mf_array = 1; $mf_array < count($global_contact_db)-1; $mf_array++) {
switch ($global_contact_db[$mf_array][0]) {
case 'textarea':
if (!empty($global_contact_db[$mf_array][5]) && !empty($global_contact_db[$mf_array][8])) {
$mailsend_index[$mail_index] = $global_contact_db[$mf_array][8];
$mailsend_value[$mail_index] = wordwrap($global_contact_db[$mf_array][5], 60);
$mailsend_conf['msg'] .= "\n".'
'.$mailsend_index[$mail_index].'';
$mailsend_conf['msg'] .= "\n".'
'.$mailsend_value[$mail_index].'
';
$mail_index++;
}
break;
case 'checkbox': case 'radio':
if (!empty($global_contact_db[$mf_array][5]) && !empty($global_contact_db[$mf_array][8]) && !empty($_REQUEST[$global_contact_db[$mf_array][4]]) && $_REQUEST[$global_contact_db[$mf_array][4]] == $global_contact_db[$mf_array][5]) {
$mailsend_index[$mail_index] = $global_contact_db[$mf_array][8];
$mailsend_value[$mail_index] = $_REQUEST[$global_contact_db[$mf_array][4]];
$mailsend_conf['msg'] .= "\n".'
'.$mailsend_index[$mail_index].' '.$mailsend_value[$mail_index].'';
}
break;
case 'text':
case 'select':
if (!empty($global_contact_db[$mf_array][5]) && !empty($global_contact_db[$mf_array][8])) {
$mailsend_index[$mail_index] = $global_contact_db[$mf_array][8];
$mailsend_value[$mail_index] = $global_contact_db[$mf_array][5];
$mailsend_conf['msg'] .= "\n".'
'.$mailsend_index[$mail_index].' '.$mailsend_value[$mail_index].'';
}
break;
}
}
////$mailsend_conf['msg'] = trim(mb_convert_encoding (@$mailsend_conf['msg'] , 'UTF-8', 'ISO-8859-1'));
//echo "Jetzt sollte die mail versendet werden...";
if (sendmail($mailsend_conf))
{
$t = (int)abs(time() - 90000); @setcookie('reference',NULL,$t); @setcookie('attach',NULL,$t);
include('mail_success_text.html');
print("\n".''.nl2br(trim($mailsend_conf['msg'])).'
');
}
}
$GLOBALS['mk_contact_html'] = trim(@ob_get_contents()); @ob_end_clean();
}
/* * * * * * * * * * * *
* Captcha - Check *
* * * * * * * * * * * */
function check_captcha($mf_value)
{
//////print('L'.__LINE__.':mf_value='.htmlentities(serialize(@$mf_value)).'
');//DEBUG
$thestring1 = trim(@strval($mf_value)); //ADDON201107
$vergleichswert = strtolower(md5(trim((int)floor(date('i')/30)).strtoupper(trim($thestring1)))); //ADDON201107
return(@$_COOKIE['reference'] == $vergleichswert); //ADDON201107
//if (strtoupper($mf_value) == $_SESSION['key']) {
// session_unset();
// session_destroy();
// $_SESSION = array();
// return true;
//}
//else {
// session_unset();
// session_destroy();
// $_SESSION = array();
// return false;
//}
}
/* * * * * * * * * * *
* Kontrollfunktion *
* für die Gültigkeit *
* von Mailadressen *
* * * * * * * * * * */
function testmail($mail,$type = "A")
{
$mail = str_replace(" ","",$mail);
if (!preg_match('/^([a-z0-9_]|\-|\.)+@(([a-z0-9_]|\-)+\.)+[a-z]{2,6}$/', strtolower($mail))) {
return false;
}
list($userName, $mailDomain) = split("@", $mail);
if ($mailDomain == "" OR $userName == "") {
return false;
}
//unzulässige Zeichen Anfang und Ende herausfiltern:
if ($userName[0] == "." OR $userName[strlen($userName)-1] == ".") {
return false;
}
if ($userName[0] == "_" OR $userName[strlen($userName)-1] == "_") {
return false;
}
//unzulässige Zeichendopplungen herausfiltern:
for ($i= 0; $i < strlen($userName)-1; $i++ )
{
if ($userName[$i] == "." AND $userName[$i+1] == ".") {
return false;
}
if ($userName[$i] == "_" AND $userName[$i+1] == "_") {
return false;
}
}
//dns abfrage ob Server existiert:
if (checkdnsrr($mailDomain)) {
return true;
}
else {
return false;
}
}
/* * * * * *
* Sendmail *
* * * * * */
function sendmail($mailsend_conf='')
{
$mailsend_conf['subject'] = html_entity_decode($mailsend_conf['subject']);
$mailsend_conf['subject'] = str_replace( 'ä', 'ae', $mailsend_conf['subject']);
$mailsend_conf['subject'] = str_replace( 'ö', 'oe', $mailsend_conf['subject']);
$mailsend_conf['subject'] = str_replace( 'ü', 'ue', $mailsend_conf['subject']);
$mailsend_conf['subject'] = str_replace( 'Ä', 'Ae', $mailsend_conf['subject']);
$mailsend_conf['subject'] = str_replace( 'Ö', 'Oe', $mailsend_conf['subject']);
$mailsend_conf['subject'] = str_replace( 'Ü', 'Ue', $mailsend_conf['subject']);
$mailsend_conf['subject'] = str_replace( 'ß', 'ss', $mailsend_conf['subject']);
$mailsend_conf['msg'] = str_replace('', '', $mailsend_conf['msg']);
$mailsend_conf['msg'] = str_replace('', '', $mailsend_conf['msg']);
$mailsend_conf['msg'] = str_replace('', '', $mailsend_conf['msg']);
$mailsend_conf['msg'] = str_replace('
', "\n", $mailsend_conf['msg']);
$mailsend_conf['msg'] = html_entity_decode($mailsend_conf['msg']);
$encoding = @mb_detect_encoding($mailsend_conf['msg'] , 'UTF-8,ISO-8859-1', true);
if(false === $encoding) { $encoding = mb_detect_encoding($mailsend_conf['msg']); }
if ($encoding == 'ISO-8859-1'){
//# Konvertiere ISO-8859-1 nach UTF-8
$mailsend_conf['msg'] = mb_convert_encoding ($mailsend_conf['msg'] , 'UTF-8', 'ISO-8859-1');
}
else {
if ($encoding == 'UTF-8'){
//# Encoding OK - Nichts tun
}
else {
$mailsend_conf['msg'] = mb_convert_encoding ($mailsend_conf['msg'] , 'UTF-8', 'ISO-8859-1');
}
}
if ( $charset_trigger != 'utf-8') {
$mailsend_conf['msg'] = utf8_decode($mailsend_conf['msg']);
}
$nl = "\r\n";
$subject = my_mailsecurity($mailsend_conf['subject']).my_mailsecurity(', '.date('j.n.Y H:i').' Uhr');
$contenttype4text = 'Content-type: text/plain; charset=utf-8';
$pmeta = '/[^a-zA-Z0-9]/';
$contentid = trim(preg_replace($pmeta,'',trim(@strval($contentid_inp)))); if(empty($contentid)) { $contentid = trim(preg_replace('/[^a-z0-9]/','',strtolower(uniqid('attachpart'.trim(date('YmdHis')).'id')))); } $GLOBALS['attachcontentid'] = $contentid;
$mail_header = 'From: '.my_mailsecurity($mailsend_conf['origin']);
$dummy = my_mailsecurity($mailsend_conf['sender']); if(!empty($dummy)) { $mail_header .= $nl.'Reply-To: '.$dummy; }
$mail_header .= $nl.'MIME-Version: 1.0';
$mail_header .= $nl.'Content-Transfer-Encoding: 8bit';
$kmail_head = trim($mail_header);
if (!empty($mailsend_conf) && !empty($mailsend_conf['sender']))
{
mail(my_mailsecurity($mailsend_conf['sender']), $subject, $mailsend_conf['msg'], $kmail_head.$nl.trim($contenttype4text));
}
if (!empty($mailsend_conf) && !empty($mailsend_conf['to']))
{
$kmail_ip = trim(@strval(@$_SERVER['REMOTE_ADDR']));
$kmail_ip_host = trim(empty($kmail_ip) ? '' : @gethostbyaddr($kmail_ip));
$kmail_ua = trim(@strval(@$_SERVER['HTTP_USER_AGENT']));
$mail_info = (string)(trim($mailsend_conf["msg"])."\n\n".str_replace("\n\n","\n",trim(rtrim('IP-Adresse: '.$kmail_ip.' '.$kmail_ip_host).strval(empty($kmail_ua)?'':"\n".'Browser: '.$kmail_ua))));
$originalnameamsurferpc = trim(strval(@$GLOBALS['uploadsurferfileoriginalname']));
$mail_info .= rtrim(empty($originalnameamsurferpc)?'':' '."\n\n".'Dateiname am PC des Formularbenutzers: '.@$GLOBALS['uploadsurferfileoriginalname']."\n");
$special = ''; if(function_exists('my_file2special'))
{
if(true) //if(isset($GLOBALS['uploadinfo']) && is_array($GLOBALS['uploadinfo']))
{
$special = my_file2special($contentid,trim($mail_info)
, @$GLOBALS['uploadinfo']['movedfile']
, @$GLOBALS['uploadinfo']['surferupload']['name']
);
}
}
$hr = $nl.'--'.trim($contentid).$nl;
if(!empty($special))
{
$kmail_head = (string)(trim($kmail_head).$nl.trim('Content-Type: multipart/mixed; boundary='.$contentid)
.$hr.trim($special)
);
$mail_info = NULL;
}
// print(htmlentities('L'.__LINE__).':kmail_head:'.nl2br(htmlentities(@$kmail_head)).'
');//DEBUG
mail(my_mailsecurity($mailsend_conf['to']), $subject, $mail_info, $kmail_head);
return true;
}
else {
return false;
}
}
/* * * *
* Main *
* * * */
} ?>