HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/vangogh.komma-mediadesign.nl/wwwroot/contactformVerzenden.php
<?php

include("all_kms_con.php");

$datum = date("d.m.y");
$tijd = date("H:i:s");  

if(isset($_POST['secretcode'])){
	$secretcode = $_POST['secretcode'];
	if($secretcode == "spamcheckkomma"){
		$valid_secretcode = true;
	}else{
		$valid_secretcode = false;
	}
}else{
	$valid_secretcode = false;
}

if(isset($_POST['naam'])){
	$naam = $_POST['naam'];
}
if(isset($_POST['bedrijfsnaam'])){
	$bedrijfsnaam = $_POST['bedrijfsnaam'];
}
if(isset($_POST['bericht'])){
	$bericht = $_POST['bericht'];
}

if(isset($_POST['telefoon'])){
	$telefoon = $_POST['telefoon'];
	$telefoon = trim($telefoon);
	$telefoon = str_replace("-","",$telefoon);
	$telefoon = str_replace(" ","",$telefoon);
	$telefoon = str_replace("+","00",$telefoon);
	$valid_telefoon = true;
}else{
	$valid_telefoon = false;
}

if(isset($_POST['email']) && !preg_match('/[\w-\.]+@([\w-]+\.)+[\w-]{2,4}/', $_POST['email'])){ 
	$valid_emailadres = false;
	$emailadres = $_POST['email'];
}else{
	$valid_emailadres = true;
	$emailadres = $_POST['email'];
}
if(!empty($naam) && $valid_telefoon && $valid_emailadres && !empty($bericht) && $valid_secretcode){
	
	$datum = date("Y-m-d");
	$tijd = date("H:i:s");
	
	$datum = date_dutch($datum);   
	
	require_once 'css-js/phpmailer/class.phpmailer.php';

	$bericht_klant = "\n
	
<body style=\"margin: 10px; background-color:#fff;\">
<style>
a{
	color:#0066ff;
	text-decoration:underline;
}
</style>
<div style=\"color:#636363; font-family:Verdana,Geneva,sans-serif; font-size:11px; line-height:18px; padding-bottom:23px; width: 800px;\">
<strong>Beste Willem,</strong><br><br>

Bij deze de gegevens van een persoon die het contactformulier op de website heeft ingevuld.<br>
Ingevuld op $datum om $tijd<br><br>

<strong>Contactgegevens: </strong><br>
Naam:		&#09; &#09; 	$naam<br>
Bedrijfsnaam:	&#09; 	$bedrijfsnaam<br>
Telefoonnummer:	&#09;  	$telefoon<br>
E-mailadres:	&#09;&#09;  	$emailadres<br>
Bericht:	&#09;&#09;  	$bericht<br><br>

Met vriendelijke groet,<br>
Komma Management System<br><br>
</div>
</body>";

	$send_message = false;
	
	$from = "info@komma-mediadesign.nl";
	$from_naam = "Komma Mediadesign";
	$onderwerp = "Contactformulier website";
	
	$mail = new PHPMailer(true); //defaults to using php "mail()"; the true param means it will throw exceptions on errors, which we need to catch

	try {
		$mail->AddReplyTo($from , $from_naam);
		$mail->AddAddress($from, $from_naam);
		$mail->SetFrom($from, $from_naam);
		$mail->AddReplyTo($from, $from_naam);
		$mail->Subject = $onderwerp;
		$mail->MsgHTML($bericht_klant);
		$mail->Send();
		$send_message = true;
	} catch (phpmailerException $e) {
		$send_message = false;
		echo $e->errorMessage(); //Pretty error messages from PHPMailer
	} catch (Exception $e) {
		$send_message = false;
		echo $e->getMessage(); //Boring error messages from anything else!
	}

	if(!$send_message){ 
	
		include("all_kms_con.php");
	
		$naam = checkData($naam);
		$telefoon = checkData($telefoon);
		$bericht_klant = checkData($bericht_klant);
		
		$q_log = "INSERT INTO kms_belme_log (naam, telefoonnummer, bericht, datum, tijd) VALUES ('$naam', '$telefoon', '$bericht_klant', '$datum', '$tijd')"; 

		$r_log = mysql_query($q_log);
	}
	
}?>