File: D:/HostingSpaces/SBogers10/promic.komma.pro/wwwroot/english/kms/afmelden_nieuwsbrief.php
<?php
session_start();
header("Content-Type: text/html; charset=UTF-8");
include("connect.php");
if (isset($_POST['verzenden']))
{
$verzenden = "true";
}
if (isset($_POST['emailadres']))
{
$emailadres=$_POST['emailadres'];
$emailadres=strtolower($emailadres);
if(ereg("^[a-z0-9_.-]*@[a-z0-9_.-]*[.][a-z]*([.][a-z]*)?$",$emailadres)){
$valid_mail = "true";
}
};
if (isset($_POST['verzenden']) && $valid_mail == "true"){
$datumin = date("d-m-Y");
$query = "SELECT * FROM emailadressen WHERE emailadres ='$emailadres'";
$result2 = mysql_query($query);
$record2 = mysql_fetch_assoc($result2);
$aanhef = $record2['aanhef'];
$achternaam = $record2['achternaam'];
$data_mailadres = $record2['emailadres'];
$code = $record2['code'];
if($result2){
if($data_mailadres != $emailadres){
$getest = false;
}else{
$adminaddress = "info@promic.nl";
$onderwerp = "Sign out news letter Promic.nl";
$link = "http://www.promic.nl/english/kms/deactivatie_nieuwsbrief.php?EMAIL=".$emailadres."&CODE=".$code."";
$van = "FROM:$adminaddress";
$bericht = "\n
Dear $aanhef $achternaam,
We are sorry to see you’ve decided to sign out for our News Letter.
You can always sign-in again at our website if you prefer to receive our News Letter again.
Please click the link below to actually sign out for our News Letter and same time,
to verify your email address. In case the link does not work,
please copy the URL and paste it into a new browser window.
$link
In case you’ve received this message unsolicited, another user probably used your email
address when signing out for another account. As long as you do not click the link,
your sign-out request is NOT completed, so signing out will not take place.
With kind regards,
Promic B.V.
Kluttershoek 7
6027 PT Soerendonk
The Netherlands";
function mail_utf8($to, $subject = '(No subject)', $message = '', $header = '') {
$header_ = 'MIME-Version: 1.0' . "\r\n" . 'Content-type: text/plain; charset=UTF-8' . "\r\n";
$send_message = mail($to, '=?UTF-8?B?'.base64_encode($subject).'?=', $message, $header_ . $header);
if ($send_message) {
$_SESSION['geslaagd'] = "goed";
}else{
$_SESSION['geslaagd'] = "fout";
}
}
mail_utf8($emailadres, $onderwerp, $bericht, $van);
$_SESSION['aanhef'] =$aanhef;
$_SESSION['achternaam'] =$achternaam;
$_SESSION['emailadres'] = $emailadres;
header("Location: bedankt_afmelden_nieuwsbrief.php");
exit();
}
}else{
$_SESSION['aanhef'] = "sir/madam";
$_SESSION['geslaagd'] = "fout";
header("Location: bedankt_afmelden_nieuwsbrief.php");
exit();
}
}
//-----------------------------------------------
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="myKMS.css" rel="stylesheet" type="text/css" />
<title>Sign out news letter</title>
</head>
<body bgcolor="#FFFFFF" class="style1">
<center><div id="logo"><p><br /><a href="http://www.promic.nl" target="_blank"><img src="promic_logo.jpg" alt="Promic B.V." width="250" height="80" border="0"/></a></p></div></center>
<div id="vlakvlak"><div id="vlak"><div id="vlak2">
<table width="850" border="0">
<form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"/>
<tr>
<td width="262" scope="col"> </td>
<th width="308" scope="col"><strong>Please fill up the email address that is being used for your personal account:</strong></th>
<th width="280" scope="col"> </th>
</tr>
<tr>
<td scope="col"><span class="style1"><strong></strong></span></td>
<td><input name="emailadres" type="text" id="emailadres" class="style2" value = "<?php print($emailadres) ?>" size="46"/></td>
<td><?php if ($verzenden == "true" && $valid_mail != "true"){
print ("Please fill up your email address correctly");
}
if($getest == false && $valid_mail == "true"){
print("You’ve filled up a wrong email address, or an email address that does not exist in our data system.");
}?></td>
</tr>
<tr><td><br /></td><td><br /></td></tr>
<tr>
<td></td>
<td><center><input type="submit" name="verzenden" id="verzenden" value="Sign out news letter" /></center></td>
</tr>
</form>
</div></div></div>
</body>
</html>