<?php
session_start();
error_reporting(E_ERROR | E_PARSE);
date_default_timezone_set('Europe/Berlin');
require_once("captcha/AntiSpam.php");
$q = AntiSpam::getRandomQuestion();
header('Content-type: text/html; charset=utf-8');


#########################################################################
#	Kontaktformular.com         					                                #
#	http://www.kontaktformular.com        						                    #
#	All rights by KnotheMedia.de                                    			#
#-----------------------------------------------------------------------#
#	I-Net: http://www.knothemedia.de                            					#
#########################################################################
// Do NOT remove the copyright notice!


  $script_root = substr(__FILE__, 0,
                        strrpos(__FILE__,
                                DIRECTORY_SEPARATOR)
                       ).DIRECTORY_SEPARATOR;

$remote = getenv("REMOTE_ADDR");

function encrypt($string, $key) {
	$result = '';
	for($i=0; $i<strlen($string); $i++) {
	   $char = substr($string, $i, 1);
	   $keychar = substr($key, ($i % strlen($key))-1, 1);
	   $char = chr(ord($char)+ord($keychar));
	   $result.=$char;
	}
	return base64_encode($result);
}


@require('config.php');
require_once("captcha/AntiSpam.php");
include("PHPMailer/Secureimage.php");
include 'rate_limiting/rate_limiting.php';


// form-data should be deleted
if (isset($_POST['delete']) && $_POST['delete']){
	unset($_POST);
}

$success = false;

$formMessage = '';
$buttonClass = '';



// form has been sent
$isFormSubmit = mb_strtoupper($_SERVER['REQUEST_METHOD']) === 'POST';
if ($isFormSubmit) {



	// clean data
	$first_name   	= stripslashes($_POST["first_name"]);
	$name      	= stripslashes($_POST["name"]);
	$telephone		= stripslashes($_POST["telephone"]);
	$email      = stripslashes($_POST["email"]);
	$subject   	= stripslashes($_POST["subject"]);
	$message  = stripslashes($_POST["message"]);
	$str  = stripslashes($_POST["str"]);
	$str2  = stripslashes($_POST["str2"]);
  $postal_zip_code  = stripslashes($_POST["postal_zip_code"]);
  $city  = stripslashes($_POST["city"]);
  $region  = stripslashes($_POST["region"]);
  $country  = stripslashes($_POST["country"]);

	if($cfg['Data_privacy_policy']) { $data_protection = stripslashes($_POST["data_protection"]); }
	if($cfg['Security_code']){
		$sicherheits_eingabe = encrypt($_POST["sicherheitscode"], "8h384ls94");
		$sicherheits_eingabe = str_replace("=", "", $sicherheits_eingabe);
	}

	$date = date("d.m.Y | H:i");
	$ip = $_SERVER['REMOTE_ADDR'];
	$UserAgent = $_SERVER["HTTP_USER_AGENT"];
	$host = getHostByAddr($remote);


	// formcheck	
	if(!$first_name) {
		$fehler['first_name'] = "<span class='errormsg'>Please enter your <strong>first name</strong>.</span>";
	}
	
	if(!$name) {
		$fehler['name'] = "<span class='errormsg'>Please enter your <strong>last name</strong>.</span>";
	}
	
	if (!preg_match("/^[0-9a-zA-ZÄÜÖ_.-]+@[0-9a-z.-]+\.[a-z]{2,6}$/", $email)) {
		$fehler['email'] = "<span class='errormsg'>Please enter your <strong>email address</strong>.</span>";
	}
	
	if(!$subject) {
		$fehler['subject'] = "<span class='errormsg'>Please enter your <strong>subject</strong>.</span>";
	}
	
	if(!$message) {
		$fehler['message'] = "<span class='errormsg'>Please enter your <strong>message</strong>.</span>";
	}
	
	
	
	// -------------------- SPAMPROTECTION ERROR MESSAGES START ----------------------
	if($cfg['Security_code'] && $sicherheits_eingabe != $_SESSION['captcha_spam']){
		unset($_SESSION['captcha_spam']);
		$fehler['captcha'] = "<span class='errormsg'>The <strong>security code</strong> was wrong.</span>";
	} 
		
  if($cfg["Security_question"]){
	$answer = AntiSpam::getAnswerById(intval($_POST["q_id"]));
	if(isset($_POST["q"]) && $_POST["q"] != $answer){
		$fehler['q_id12'] = "<span class='errormsg'>Please answer the <strong>security question</strong> correctly.</span>";
	}
  }

	if($cfg['Honeypot'] && (!isset($_POST["mail"]) || ''!=$_POST["mail"])){
		$fehler['Honeypot'] = "<span class='errormsg-spamprotection' style='display: block;'>Spam suspected. Please check your entries.</span>";
	}
	
	if($cfg['Time-out'] && (!isset($_POST["chkspmtm"]) || ''==$_POST["chkspmtm"] || '0'==$_POST["chkspmtm"] || (time() - (int) $_POST["chkspmtm"]) < (int) $cfg['Time-out'])){
		$fehler['Time-out'] = "<span class='errormsg-spamprotection' style='display: block;'>Please wait a few seconds before submitting the form again.</span>";
	}
	
	if($cfg['Click_check'] && (!isset($_POST["chkspmkc"]) || 'chkspmhm'!=$_POST["chkspmkc"])){
		$fehler['Click_check'] = "<span class='errormsg-spamprotection' style='display: block;'>Click the send button with the mouse to send the form.</span>";
	}
	
	if($cfg['Links'] < preg_match_all('#http(s?)\:\/\/#is', $message, $irrelevantMatches)){
		$fehler['Links'] = "<span class='errormsg-spamprotection' style='display: block;'>Your message may ".(0==$cfg['Links'] ? 
																																'not contain any links ' : 
																																(1==$cfg['Links'] ? 
																																	'only one link' : 
																																	'a maximum of '.$cfg['Links'].' Links'
																																)
																															).".</span>";
	}
	
	if(''!=$cfg['Badwordfilter'] && 0!==$cfg['Badwordfilter'] && '0'!=$cfg['Badwordfilter']){
		$badwords = explode(',', $cfg['Badwordfilter']);			// the configured badwords
		$badwordFields = explode(',', $cfg['Badwordfields']);		// the configured fields to check for badwords
		$badwordMatches = array();									// the badwords that have been found in the fields
		
		if(0<count($badwordFields)){
			foreach($badwords as $badword){
				$badword = trim($badword);												// remove whitespaces from badword
				$badwordMatch = str_replace('%', '', $badword);							// take human readable badword for error-message
				$badword = addcslashes($badword, '.:/');								// make ., : and / preg_match-valid
				if('%'!=substr($badword, 0, 1)){ $badword = '\\b'.$badword; }			// if word mustn't have chars before > add word boundary at the beginning of the word
				if('%'!=substr($badword, -1, 1)){ $badword = $badword.'\\b'; }			// if word mustn't have chars after > add word boundary at the end of the word
				$badword = str_replace('%', '', $badword);								// if word is allowed in the middle > remove all % so it is also allowed in the middle in preg_match 
				foreach($badwordFields as $badwordField){
					if(preg_match('#'.$badword.'#is', $_POST[trim($badwordField)]) && !in_array($badwordMatch, $badwordMatches)){
						$badwordMatches[] = $badwordMatch;
					}
				}
			}		
			
			if(0<count($badwordMatches)){
				$fehler['Badwordfilter'] = "<span class='errormsg-spamprotection' style='display: block;'>The following expressions are not allowed: ".implode(', ', $badwordMatches)."</span>";
			}
		}		
	}
	
  // -------------------- SPAMPROTECTION ERROR MESSAGES END ----------------------
  
  
	if($cfg['Data_privacy_policy'] && isset($data_protection) && $data_protection == ""){ 
		$fehler['data_protection'] = "<span class='errormsg'>You must accept the <strong>data privacy policy</strong>.</span>";
	}

    $buttonClass = 'failed';
    $formMessage = '<img src="img/failed.png" style="width:25px;height:25px;vertical-align: middle;"> <span class="error_in_email_sending">Please check and correct your entries.</span>';



	// there are NO errors > upload-check
    if (!isset($fehler) || count($fehler) == 0) {
      $error             = false;
      $errorMessage      = '';
      $uploadErrors      = array();
      $uploadedFiles     = array();
      $totalUploadSize   = 0;
	  $j = 0;       
        
	  if (2==$cfg['UPLOAD_ACTIVE'] && in_array($_SERVER['REMOTE_ADDR'], $cfg['BLACKLIST_IP']) === true) {
          $error = true;
		  $uploadErrors[$j]['name'] = '';
          $uploadErrors[$j]['error'] = "You are not allowed to upload files.";
          $j++;
      }

      if (!$error) {
          for ($i=0; $i < $cfg['NUM_ATTACHMENT_FIELDS']; $i++) {
              if ($_FILES['f']['error'][$i] == UPLOAD_ERR_NO_FILE) {
                  continue;
              }

              $extension = explode('.', $_FILES['f']['name'][$i]);
              $extension = strtolower($extension[count($extension)-1]);
              $totalUploadSize += $_FILES['f']['size'][$i];

              if ($_FILES['f']['error'][$i] != UPLOAD_ERR_OK) {
                  $uploadErrors[$j]['name'] = $_FILES['f']['name'][$i];
                  switch ($_FILES['f']['error'][$i]) {
                      case UPLOAD_ERR_INI_SIZE :
                          $uploadErrors[$j]['error'] = 'The file is too large (PHP-Ini directive).';
                      break;
                      case UPLOAD_ERR_FORM_SIZE :
                          $uploadErrors[$j]['error'] = 'The file is too large (MAX_FILE_SIZE in HTML form).';
                      break;
                      case UPLOAD_ERR_PARTIAL :
						  if (2==$cfg['UPLOAD_ACTIVE']) {
                          	  $uploadErrors[$j]['error'] = 'The file was only partially uploaded.';
						  } else {
							  $uploadErrors[$j]['error'] = 'The file was only partially sent.';
					  	  }
                      break;
                      case UPLOAD_ERR_NO_TMP_DIR :
                          $uploadErrors[$j]['error'] = 'No temporary folder found.';
                      break;
                      case UPLOAD_ERR_CANT_WRITE :
                          $uploadErrors[$j]['error'] = 'Error while saving the file.';
                      break;
                      case UPLOAD_ERR_EXTENSION  :
                          $uploadErrors[$j]['error'] = 'Unknown error caused by an extension.';
                      break;
                      default :
						  if (2==$cfg['UPLOAD_ACTIVE']) {
                          	  $uploadErrors[$j]['error'] = 'Unknown error during upload.';
						  } else {
							  $uploadErrors[$j]['error'] = 'Unknown error when sending the email attachment.';
						  }
                  }

                  $j++;
                  $error = true;
              }
              if ($totalUploadSize > $cfg['MAX_ATTACHMENT_SIZE']*1024) {
                  $uploadErrors[$j]['name'] = $_FILES['f']['name'][$i];
                  $uploadErrors[$j]['error'] = 'Maximum upload reached ('.$cfg['MAX_ATTACHMENT_SIZE'].' KB).';
                  $j++;
                  $error = true;
              }
              if ($_FILES['f']['size'][$i] > $cfg['MAX_FILE_SIZE']*1024) {
                  $uploadErrors[$j]['name'] = $_FILES['f']['name'][$i];
                  $uploadErrors[$j]['error'] = 'The file is too large (max. '.$cfg['MAX_FILE_SIZE'].' KB).';
                  $j++;
                  $error = true;
              }
              if (!empty($cfg['WHITELIST_EXT']) && strpos($cfg['WHITELIST_EXT'], $extension) === false) {
                  $uploadErrors[$j]['name'] = $_FILES['f']['name'][$i];
                  $uploadErrors[$j]['error'] = 'The file extension is not allowed.';
                  $j++;
                  $error = true;
              }
              if (preg_match("=^[\\:*?<>|/]+$=", $_FILES['f']['name'][$i])) {
                  $uploadErrors[$j]['name'] = $_FILES['f']['name'][$i];
                  $uploadErrors[$j]['error'] = 'Invalid characters in the file name (\/:*?<>|).';
                  $j++;
                  $error = true;
              }
              if (2==$cfg['UPLOAD_ACTIVE'] && file_exists($cfg['UPLOAD_FOLDER'].'/'.$_FILES['f']['name'][$i])) {
                  $uploadErrors[$j]['name'] = $_FILES['f']['name'][$i];
                  $uploadErrors[$j]['error'] = 'The file already exists. Please change the file name.';
                  $j++;
                  $error = true;
              }
              if(!$error) {
				  if (2==$cfg['UPLOAD_ACTIVE']) {
                     move_uploaded_file($_FILES['f']['tmp_name'][$i], $cfg['UPLOAD_FOLDER'].'/'.$_FILES['f']['name'][$i]);
				  }
                  $uploadedFiles[$_FILES['f']['tmp_name'][$i]] = $_FILES['f']['name'][$i];
              }
          }
      }
      
      
      if ($error) {
          $errorMessage = ''."";
          if (count($uploadErrors) > 0) {
              $tmp = '';
			  foreach ($uploadErrors as $err) {
                  $tmp .= '<strong>'.$err['name']."</strong><br/>\n- ".$err['error']."<br/><br/>\n";
              }
              $tmp = "<br/>".$tmp;
          }
          $errorMessage .= $tmp.'';
          $fehler['upload'] = "<span class='errormsg-upload' style='display: block;'>".$errorMessage."</span>";
      }
	}


$buttonClass = 'failed';


	// there are NO errors > send mail
   if (!isset($fehler))   {
   
   
		// ------------------------------------------------------------
		// -------------------- send mail to admin --------------------
		// ------------------------------------------------------------

		// ---- create mail-message for admin
	  $mailcontent  = "You've received the following information through the contact form:\n" . "-------------------------------------------------------------------------\n\n";
		$mailcontent .= "Name: " . $first_name . " " . $name . "\n\n";
		$mailcontent .= "Email: " . $email . "\n";
		$mailcontent .= "Telephone: " . $telephone . "\n\n";		
		$mailcontent .= "Address Line 1: " . $str . "\n";
		$mailcontent .= "Address Line 2: " . $str2 . "\n";
		$mailcontent .= "Postal Code / City: " . $postal_zip_code . " " . $city . "\n";
		$mailcontent .= "Country / State / Province: " . $country . " " . $region . "\n";
				
		$mailcontent .= "\nSubject: " . $subject . "\n";
		$mailcontent .= "Message:\n" . $message = preg_replace("/\r\r|\r\n|\n\r|\n\n/","\n",$message) . "\n\n";
		if(count($uploadedFiles) > 0){
			if(2==$cfg['UPLOAD_ACTIVE']){
				$mailcontent .= "\n\n";
				$mailcontent .= 'The following files have been uploaded:'."\n";
				foreach ($uploadedFiles as $filename) {
					$mailcontent .= ' - '.$cfg['DOWNLOAD_URL'].'/'.$cfg['UPLOAD_FOLDER'].'/'.$filename."\n";
				}
			} else {
				$mailcontent .= "\n\n";
				$mailcontent .= 'The following files have been attached:'."\n";
				foreach ($uploadedFiles as $filename) {
					$mailcontent .= ' - '.$filename."\n";
				}
			}
		}
		if($cfg['Data_privacy_policy']) { $mailcontent .= "\n\nData protection: " . $data_protection . " \n"; }
    $mailcontent .= "\n\nIP address: " . $ip . "\n";
		$mailcontent = strip_tags ($mailcontent);

		// ---- get attachments for admin
		$attachments = array();
		if(1==$cfg['UPLOAD_ACTIVE'] && count($uploadedFiles) > 0){
			foreach($uploadedFiles as $tempFilename => $filename) {
				$attachments[$filename] = file_get_contents($tempFilename);
			}
		}

		$success = false;

        // ---- send mail to admin
        if($smtp['enabled'] !== 0) {
            require_once __DIR__ . '/smtp.php';
            $success = SMTP::send(
                $smtp['host'],
                $smtp['user'],
                $smtp['password'],
                $smtp['encryption'],
                $smtp['port'],
                $email,
                $yourname,
                $recipient,
                $subject,
                $mailcontent,
                (2==$cfg['UPLOAD_ACTIVE'] ? array() : $uploadedFiles),
                $cfg['UPLOAD_FOLDER'],
                $smtp['debug']
            );
        } else {
            $success = sendMyMail($email, $first_name." ".$name, $recipient, $subject, $mailcontent, $attachments);
        }

    	// ------------------------------------------------------------
    	// ------------------- send mail to customer ------------------
    	// ------------------------------------------------------------
    	if(
			$success && 
			(
				2==$cfg['Send_copy'] || 																// send copy always
				(1==$cfg['Send_copy'] && isset($_POST['mail-copy']) && 1==$_POST['mail-copy'])		// send copy only if customer want to
			)
		){

    		// ---- create mail-message for customer
			$mailcontent  = "Many thanks for your email. We will answer as soon as possible.\n\n";
    		$mailcontent .= "Summary: \n" .  "-------------------------------------------------------------------------\n\n";
    		$mailcontent .= "Name: " . $first_name . " " . $name . "\n\n";	
    		$mailcontent .= "Email: " . $email . "\n";
    		$mailcontent .= "Telephone: " . $telephone . "\n\n";
    		$mailcontent .= "Address Line 1: " . $str . "\n";
    		$mailcontent .= "Address Line 2: " . $str2 . "\n";
		    $mailcontent .= "Postal Code / City: " . $postal_zip_code . " " . $city . "\n";
		    $mailcontent .= "Country / State / Province: " . $country . " " . $region . "\n";
		    
    		$mailcontent .= "\nSubject: " . $subject . "\n";
    		$mailcontent .= "Message:\n" . str_replace("\r", "", $message) . "\n\n";
    		if(count($uploadedFiles) > 0){
    			$mailcontent .= 'You have transferred the following files:'."\n";
    			foreach($uploadedFiles as $file){
    				$mailcontent .= ' - '.$file."\n";
    			}
    		}
    		$mailcontent = strip_tags ($mailcontent);

    		// ---- send mail to customer
            if($smtp['enabled'] !== 0) {
                SMTP::send(
                    $smtp['host'],
                    $smtp['user'],
                    $smtp['password'],
                    $smtp['encryption'],
                    $smtp['port'],
                    $recipient,
                    $yourname,
                    $email,
                    "Your request",
                    $mailcontent,
                    array(),
                    $cfg['UPLOAD_FOLDER'],
                    $smtp['debug']
                );
            } else {
                $success = sendMyMail($recipient, $yourname, $email, "Your request", $mailcontent);
            }
		}
		
// redirect to success-page	   
        
		if ($success) {
            if ($cfg['Success_message'] === 0) {
                if ($smtp['enabled'] === 0 || $smtp['debug'] === 0) {
                    	echo "<META HTTP-EQUIV=\"refresh\" content=\"0;URL=" . $thankyou . "\">";
                }
                exit;
            }
            
        } else {
            
           $fehler['Sendmail'] = "<span class='errormsg-emailerror' style='display: block;line-height:25px;font-size:16px;'><span style='text-decoration:underline;font-size:18px;line-height:28px;color:red;'>The message could not be sent for one of the following reasons:</span><br /><ol style='text-align: left;line-height:25px;color:black;font-weight:normal;'>
  


 <li><b>You are using an external email address (e.g., from a free email provider).</b> We generally recommend using a domain-specific email address (e.g., info@your-domain.com), as an external email address (e.g., from GMX, Gmail, Yahoo, Web.de, Outlook, Freenet, Tuta, or Telekom/T-Online) is typically not permitted by a hosting provider. <br/><br/>  
   <span style=color:red;font-weight:bold;>Important:</span> Clear the cache and cookies (or website data) in your browser after you have entered the correct email address in the config.php file. Otherwise, this message may continue to appear. If needed, use an alternative browser to verify the functionality of the contact form.</li><br />
  
  <li><b>IONOS customers:</b> <a  style=\"color: blue; text-decoration: none;\" target=\"blank\" href=\"https://www.kontaktformular.com/en/web-host-hosteurope-strato.html#IONOS-E-Mail-Versand\">Please refer to Note #1.</a><br/><br/>
  
  <b>Hosteurope customers:</b> <a  style=\"color: blue; text-decoration: none;\" target=\"blank\" href=\"https://www.kontaktformular.com/en/web-host-hosteurope-strato.html#domain-eigene-email\">Please refer to Notes #2, #3, and #4.</a> (<span>&#8592; The information may also be relevant for other hosting providers!</span>)<br/><br/>
  
 
  
    <b>webgo customers:</b> <a  style=\"color: blue; text-decoration: none;\" target=\"blank\" href=\"https://www.kontaktformular.com/en/web-host-hosteurope-strato.html#domain-eigene-email\">Please refer to Note #2.</a> (<span>&#8592; The information may also be relevant for other hosting providers!</span>)<br/><br/>
    
    
   <b><a  style=\"color: blue; text-decoration: none;\" target=\"blank\" href=\"https://www.kontaktformular.com/en/hosting-provider-check.html\">Feel free to use our Hosting Provider Check page.</a></b> (&#8592; The contact form has been tested with various hosting providers.)<br/><br/>
  
  <span style=color:red;font-weight:bold;>Important:</span> Clear the cache and cookies (or website data) in your browser after making changes. Otherwise, this message may continue to appear. If necessary, use an alternative browser to verify the functionality of the contact form.</li><br />
  
  
  <li>The email address used (see config.php) may need to be verified with your hosting provider. Please contact your hosting provider.<br /><br /><b>Note:</b> Unfortunately, some hosting providers (e.g., Hosteurope, IONOS) prohibit the use of a non-domain email address (e.g., from free email providers). We therefore recommend using a domain-specific email address in the format info@your-domain.com.<br/><br/><span style=color:red;font-weight:bold;>Important:</span> Clear the cache and cookies (or website data) in your browser after entering the verified email address into the config.php file. Otherwise, this message may continue to appear. If needed, use an alternative browser to verify the functionality of the contact form.</li><br />
    
  
<li>You are running a local web server (http://localhost): Test the contact form on the web server of a reputable hosting provider. The PHP mail() function is usually only partially functional on a local web server.</li><br />
  
  
  <li>You have enabled SMTP in the config.php file and entered incorrect SMTP credentials. Please contact your hosting provider.<br /><br /><b>Note:</b> Enabling the SMTP function is not strictly necessary for sending emails, as the PHP mail() function is generally used.</li><br />
  
  
  <li>You have enabled SMTP in the config.php file and wish to connect to an external mail server (e.g., Gmail, GMX, WEB.DE, Yahoo, T-Online). You may need to request a port opening from your hosting provider. Please contact your hosting provider.<br /><br /><b>Note:</b> Enabling the SMTP function is not strictly necessary for sending emails, as the PHP mail() function is used by default.</li><br />
   
   
   <li><a  style=\"color: blue; text-decoration: none;\" target=\"blank\" href=\"https://www.kontaktformular.com/en/faq-script-php-contact-form.html#not-receive-email\">For more information, please visit our FAQ page. </a></li>
</ol>";
		}
		
		if (!empty($fehler['Sendmail'])) {
    $buttonClass = '<span style=display:none;>failed</span>';
    $formMessage = '<span style=display:none;>Your message was NOT sent.</span>';
}

else {

    $buttonClass = 'finished';
    $formMessage = '<img src="img/finished.png" style="width:29px;height:29px;vertical-align: middle;"> <span class="successfully_sent">Your message has been sent.</span>';
                             
		}
	}
}


// clean post
foreach($_POST as $key => $value){
$_POST[$key] = htmlentities($value, ENT_QUOTES, "UTF-8");
}
?><?php
function sendMyMail($fromMail, $fromName, $toMail, $subject, $content, $attachments=array()){

	$boundary = md5(uniqid(time()));
	$eol = PHP_EOL;

	// header
	$header = "From: =?UTF-8?B?".base64_encode(stripslashes($fromName))."?= <".$fromMail.">".$eol;
	$header .= "Reply-To: <".$fromMail.">".$eol;
	$header .= "MIME-Version: 1.0".$eol;
	if(is_array($attachments) && 0<count($attachments)){
		$header .= "Content-Type: multipart/mixed; boundary=\"".$boundary."\"";
	}
	else{
		$header .= "Content-type: text/plain; charset=utf-8";
	}


	// content with attachments
	if(is_array($attachments) && 0<count($attachments)){

		// content
		$message = "--".$boundary.$eol;
		$message .= "Content-type: text/plain; charset=utf-8".$eol;
		$message .= "Content-Transfer-Encoding: 8bit".$eol.$eol;
		$message .= $content.$eol;

		// attachments
		foreach($attachments as $filename=>$filecontent){
			$filecontent = chunk_split(base64_encode($filecontent));
			$message .= "--".$boundary.$eol;
			$message .= "Content-Type: application/octet-stream; name=\"".$filename."\"".$eol;
			$message .= "Content-Transfer-Encoding: base64".$eol;
			$message .= "Content-Disposition: attachment; filename=\"".$filename."\"".$eol.$eol;
			$message .= $filecontent.$eol;
		}
		$message .= "--".$boundary."--";
	}
	
	// content without attachments
	else{
		$message = $content;
	}
	
	// subject
	$subject = "=?UTF-8?B?".base64_encode($subject)."?=";
	
	// send mail
	return mail($toMail, $subject, $message, $header);
}

?>
<!DOCTYPE html>
<html lang="en-US">

	<head>

		<meta charset="utf-8">
		<meta name="language" content="en-us"/>
		<meta name="description" content="kontaktformular.com"/>
		<meta name="revisit" content="After 7 days"/>
		<meta name="robots" content="INDEX,FOLLOW"/>
		<title>kontaktformular.com</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />

<link href="css/style-contact-form.css" rel="stylesheet">

<script src="js/jquery.min.js"></script>

</head>


<body>

	<div>
		<form id="kontaktformular" class="kontaktformular" action="<?php echo $_SERVER['SCRIPT_NAME']; ?>" method="post" enctype="multipart/form-data">


<script>
if (navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0) 
{
   document.getElementsByTagName("BODY")[0].className += " safari";
}
		</script>




			<p id="submitMessage" class="<?= $buttonClass ?>"><?= $formMessage ?><?php 
				if(
					(isset($fehler["Honeypot"]) && $fehler["Honeypot"] != "") || 
					(isset($fehler["Time-out"]) && $fehler["Time-out"] != "") ||
					(isset($fehler["Click_check"]) && $fehler['Click_check'] != "") ||
					(isset($fehler["Links"]) && $fehler['Links'] != "") ||
					(isset($fehler["Badwordfilter"]) && $fehler['Badwordfilter'] != "") || 
					(isset($fehler["Sendmail"]) && $fehler['Sendmail'] != "") ||
					(isset($fehler["upload"]) && $fehler['upload'] != "") 
				){
					?>
					<div class="row">
						<div class="col-sm-8">
						 <?php if (isset($fehler["Honeypot"]) && $fehler["Honeypot"] != "") { echo $fehler["Honeypot"]; } ?>
							<?php if (isset($fehler["Time-out"]) && $fehler["Time-out"] != "") { echo $fehler["Time-out"]; } ?>
							<?php if (isset($fehler["Click_check"]) && $fehler["Click_check"] != "") { echo $fehler["Click_check"]; } ?>
							<?php if (isset($fehler["Links"]) && $fehler["Links"] != "") { echo $fehler["Links"]; } ?>
							<?php if (isset($fehler["Badwordfilter"]) && $fehler["Badwordfilter"] != "") { echo $fehler["Badwordfilter"]; } ?>
							<?php if (isset($fehler["Sendmail"]) && $fehler["Sendmail"] != "") { echo $fehler["Sendmail"]; } ?>
							<?php if (isset($fehler["upload"]) && $fehler["upload"] != "") { echo $fehler["upload"]; } ?>
						</div>
					</div>
					<?php
				}
			
			
			?></p>

			<div class="row">
				<div class="col-sm-4 <?php if ($fehler["first_name"] != "") { echo 'error'; } ?> <?php echo (isset($_POST['first_name']) && ''!=$_POST['first_name'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right4"><i id="user-icon" class="fa fa-user"></i></label>
					<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="First Name" type="text" name="first_name" class="field"  placeholder="First Name *" value="<?php echo $_POST['first_name']; ?>" maxlength="<?php echo $number_of_characters_first_name; ?>" id="border-right4" onclick="setActive(this);" onfocus="setActive(this);"/>
					<?php if ($fehler["first_name"] != "") { echo $fehler["first_name"]; } ?>
				</div>
				<div class="col-sm-4 <?php if ($fehler["name"] != "") { echo 'error'; } ?> <?php echo (isset($_POST['name']) && ''!=$_POST['name'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right5"><i id="user-icon" class="fa fa-user"></i></label>
					<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> type="text" name="name" class="field" placeholder="Last Name *" value="<?php echo $_POST['name']; ?>" maxlength="<?php echo $number_of_characters_name; ?>" id="border-right5" onclick="setActive(this);" onfocus="setActive(this);"/>
					<?php if ($fehler["name"] != "") { echo $fehler["name"]; } ?>
				</div>
			</div>



			<div class="row">
				<div class="col-sm-4 <?php if ($fehler["email"] != "") { echo 'error'; } ?> <?php echo (isset($_POST['email']) && ''!=$_POST['email'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right6"><i id="email-icon" class="fa fa-envelope"></i></label>
					<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Email" type="<?php if($cfg['HTML5_error_messages']) { echo 'email'; }else{ echo 'text'; } ?>" name="email" class="field" placeholder="Email *" value="<?php echo $_POST['email']; ?>" maxlength="<?php echo $number_of_characters_email; ?>" id="border-right6" onclick="setActive(this);" onfocus="setActive(this);"/>
					<?php if ($fehler["email"] != "") { echo $fehler["email"]; } ?>
				</div>
				<div class="col-sm-4 <?php echo (isset($_POST['telephone']) && ''!=$_POST['telephone'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right7"><i id="phone-icon" class="fa fa-phone"></i></label>
					<input aria-label="Telephone" type="text" name="telephone" class="field" placeholder="Telephone" value="<?php echo $_POST['telephone']; ?>" maxlength="<?php echo $number_of_characters_telephone; ?>" id="border-right7" onclick="setActive(this);" onfocus="setActive(this);"/>
				</div>
			</div>









			
			
			
								<div class="row">
				<div class="col-sm-8 <?php echo (isset($_POST['str']) && ''!=$_POST['str'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right10"><i id="street-icon" class="fas fa-map-signs"></i></label>
					<input aria-label="Str" type="text" name="str" class="field"  placeholder="Address Line 1" value="<?php echo $_POST['str']; ?>" maxlength="<?php echo $number_of_characters_str; ?>" id="border-right10" onclick="setActive(this);" onfocus="setActive(this);"/>
					 
				</div>
				
			</div>


	<div class="row">
				<div class="col-sm-8 <?php echo (isset($_POST['str2']) && ''!=$_POST['str2'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right17"><i id="street-icon" class="fas fa-map-signs"></i></label>
					<input aria-label="Str2" type="text" name="str2" class="field"  placeholder="Address Line 2 (optional)" value="<?php echo $_POST['str2']; ?>" maxlength="<?php echo $number_of_characters_str2; ?>" id="border-right17" onclick="setActive(this);" onfocus="setActive(this);"/>
					 
				</div>
				
			</div>





			<div class="row">
				<div class="col-sm-postal-zip-code <?php echo (isset($_POST['postal_zip_code']) && ''!=$_POST['postal_zip_code'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right11"><i id="zipcode-icon" class="fas fa-map-marker-alt"></i></label>
					<input aria-label="PLZ" type="text" name="postal_zip_code" class="field" placeholder="Postal Code" value="<?php echo $_POST['postal_zip_code']; ?>" maxlength="<?php echo $number_of_characters_postal_zip_code; ?>" id="border-right11" onclick="setActive(this);" onfocus="setActive(this);"/>
					 
				</div>
				<div class="col-sm-city <?php echo (isset($_POST['city']) && ''!=$_POST['city'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right12"><i id="home-icon" class="fas fa-home"></i></label>
					<input aria-label="Ort" type="text" name="city" class="field" placeholder="City" value="<?php echo $_POST['city']; ?>" maxlength="<?php echo $number_of_characters_city; ?>" id="border-right12" onclick="setActive(this);" onfocus="setActive(this);"/>
				</div>
				<div class="col-sm-region <?php echo (isset($_POST['region']) && ''!=$_POST['region'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right13"><i id="region-icon" class="fas fa-flag"></i></label>
					<input aria-label="State / Province" type="text" name="region" class="field" placeholder="State / Province" value="<?php echo $_POST['region']; ?>" maxlength="<?php echo $number_of_characters_region; ?>" id="border-right13" onclick="setActive(this);" onfocus="setActive(this);"/>
					 
				</div>
			</div>
			
			
			
			
			<div class="row">
				
				<div class="col-sm-8 <?php echo (isset($_POST['country']) && ''!=$_POST['country'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label select-label" for="border-right14" style="pointer-events: none; z-index: 1;"><i id="caret-down-icon" class="fas fa-caret-down"></i></label>
					<select aria-label="Country" name="country" class="field unselected" onchange="if(0!=this.selectedIndex){ this.setAttribute('class', 'field'); }else{ this.setAttribute('class', 'field unselected'); }" id="border-right14" onclick="setActive(this);" onfocus="setActive(this);">
						<option value="" selected >Country</option>
						<option value="Afganistan" <?php if($_POST['country']=="Afganistan"){ echo "selected";}?> >Afghanistan</option>
<option value="Albania" <?php if($_POST['country']=="Albania"){ echo "selected";}?> >Albania</option>
<option value="Algeria" <?php if($_POST['country']=="Algeria"){ echo "selected";}?> >Algeria</option>
<option value="American Samoa" <?php if($_POST['country']=="American Samoa"){ echo "selected";}?> >American Samoa</option>
<option value="Andorra" <?php if($_POST['country']=="Andorra"){ echo "selected";}?> >Andorra</option>
<option value="Angola" <?php if($_POST['country']=="Angola"){ echo "selected";}?> >Angola</option>
<option value="Anguilla" <?php if($_POST['country']=="Anguilla"){ echo "selected";}?> >Anguilla</option>
<option value="Antigua and Barbuda" <?php if($_POST['country']=="Antigua and Barbuda"){ echo "selected";}?> >Antigua &amp; Barbuda</option>
<option value="Argentina" <?php if($_POST['country']=="Argentina"){ echo "selected";}?> >Argentina</option>
<option value="Armenia" <?php if($_POST['country']=="Armenia"){ echo "selected";}?> >Armenia</option>
<option value="Aruba" <?php if($_POST['country']=="Aruba"){ echo "selected";}?> >Aruba</option>
<option value="Australia" <?php if($_POST['country']=="Australia"){ echo "selected";}?> >Australia</option>
<option value="Austria" <?php if($_POST['country']=="Austria"){ echo "selected";}?> >Austria</option>
<option value="Azerbaijan" <?php if($_POST['country']=="Azerbaijan"){ echo "selected";}?> >Azerbaijan</option>
<option value="Bahamas" <?php if($_POST['country']=="Bahamas"){ echo "selected";}?> >Bahamas</option>
<option value="Bahrain" <?php if($_POST['country']=="Bahrain"){ echo "selected";}?> >Bahrain</option>
<option value="Bangladesh" <?php if($_POST['country']=="Bangladesh"){ echo "selected";}?> >Bangladesh</option>
<option value="Barbados" <?php if($_POST['country']=="Barbados"){ echo "selected";}?> >Barbados</option>
<option value="Belarus" <?php if($_POST['country']=="Belarus"){ echo "selected";}?> >Belarus</option>
<option value="Belgium" <?php if($_POST['country']=="Belgium"){ echo "selected";}?> >Belgium</option>
<option value="Belize" <?php if($_POST['country']=="Belize"){ echo "selected";}?> >Belize</option>
<option value="Benin" <?php if($_POST['country']=="Benin"){ echo "selected";}?> >Benin</option>
<option value="Bermuda" <?php if($_POST['country']=="Bermuda"){ echo "selected";}?> >Bermuda</option>
<option value="Bhutan" <?php if($_POST['country']=="Bhutan"){ echo "selected";}?> >Bhutan</option>
<option value="Bolivia" <?php if($_POST['country']=="Bolivia"){ echo "selected";}?> >Bolivia</option>
<option value="Bonaire" <?php if($_POST['country']=="Bonaire"){ echo "selected";}?> >Bonaire</option>
<option value="Bosnia and Herzegovina" <?php if($_POST['country']=="Bosnia and Herzegovina"){ echo "selected";}?> >Bosnia &amp; Herzegovina</option>
<option value="Botswana" <?php if($_POST['country']=="Botswana"){ echo "selected";}?> >Botswana</option>
<option value="Brazil" <?php if($_POST['country']=="Brazil"){ echo "selected";}?> >Brazil</option>
<option value="British Indian Ocean Territory" <?php if($_POST['country']=="British Indian Ocean Territory"){ echo "selected";}?> >British Indian Ocean Territory</option>
<option value="Brunei" <?php if($_POST['country']=="Brunei"){ echo "selected";}?> >Brunei</option>
<option value="Bulgaria" <?php if($_POST['country']=="Bulgaria"){ echo "selected";}?> >Bulgaria</option>
<option value="Burkina Faso" <?php if($_POST['country']=="Burkina Faso"){ echo "selected";}?> >Burkina Faso</option>
<option value="Burundi" <?php if($_POST['country']=="Burundi"){ echo "selected";}?> >Burundi</option>
<option value="Cambodia" <?php if($_POST['country']=="Cambodia"){ echo "selected";}?> >Cambodia</option>
<option value="Cameroon" <?php if($_POST['country']=="Cameroon"){ echo "selected";}?> >Cameroon</option>
<option value="Canada" <?php if($_POST['country']=="Canada"){ echo "selected";}?> >Canada</option>
<option value="Canary Islands" <?php if($_POST['country']=="Canary Islands"){ echo "selected";}?> >Canary Islands</option>
<option value="Cape Verde" <?php if($_POST['country']=="Cape Verde"){ echo "selected";}?> >Cape Verde</option>
<option value="Cayman Islands" <?php if($_POST['country']=="Cayman Islands"){ echo "selected";}?> >Cayman Islands</option>
<option value="Central African Republic" <?php if($_POST['country']=="Central African Republic"){ echo "selected";}?> >Central African Republic</option>
<option value="Chad" <?php if($_POST['country']=="Chad"){ echo "selected";}?> >Chad</option>
<option value="Channel Islands" <?php if($_POST['country']=="Channel Islands"){ echo "selected";}?> >Channel Islands</option>
<option value="Chile" <?php if($_POST['country']=="Chile"){ echo "selected";}?> >Chile</option>
<option value="China" <?php if($_POST['country']=="China"){ echo "selected";}?> >China</option>
<option value="Christmas Island" <?php if($_POST['country']=="Christmas Island"){ echo "selected";}?> >Christmas Island</option>
<option value="Cocos Island" <?php if($_POST['country']=="Cocos Island"){ echo "selected";}?> >Cocos Island</option>
<option value="Colombia" <?php if($_POST['country']=="Colombia"){ echo "selected";}?> >Colombia</option>
<option value="Comoros" <?php if($_POST['country']=="Comoros"){ echo "selected";}?> >Comoros</option>
<option value="Congo" <?php if($_POST['country']=="Congo"){ echo "selected";}?> >Congo</option>
<option value="Cook Islands" <?php if($_POST['country']=="Cook Islands"){ echo "selected";}?> >Cook Islands</option>
<option value="Costa Rica" <?php if($_POST['country']=="Costa Rica"){ echo "selected";}?> >Costa Rica</option>
<option value="Cote DIvoire" <?php if($_POST['country']=="Cote DIvoire"){ echo "selected";}?> >Cote D'Ivoire</option>
<option value="Croatia" <?php if($_POST['country']=="Croatia"){ echo "selected";}?> >Croatia</option>
<option value="Cuba" <?php if($_POST['country']=="Cuba"){ echo "selected";}?> >Cuba</option>
<option value="Curaco" <?php if($_POST['country']=="Curaco"){ echo "selected";}?> >Curacao</option>
<option value="Cyprus" <?php if($_POST['country']=="Cyprus"){ echo "selected";}?> >Cyprus</option>
<option value="Czech Republic" <?php if($_POST['country']=="Czech Republic"){ echo "selected";}?> >Czech Republic</option>
<option value="Denmark" <?php if($_POST['country']=="Denmark"){ echo "selected";}?> >Denmark</option>
<option value="Djibouti" <?php if($_POST['country']=="Djibouti"){ echo "selected";}?> >Djibouti</option>
<option value="Dominica" <?php if($_POST['country']=="Dominica"){ echo "selected";}?> >Dominica</option>
<option value="Dominican Republic" <?php if($_POST['country']=="Dominican Republic"){ echo "selected";}?> >Dominican Republic</option>
<option value="East Timor" <?php if($_POST['country']=="East Timor"){ echo "selected";}?> >East Timor</option>
<option value="Ecuador" <?php if($_POST['country']=="Ecuador"){ echo "selected";}?> >Ecuador</option>
<option value="Egypt" <?php if($_POST['country']=="Egypt"){ echo "selected";}?> >Egypt</option>
<option value="El Salvador" <?php if($_POST['country']=="El Salvador"){ echo "selected";}?> >El Salvador</option>
<option value="Equatorial Guinea" <?php if($_POST['country']=="Equatorial Guinea"){ echo "selected";}?> >Equatorial Guinea</option>
<option value="Eritrea" <?php if($_POST['country']=="Eritrea"){ echo "selected";}?> >Eritrea</option>
<option value="Estonia" <?php if($_POST['country']=="Estonia"){ echo "selected";}?> >Estonia</option>
<option value="Ethiopia" <?php if($_POST['country']=="Ethiopia"){ echo "selected";}?> >Ethiopia</option>
<option value="Falkland Islands" <?php if($_POST['country']=="Falkland Islands"){ echo "selected";}?> >Falkland Islands</option>
<option value="Faroe Islands" <?php if($_POST['country']=="Faroe Islands"){ echo "selected";}?> >Faroe Islands</option>
<option value="Fiji" <?php if($_POST['country']=="Fiji"){ echo "selected";}?> >Fiji</option>
<option value="Finland" <?php if($_POST['country']=="Finland"){ echo "selected";}?> >Finland</option>
<option value="France" <?php if($_POST['country']=="France"){ echo "selected";}?> >France</option>
<option value="French Guiana" <?php if($_POST['country']=="French Guiana"){ echo "selected";}?> >French Guiana</option>
<option value="French Polynesia" <?php if($_POST['country']=="French Polynesia"){ echo "selected";}?> >French Polynesia</option>
<option value="French Southern Territory" <?php if($_POST['country']=="French Southern Territory"){ echo "selected";}?> >French Southern Territory</option>
<option value="Gabon" <?php if($_POST['country']=="Gabon"){ echo "selected";}?> >Gabon</option>
<option value="Gambia" <?php if($_POST['country']=="Gambia"){ echo "selected";}?> >Gambia</option>
<option value="Georgia" <?php if($_POST['country']=="Georgia"){ echo "selected";}?> >Georgia</option>
<option value="Germany" <?php if($_POST['country']=="Germany"){ echo "selected";}?> >Germany</option>
<option value="Ghana" <?php if($_POST['country']=="Ghana"){ echo "selected";}?> >Ghana</option>
<option value="Gibraltar" <?php if($_POST['country']=="Gibraltar"){ echo "selected";}?> >Gibraltar</option>
<option value="Great Britain" <?php if($_POST['country']=="Great Britain"){ echo "selected";}?> >Great Britain</option>
<option value="Greece" <?php if($_POST['country']=="Greece"){ echo "selected";}?> >Greece</option>
<option value="Greenland" <?php if($_POST['country']=="Greenland"){ echo "selected";}?> >Greenland</option>
<option value="Grenada" <?php if($_POST['country']=="Grenada"){ echo "selected";}?> >Grenada</option>
<option value="Guadeloupe" <?php if($_POST['country']=="Guadeloupe"){ echo "selected";}?> >Guadeloupe</option>
<option value="Guam" <?php if($_POST['country']=="Guam"){ echo "selected";}?> >Guam</option>
<option value="Guatemala" <?php if($_POST['country']=="Guatemala"){ echo "selected";}?> >Guatemala</option>
<option value="Guinea" <?php if($_POST['country']=="Guinea"){ echo "selected";}?> >Guinea</option>
<option value="Guyana" <?php if($_POST['country']=="Guyana"){ echo "selected";}?> >Guyana</option>
<option value="Haiti" <?php if($_POST['country']=="Haiti"){ echo "selected";}?> >Haiti</option>
<option value="Hawaii" <?php if($_POST['country']=="Hawaii"){ echo "selected";}?> >Hawaii</option>
<option value="Honduras" <?php if($_POST['country']=="Honduras"){ echo "selected";}?> >Honduras</option>
<option value="Hong Kong" <?php if($_POST['country']=="Hong Kong"){ echo "selected";}?> >Hong Kong</option>
<option value="Hungary" <?php if($_POST['country']=="Hungary"){ echo "selected";}?> >Hungary</option>
<option value="Iceland" <?php if($_POST['country']=="Iceland"){ echo "selected";}?> >Iceland</option>
<option value="India" <?php if($_POST['country']=="India"){ echo "selected";}?> >India</option>
<option value="Indonesia" <?php if($_POST['country']=="Indonesia"){ echo "selected";}?> >Indonesia</option>
<option value="Iran" <?php if($_POST['country']=="Iran"){ echo "selected";}?> >Iran</option>
<option value="Iraq" <?php if($_POST['country']=="Iraq"){ echo "selected";}?> >Iraq</option>
<option value="Ireland" <?php if($_POST['country']=="Ireland"){ echo "selected";}?> >Ireland</option>
<option value="Isle of Man" <?php if($_POST['country']=="Isle of Man"){ echo "selected";}?> >Isle of Man</option>
<option value="Israel" <?php if($_POST['country']=="Israel"){ echo "selected";}?> >Israel</option>
<option value="Italy" <?php if($_POST['country']=="Italy"){ echo "selected";}?> >Italy</option>
<option value="Jamaica" <?php if($_POST['country']=="Jamaica"){ echo "selected";}?> >Jamaica</option>
<option value="Japan" <?php if($_POST['country']=="Japan"){ echo "selected";}?> >Japan</option>
<option value="Jordan" <?php if($_POST['country']=="Jordan"){ echo "selected";}?> >Jordan</option>
<option value="Kazakhstan" <?php if($_POST['country']=="Kazakhstan"){ echo "selected";}?> >Kazakhstan</option>
<option value="Kenya" <?php if($_POST['country']=="Kenya"){ echo "selected";}?> >Kenya</option>
<option value="Kiribati" <?php if($_POST['country']=="Kiribati"){ echo "selected";}?> >Kiribati</option>
<option value="Korea North" <?php if($_POST['country']=="Korea North"){ echo "selected";}?> >Korea North</option>
<option value="Korea South" <?php if($_POST['country']=="Korea South"){ echo "selected";}?> >Korea South</option>
<option value="Kuwait" <?php if($_POST['country']=="Kuwait"){ echo "selected";}?> >Kuwait</option>
<option value="Kyrgyzstan" <?php if($_POST['country']=="Kyrgyzstan"){ echo "selected";}?> >Kyrgyzstan</option>
<option value="Laos" <?php if($_POST['country']=="Laos"){ echo "selected";}?> >Laos</option>
<option value="Latvia" <?php if($_POST['country']=="Latvia"){ echo "selected";}?> >Latvia</option>
<option value="Lebanon" <?php if($_POST['country']=="Lebanon"){ echo "selected";}?> >Lebanon</option>
<option value="Lesotho" <?php if($_POST['country']=="Lesotho"){ echo "selected";}?> >Lesotho</option>
<option value="Liberia" <?php if($_POST['country']=="Liberia"){ echo "selected";}?> >Liberia</option>
<option value="Libya" <?php if($_POST['country']=="Libya"){ echo "selected";}?> >Libya</option>
<option value="Liechtenstein" <?php if($_POST['country']=="Liechtenstein"){ echo "selected";}?> >Liechtenstein</option>
<option value="Lithuania" <?php if($_POST['country']=="Lithuania"){ echo "selected";}?> >Lithuania</option>
<option value="Luxembourg" <?php if($_POST['country']=="Luxembourg"){ echo "selected";}?> >Luxembourg</option>
<option value="Macau" <?php if($_POST['country']=="Macau"){ echo "selected";}?> >Macau</option>
<option value="Macedonia" <?php if($_POST['country']=="Macedonia"){ echo "selected";}?> >Macedonia</option>
<option value="Madagascar" <?php if($_POST['country']=="Madagascar"){ echo "selected";}?> >Madagascar</option>
<option value="Malaysia" <?php if($_POST['country']=="Malaysia"){ echo "selected";}?> >Malaysia</option>
<option value="Malawi" <?php if($_POST['country']=="Malawi"){ echo "selected";}?> >Malawi</option>
<option value="Maldives" <?php if($_POST['country']=="Maldives"){ echo "selected";}?> >Maldives</option>
<option value="Mali" <?php if($_POST['country']=="Mali"){ echo "selected";}?> >Mali</option>
<option value="Malta" <?php if($_POST['country']=="Malta"){ echo "selected";}?> >Malta</option>
<option value="Marshall Islands" <?php if($_POST['country']=="Marshall Islands"){ echo "selected";}?> >Marshall Islands</option>
<option value="Martinique" <?php if($_POST['country']=="Martinique"){ echo "selected";}?> >Martinique</option>
<option value="Mauritania" <?php if($_POST['country']=="Mauritania"){ echo "selected";}?> >Mauritania</option>
<option value="Mauritius" <?php if($_POST['country']=="Mauritius"){ echo "selected";}?> >Mauritius</option>
<option value="Mayotte" <?php if($_POST['country']=="Mayotte"){ echo "selected";}?> >Mayotte</option>
<option value="Mexico" <?php if($_POST['country']=="Mexico"){ echo "selected";}?> >Mexico</option>
<option value="Midway Islands" <?php if($_POST['country']=="Midway Islands"){ echo "selected";}?> >Midway Islands</option>
<option value="Moldova" <?php if($_POST['country']=="Moldova"){ echo "selected";}?> >Moldova</option>
<option value="Monaco" <?php if($_POST['country']=="Monaco"){ echo "selected";}?> >Monaco</option>
<option value="Mongolia" <?php if($_POST['country']=="Mongolia"){ echo "selected";}?> >Mongolia</option>
<option value="Montserrat" <?php if($_POST['country']=="Montserrat"){ echo "selected";}?> >Montserrat</option>
<option value="Morocco" <?php if($_POST['country']=="Morocco"){ echo "selected";}?> >Morocco</option>
<option value="Mozambique" <?php if($_POST['country']=="Mozambique"){ echo "selected";}?> >Mozambique</option>
<option value="Myanmar" <?php if($_POST['country']=="Myanmar"){ echo "selected";}?> >Myanmar</option>
<option value="Nambia" <?php if($_POST['country']=="Nambia"){ echo "selected";}?> >Nambia</option>
<option value="Nauru" <?php if($_POST['country']=="Nauru"){ echo "selected";}?> >Nauru</option>
<option value="Nepal" <?php if($_POST['country']=="Nepal"){ echo "selected";}?> >Nepal</option>
<option value="Netherland Antilles" <?php if($_POST['country']=="Netherland Antilles"){ echo "selected";}?> >Netherland Antilles</option>
<option value="Netherlands" <?php if($_POST['country']=="Netherlands"){ echo "selected";}?> >Netherlands (Holland, Europe)</option>
<option value="Nevis" <?php if($_POST['country']=="Nevis"){ echo "selected";}?> >Nevis</option>
<option value="New Caledonia" <?php if($_POST['country']=="New Caledonia"){ echo "selected";}?> >New Caledonia</option>
<option value="New Zealand" <?php if($_POST['country']=="New Zealand"){ echo "selected";}?> >New Zealand</option>
<option value="Nicaragua" <?php if($_POST['country']=="Nicaragua"){ echo "selected";}?> >Nicaragua</option>
<option value="Niger" <?php if($_POST['country']=="Niger"){ echo "selected";}?> >Niger</option>
<option value="Nigeria" <?php if($_POST['country']=="Nigeria"){ echo "selected";}?> >Nigeria</option>
<option value="Niue" <?php if($_POST['country']=="Niue"){ echo "selected";}?> >Niue</option>
<option value="Norfolk Island" <?php if($_POST['country']=="Norfolk Island"){ echo "selected";}?> >Norfolk Island</option>
<option value="Norway" <?php if($_POST['country']=="Norway"){ echo "selected";}?> >Norway</option>
<option value="Oman" <?php if($_POST['country']=="Oman"){ echo "selected";}?> >Oman</option>
<option value="Pakistan" <?php if($_POST['country']=="Pakistan"){ echo "selected";}?> >Pakistan</option>
<option value="Palau Island" <?php if($_POST['country']=="Palau Island"){ echo "selected";}?> >Palau Island</option>
<option value="Palestine" <?php if($_POST['country']=="Palestine"){ echo "selected";}?> >Palestine</option>
<option value="Panama" <?php if($_POST['country']=="Panama"){ echo "selected";}?> >Panama</option>
<option value="Papua New Guinea" <?php if($_POST['country']=="Papua New Guinea"){ echo "selected";}?> >Papua New Guinea</option>
<option value="Paraguay" <?php if($_POST['country']=="Paraguay"){ echo "selected";}?> >Paraguay</option>
<option value="Peru" <?php if($_POST['country']=="Peru"){ echo "selected";}?> >Peru</option>
<option value="Phillipines" <?php if($_POST['country']=="Phillipines"){ echo "selected";}?> >Philippines</option>
<option value="Pitcairn Island" <?php if($_POST['country']=="Pitcairn Island"){ echo "selected";}?> >Pitcairn Island</option>
<option value="Poland" <?php if($_POST['country']=="Poland"){ echo "selected";}?> >Poland</option>
<option value="Portugal" <?php if($_POST['country']=="Portugal"){ echo "selected";}?> >Portugal</option>
<option value="Puerto Rico" <?php if($_POST['country']=="Puerto Rico"){ echo "selected";}?> >Puerto Rico</option>
<option value="Qatar" <?php if($_POST['country']=="Qatar"){ echo "selected";}?> >Qatar</option>
<option value="Republic of Montenegro" <?php if($_POST['country']=="Republic of Montenegro"){ echo "selected";}?> >Republic of Montenegro</option>
<option value="Republic of Serbia" <?php if($_POST['country']=="Republic of Serbia"){ echo "selected";}?> >Republic of Serbia</option>
<option value="Reunion" <?php if($_POST['country']=="Reunion"){ echo "selected";}?> >Reunion</option>
<option value="Romania" <?php if($_POST['country']=="Romania"){ echo "selected";}?> >Romania</option>
<option value="Russia" <?php if($_POST['country']=="Russia"){ echo "selected";}?> >Russia</option>
<option value="Rwanda" <?php if($_POST['country']=="Rwanda"){ echo "selected";}?> >Rwanda</option>
<option value="St Barthelemy" <?php if($_POST['country']=="St Barthelemy"){ echo "selected";}?> >St Barthelemy</option>
<option value="St Eustatius" <?php if($_POST['country']=="St Eustatius"){ echo "selected";}?> >St Eustatius</option>
<option value="St Helena" <?php if($_POST['country']=="St Helena"){ echo "selected";}?> >St Helena</option>
<option value="St Kitts-Nevis" <?php if($_POST['country']=="St Kitts-Nevis"){ echo "selected";}?> >St Kitts-Nevis</option>
<option value="St Lucia" <?php if($_POST['country']=="St Lucia"){ echo "selected";}?> >St Lucia</option>
<option value="St Maarten" <?php if($_POST['country']=="St Maarten"){ echo "selected";}?> >St Maarten</option>
<option value="St Pierre and Miquelon" <?php if($_POST['country']=="St Pierre and Miquelon"){ echo "selected";}?> >St Pierre &amp; Miquelon</option>
<option value="St Vincent and Grenadines" <?php if($_POST['country']=="St Vincent and Grenadines"){ echo "selected";}?> >St Vincent &amp; Grenadines</option>
<option value="Saipan" <?php if($_POST['country']=="Saipan"){ echo "selected";}?> >Saipan</option>
<option value="Samoa" <?php if($_POST['country']=="Samoa"){ echo "selected";}?> >Samoa</option>
<option value="Samoa American" <?php if($_POST['country']=="Samoa American"){ echo "selected";}?> >Samoa American</option>
<option value="San Marino" <?php if($_POST['country']=="San Marino"){ echo "selected";}?> >San Marino</option>
<option value="Sao Tome and Principe" <?php if($_POST['country']=="Sao Tome and Principe"){ echo "selected";}?> >Sao Tome &amp; Principe</option>
<option value="Saudi Arabia" <?php if($_POST['country']=="Saudi Arabia"){ echo "selected";}?> >Saudi Arabia</option>
<option value="Senegal" <?php if($_POST['country']=="Senegal"){ echo "selected";}?> >Senegal</option>
<option value="Serbia" <?php if($_POST['country']=="Serbia"){ echo "selected";}?> >Serbia</option>
<option value="Seychelles" <?php if($_POST['country']=="Seychelles"){ echo "selected";}?> >Seychelles</option>
<option value="Sierra Leone" <?php if($_POST['country']=="Sierra Leone"){ echo "selected";}?> >Sierra Leone</option>
<option value="Singapore" <?php if($_POST['country']=="Singapore"){ echo "selected";}?> >Singapore</option>
<option value="Slovakia" <?php if($_POST['country']=="Slovakia"){ echo "selected";}?> >Slovakia</option>
<option value="Slovenia" <?php if($_POST['country']=="Slovenia"){ echo "selected";}?> >Slovenia</option>
<option value="Solomon Islands" <?php if($_POST['country']=="Solomon Islands"){ echo "selected";}?> >Solomon Islands</option>
<option value="Somalia" <?php if($_POST['country']=="Somalia"){ echo "selected";}?> >Somalia</option>
<option value="South Africa" <?php if($_POST['country']=="South Africa"){ echo "selected";}?> >South Africa</option>
<option value="Spain" <?php if($_POST['country']=="Spain"){ echo "selected";}?> >Spain</option>
<option value="Sri Lanka" <?php if($_POST['country']=="Sri Lanka"){ echo "selected";}?> >Sri Lanka</option>
<option value="Sudan" <?php if($_POST['country']=="Sudan"){ echo "selected";}?> >Sudan</option>
<option value="Suriname" <?php if($_POST['country']=="Suriname"){ echo "selected";}?> >Suriname</option>
<option value="Swaziland" <?php if($_POST['country']=="Swaziland"){ echo "selected";}?> >Swaziland</option>
<option value="Sweden" <?php if($_POST['country']=="Sweden"){ echo "selected";}?> >Sweden</option>
<option value="Switzerland" <?php if($_POST['country']=="Switzerland"){ echo "selected";}?> >Switzerland</option>
<option value="Syria" <?php if($_POST['country']=="Syria"){ echo "selected";}?> >Syria</option>
<option value="Tahiti" <?php if($_POST['country']=="Tahiti"){ echo "selected";}?> >Tahiti</option>
<option value="Taiwan" <?php if($_POST['country']=="Taiwan"){ echo "selected";}?> >Taiwan</option>
<option value="Tajikistan" <?php if($_POST['country']=="Tajikistan"){ echo "selected";}?> >Tajikistan</option>
<option value="Tanzania" <?php if($_POST['country']=="Tanzania"){ echo "selected";}?> >Tanzania</option>
<option value="Thailand" <?php if($_POST['country']=="Thailand"){ echo "selected";}?> >Thailand</option>
<option value="Togo" <?php if($_POST['country']=="Togo"){ echo "selected";}?> >Togo</option>
<option value="Tokelau" <?php if($_POST['country']=="Tokelau"){ echo "selected";}?> >Tokelau</option>
<option value="Tonga" <?php if($_POST['country']=="Tonga"){ echo "selected";}?> >Tonga</option>
<option value="Trinidad and Tobago" <?php if($_POST['country']=="Trinidad and Tobago"){ echo "selected";}?> >Trinidad &amp; Tobago</option>
<option value="Tunisia" <?php if($_POST['country']=="Tunisia"){ echo "selected";}?> >Tunisia</option>
<option value="Turkey" <?php if($_POST['country']=="Turkey"){ echo "selected";}?> >Turkey</option>
<option value="Turkmenistan" <?php if($_POST['country']=="Turkmenistan"){ echo "selected";}?> >Turkmenistan</option>
<option value="Turks and Caicos Islands" <?php if($_POST['country']=="Turks and Caicos Islands"){ echo "selected";}?> >Turks &amp; Caicos Islands</option>
<option value="Tuvalu" <?php if($_POST['country']=="Tuvalu"){ echo "selected";}?> >Tuvalu</option>
<option value="Uganda" <?php if($_POST['country']=="Uganda"){ echo "selected";}?> >Uganda</option>
<option value="Ukraine" <?php if($_POST['country']=="Ukraine"){ echo "selected";}?> >Ukraine</option>
<option value="United Arab Erimates" <?php if($_POST['country']=="United Arab Erimates"){ echo "selected";}?> >United Arab Emirates</option>
<option value="United Kingdom" <?php if($_POST['country']=="United Kingdom"){ echo "selected";}?> >United Kingdom</option>
<option value="United States of America" <?php if($_POST['country']=="United States of America"){ echo "selected";}?> >United States of America</option>
<option value="Uraguay" <?php if($_POST['country']=="Uraguay"){ echo "selected";}?> >Uruguay</option>
<option value="Uzbekistan" <?php if($_POST['country']=="Uzbekistan"){ echo "selected";}?> >Uzbekistan</option>
<option value="Vanuatu" <?php if($_POST['country']=="Vanuatu"){ echo "selected";}?> >Vanuatu</option>
<option value="Vatican City State" <?php if($_POST['country']=="Vatican City State"){ echo "selected";}?> >Vatican City State</option>
<option value="Venezuela" <?php if($_POST['country']=="Venezuela"){ echo "selected";}?> >Venezuela</option>
<option value="Vietnam" <?php if($_POST['country']=="Vietnam"){ echo "selected";}?> >Vietnam</option>
<option value="Virgin Islands (Brit)" <?php if($_POST['country']=="Virgin Islands (Brit)"){ echo "selected";}?> >Virgin Islands (Brit)</option>
<option value="Virgin Islands (USA)" <?php if($_POST['country']=="Virgin Islands (USA)"){ echo "selected";}?> >Virgin Islands (USA)</option>
<option value="Wake Island" <?php if($_POST['country']=="Wake Island"){ echo "selected";}?> >Wake Island</option>
<option value="Wallis and Futana Islands" <?php if($_POST['country']=="Wallis and Futana Islands"){ echo "selected";}?> >Wallis &amp; Futana Islands</option>
<option value="Yemen" <?php if($_POST['country']=="Yemen"){ echo "selected";}?> >Yemen</option>
<option value="Zaire" <?php if($_POST['country']=="Zaire"){ echo "selected";}?> >Zaire</option>
<option value="Zambia" <?php if($_POST['country']=="Zambia"){ echo "selected";}?> >Zambia</option>
<option value="Zimbabwe" <?php if($_POST['country']=="Zimbabwe"){ echo "selected";}?> >Zimbabwe</option>
</select>
					<script>if(0!=document.getElementsByName('country')[0].selectedIndex){ document.getElementsByName('country')[0].setAttribute('class', 'field'); }</script>
				</div>
			</div>
			






			












		   <div class="row">
				<div class="col-sm-8 <?php if ($fehler["subject"] != "") { echo 'error'; } ?> <?php echo (isset($_POST['subject']) && ''!=$_POST['subject'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label" for="border-right8"><i id="subject-icon" class="fa fa-edit"></i></label>
					<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Subject" type="text" name="subject" class="field" placeholder="Subject *" value="<?php echo $_POST['subject']; ?>" maxlength="<?php echo $number_of_characters_subject; ?>" id="border-right8" onclick="setActive(this);" onfocus="setActive(this);"/>
					<?php if ($fehler["subject"] != "") { echo $fehler["subject"]; } ?>
				</div>
			</div>

			<div class="row">
				<div class="col-sm-8 <?php if ($fehler["message"] != "") { echo 'error'; } ?> <?php echo (isset($_POST['message']) && ''!=$_POST['message'] ? 'not-empty-field ' : ''); ?>">
					<label class="control-label textarea-label" for="border-right9"><i id="message-icon" class="fa fa-comment"></i></label>
					<textarea <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Message" name="message" class="field" rows="5" placeholder="Message *" style="height:100%;width:100%;" id="border-right9" onclick="setActive(this);" onfocus="setActive(this);"><?php echo $_POST['message']; ?></textarea>
					<?php if ($fehler["message"] != "") { echo $fehler["message"]; } ?>
				</div>
			</div>




		<?php
		// -------------------- FILEUPLOAD START ----------------------
			if(0<$cfg['NUM_ATTACHMENT_FIELDS']){
				echo '<div class="row upload-row" style="background-image: url(img/border-right.png);background-position: 2.90rem center;-webkit-text-size-adjust:none;background-repeat: no-repeat;">
						<div class="col-sm-8">
							<label class="control-label" for="upload_field"><i id="fileupload-icon" class="fa fa-upload"></i></label>';
				for ($i=0; $i < $cfg['NUM_ATTACHMENT_FIELDS']; $i++) {
							echo '<input aria-label="Fileupload" type="file" size=12 class="upload_font_size" name="f[]" id="upload_field" onclick="setActive(this);" onfocus="setActive(this);" />';
				}
				echo '	</div>
					</div>';
			}
		// -------------------- FILEUPLOAD END ----------------------
		?>






		<?php
		// -------------------- SPAMPROTECTION START ----------------------

		if($cfg['Honeypot']){ ?>
			<div style="height: 2px; overflow: hidden;">
				<label style="margin-top: 10px;">The following field must remain empty for the message to be sent!</label>
				<div style="margin-top: 10px;"><input type="email" name="mail" value="" /></div>
			</div>
		<?php }

		if($cfg['Time-out']){ ?>
			<input type="hidden" name="chkspmtm" value="<?php echo time(); ?>" />
		<?php }

		if($cfg['Click_check']){ ?>
			<input type="hidden" name="chkspmkc" value="chkspmbt" />
		<?php }


		if($cfg['Security_code']) { ?>
			<div class="row captcha-row <?php if ($fehler["captcha"] != "") { echo 'error_container'; } ?>" style="background-image: url('img/border-right.png');background-position: 2.90rem center;-webkit-text-size-adjust:none;background-repeat: no-repeat;">
				<div class="col-sm-8 <?php if ($fehler["captcha"] != "") { echo 'error'; } ?>">
					<label class="control-label" for="answer2"><i id="securitycode-icon" class="fa fa fa-unlock-alt"></i></label>
					<div>
						<img aria-label="Captcha" src="captcha/captcha.php" alt="Security_code" title="kontaktformular.com-Security_code" id="captcha" />
						<a href="javascript:void(0);" onclick="javascript:document.getElementById('captcha').src='captcha/captcha.php?'+Math.random();cursor:pointer;">
							<span class="captchareload"><i style="color:grey;" class="fas fa-sync-alt"></i></span>
						</a>
					</div>
					<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Input" id="answer2" placeholder="Security code *" type="text" name="sicherheitscode" maxlength="150"  class="field<?php if ($fehler["captcha"] != "") { echo ' errordesignfields'; } ?>" onclick="setActive(this);" onfocus="setActive(this);" />
					<?php if ($fehler["captcha"] != "") { echo $fehler["captcha"]; } ?>
				</div>
			</div>
		  

		<?php }

		if($cfg['Security_question']) { ?>
		  
			<div class="row question-row <?php if ($fehler["q_id12"] != "") { echo 'error_container'; } ?>" style="background-image: url('img/border-right.png');background-position: 2.90rem center;-webkit-text-size-adjust:none;background-repeat: no-repeat;">
				<div class="col-sm-8 <?php if ($fehler["q_id12"] != "") { echo 'error'; } ?>">
					<label class="control-label" for="answer"><i id="securityquestion-icon" class="fa fa fa-unlock-alt"></i></label>
					<div aria-label="Answer">
						<?php echo $q[1]; ?>
						<input type="hidden" name="q_id" value="<?php echo $q[0]; ?>"/>
					</div>					
					<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Answer" id="answer" placeholder="Answer *" type="text" class="field<?php if ($fehler["q_id12"] != "") { echo ' errordesignfields'; } ?>" name="q" onclick="setActive(this);" onfocus="setActive(this);" />
					<?php if ($fehler["q_id12"] != "") { echo $fehler["q_id12"]; } ?>
				</div>
			</div>
		  
		  

		<?php } 

		// -------------------- SPAMPROTECTION END ----------------------
		{ ?>






		<?php }
		
				// -------------------- MAIL-COPY START ----------------------

		if(1==$cfg['Send_copy']) { ?>
			<div class="row checkbox-row" style="background-image: url('img/border-right.png');background-position: 2.90rem center;-webkit-text-size-adjust:none;background-repeat: no-repeat;">
				<div class="col-sm-8 <?php echo (isset($_POST['mail-copy']) && ''!=$_POST['mail-copy'] ? 'not-empty-field ' : ''); ?>">
					<label for="inlineCheckbox11" class="control-label"><i id="mailcopy-icon" class="fa fa-envelope"></i></label>
					<label class="checkbox-inline">
						<input aria-label="Send copy" type="checkbox" id="inlineCheckbox11" name="mail-copy" value="1" <?php if (isset($_POST['mail-copy']) && $_POST['mail-copy']=='1') echo(' checked="checked" '); ?> onclick="setActive(this);" onfocus="setActive(this);" > <div style="padding-top:3px;padding-bottom:4px;"><span>Send a copy of the message by email</span></div>
					</label>
				</div>
			</div>
		<?php } 

		// -------------------- MAIL-COPY END ----------------------
		
		
		// -------------------- DATAPROTECTION START ----------------------

		if($cfg['Data_privacy_policy']) { ?>
			<div class="row checkbox-row <?php if ($fehler["data_protection"] != "") { echo 'error_container'; } ?>" style="background-image: url('img/border-right.png');background-position: 2.90rem center;-webkit-text-size-adjust:none;background-repeat: no-repeat;">
				<div class="col-sm-8 <?php if ($fehler["data_protection"] != "") { echo 'error'; } ?> <?php echo (isset($_POST['data_protection']) && ''!=$_POST['data_protection'] ? 'not-empty-field ' : ''); ?>">
					<label for="inlineCheckbox12" class="control-label"><i id="dataprotection-icon" class="fas fa-user-shield "></i></label>
					<label class="checkbox-inline">
						<input <?php if($cfg['HTML5_error_messages']) { ?> required <?php }else{ ?> onchange="checkField(this)" <?php } ?> aria-label="Data protection" type="checkbox" id="inlineCheckbox12" name="data_protection" value="accepted" <?php if ($_POST['data_protection']=='accepted') echo(' checked="checked" '); ?> onclick="setActive(this);" onfocus="setActive(this);" ><div style="padding-top:3px;padding-bottom:4px;"> <a href="<?php echo "$dataprivacypolicy"; ?>" target="_blank">I accept the data privacy policy.</a> *</div>
					</label>
					<?php if ($fehler["data_protection"] != "") { echo $fehler["data_protection"]; } ?>
				</div>
			</div>
		<?php } 

		// -------------------- DATAPROTECTION END ----------------------
		 
		 ?>
		 
		 
<hr style="height:0.10rem; border:none; color:#DADADA; background-color:#DADADA; margin-top:40px;" />

			<div class="row" id="send">
			<div class="col-sm-8">
						
			<div class="required_notice">
					<span style="line-height:23px;font-size:16px;"><b>Note:</b> Fields marked with * are required.</span>
					</div>
					
					<button type="submit" class="senden <?= $buttonClass ?>" name="kf-km" id="submitButton">
                  

                    <span class="label">Send Message</span>  <svg class="loading-spinner" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24">
                        <circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor"
                                stroke-width="4"></circle>
                        <path class="opacity-75" fill="currentColor"
                              d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"></path>
                    </svg>
                </button>

	
            </div>

              

        </div>
 
<?php if ($cfg['Loading_Spinner']): ?>
<script type="text/javascript">
            document.addEventListener("DOMContentLoaded", () => {
                const element = document.getElementById("submitButton");
                
            });          
            document.querySelector('.senden').addEventListener('click', function() {
            var form = document.getElementById('kontaktformular'); 
            if (form.checkValidity()) {
            this.classList.add('loading');
            this.style.backgroundColor = '#A6A6A6';  
            } else {
            console.log('');
    }
});
        </script>
        
        
        
    
        
<script type="text/javascript">document.addEventListener("DOMContentLoaded", () => {
    const form = document.getElementById('kontaktformular');

    form.addEventListener('submit', function (event) {
        event.preventDefault(); // Prevent default form submission

        const submitButton = document.getElementById('submitButton');
        const submitButtonLabel = submitButton.querySelector('.label');
        const loadingSpinner = submitButton.querySelector('.loading-spinner');

        // Hide the text and display the spinner.
        submitButtonLabel.style.display = 'none';
        loadingSpinner.style.display = 'block';

        submitButton.disabled = true;

        // Simulate the loading process and submit the form after one second.
        setTimeout(() => {
            form.submit(); // Perform the actual form submission after 1 second.
        }, 1000);
    });
});

</script>
    
    
        
        
    
<?php endif; ?>
		 
<?php if ($cfg['Success_message']): ?>
<script>
 

    
    // Check if the "finished" class is active.
  var isFinished = document.querySelector('.senden').classList.contains('finished');

  // Change the label accordingly.
  if (isFinished) {
  var submitButton = document.getElementById('submitButton');
  submitButton.innerHTML = '<span class="label_finished">Message sent</span>';
  
}

  
</script>
        <?php endif; ?>



        <?php if ($cfg['Click_check']) { ?>
			<script type="text/javascript">
				function chkspmkcfnk(){
					document.getElementsByName('chkspmkc')[0].value = 'chkspmhm';
				}
				document.getElementsByName('kf-km')[0].addEventListener('mouseenter', chkspmkcfnk);
				document.getElementsByName('kf-km')[0].addEventListener('touchstart', chkspmkcfnk);
			</script>
		<?php } ?>
			<script type="text/javascript">
				// set class kontaktformular-validate for form if user wants to send the form > so the invalid-styles only appears after validation
				function setValidationStyles(){
					document.getElementById('kontaktformular').setAttribute('class', 'kontaktformular kontaktformular-validate');
				}
				document.getElementsByName('kf-km')[0].addEventListener('click', setValidationStyles);
				document.getElementById('kontaktformular').addEventListener('submit', setValidationStyles);
			</script>
		<?php if(!$cfg['HTML5_error_messages']) { ?>
			<script type="text/javascript">
				// set class kontaktformular-validate for form if user wants to send the form > so the invalid-styles only appears after validation
				function checkField(field){
					if(''!=field.value){
						
						// if field is checkbox: go to parentNode and do things because checkbox is in label-element
						if('checkbox'==field.getAttribute('type')){
							field.parentNode.parentNode.classList.remove("error");						
							field.parentNode.nextElementSibling.style.display = 'none';
						}
						// field is no checkbox: do things with field
						else{
							field.parentNode.classList.remove("error");
							field.nextElementSibling.style.display = 'none';
						}
						
						// remove class error_container from parent-elements
						field.parentNode.parentNode.parentNode.classList.remove("error_container");
						field.parentNode.parentNode.classList.remove("error_container");
						field.parentNode.classList.remove("error_container");	
					}
				}
			</script>
		<?php } ?>
		<script>
				// --------------------- field active / inactive

				// set active-class to field 
				function setActive(element){

					
					// set onblur-function to set field inactive
					element.focus();
					element.setAttribute('onblur', 'setInactive(this)');
					
					// set active-class to parent-div
					var parentDiv = getParentDiv(element);
					
					// if field is security-row: go to parentNode and do things
					if(
						parentDiv.classList.contains('question-input-div') ||
						parentDiv.classList.contains('captcha-input-div')
					){
						parentDiv.parentNode.classList.add('active-field');
					}
					// field is no security-row: do things with field
					else{
						parentDiv.classList.add('active-field');				
					}
					
					// field is a selectBox > mark selected option
					if(element.classList.contains('select-input') && ''!=element.value){
						var selectBox = getSiblingUl(element);
						var selectBoxOptions = selectBox.childNodes;
						for (i = 0; i < selectBoxOptions.length; ++i) {
							if('li'==selectBoxOptions[i].nodeName.toLowerCase()){
								if(element.value==selectBoxOptions[i].innerHTML){
									selectBoxOptions[i].classList.add('active');
								}
								else{
									selectBoxOptions[i].classList.remove('active');
								}
							}							
						}
					}
				}
				
				// set field inactive
				function setInactive(element){

					// remove active-class from parent-div
					var parentDiv = getParentDiv(element);
					
					// if field is security-row: go to parentNode and do things
					if(
						parentDiv.classList.contains('question-input-div') ||
						parentDiv.classList.contains('captcha-input-div')
					){
						parentDiv.parentNode.classList.remove('active-field');
					}
					// field is no security-row: do things with field
					else{
						parentDiv.classList.remove('active-field');				
					}
					
					// field contains string > set not-empty-class
					if(''!=element.value){
						parentDiv.classList.add('not-empty-field');
					}
					// field doesn't contain string > remove not-empty-class
					else{
						parentDiv.classList.remove('not-empty-field');
					}
				}
				// --------------------- helper
				
				// get the closest parent-div
				function getParentDiv(element) {
					while(element && element.parentNode){
						element = element.parentNode;
						if(element.tagName && 'div'==element.tagName.toLowerCase()){
							return element;
						}
					}
					return null;
				}
				
				
			</script>		
					
					
		</form>
	</div>
<!-- This copyright notice must not be removed. -->
<br />
<div style="display: flex;justify-content: center;align-items: center;padding-right:5%;padding-left:5%;margin-top:2px;">

<div style="border: 1px solid #ccc; margin: 0;box-sizing: border-box;display: inline-block;line-height: 0.3;vertical-align: top;padding-bottom:7.5px;padding-right:5px;padding-left:5px;">
						<br /><br /><a href="https://www.kontaktformular.com/en" title="kontaktformular.com" style="text-decoration: none;color:#000000;font-size:13px;line-height: 20px;" target="_blank">&copy; by kontaktformular.com - All rights reserved.</a>
</div>
</div>
<!-- This copyright notice must not be removed. -->
	
</body>
</html>