File: D:/HostingSpaces/SBogers10/promic.komma.pro/wwwroot/es/forgot_password.php
<?php
if (isset($_POST['emailadres'])){ $verzenden = true; }
if(isset($_POST['emailadres']) && !preg_match('/[\w-\.]+@([\w-]+\.)+[\w-]{2,4}/', $_POST['emailadres'])){
$valid_emailadres = false;
$emailadres = $_POST['emailadres'];
$emailadres = trim($emailadres);
}else{
$emailadres = $_POST['emailadres'];
$emailadres = trim($emailadres);
$lengte_emailadres = strlen($emailadres);
$emailadres = strtolower($emailadres);
$emailadres = checkData($emailadres);
$q_emailadres = "SELECT emailadres FROM accounts WHERE emailadres ='$emailadres'";
$r_emailadres = mysql_query($q_emailadres);
$rec_emailadres = mysql_fetch_assoc($r_emailadres);
$data_mailadres = $rec_emailadres['emailadres'];
if($data_mailadres == $emailadres){ $alGeregistreerd = true; }else{ $alGeregistreerd = false; }
if($lengte_emailadres < 250 && $alGeregistreerd){
$valid_emailadres = true;
}else{
$valid_emailadres = false;
}
}
if($verzenden && $valid_emailadres){
$datumin = date("Y-m-d");
$query = "SELECT * FROM accounts WHERE emailadres ='$emailadres'";
$result2 = mysql_query($query) or die(mysql_error());
$record2 = mysql_fetch_assoc($result2);
$achternaam = html_entity_decode($record2['achternaam']);
$aanhef = $record2['aanhef'];
$data_mailadres = $record2['emailadres'];
$id = $record2['account_id'];
$code = $record2['code'];
$hash = sha1($data_mailadres.$code);
if($result2){
$link_user= "http://www.promic.nl/en/account-password/?i=" . $id. "&h=" . $hash;
$bericht = "
<body style=\"margin: 10px; background-color:#fff;\" >
<style>
a{
color:#F7750B;
text-decoration:underline;
}
</style>
<div style=\"color:#231f20; font-family:Verdana,Geneva,sans-serif; font-size:11px; line-height:18px; padding-bottom:23px; width: 800px;\">
Dear $aanhef $achternaam,<br><br>
You, or someone else using your email address, informed us that some of the <br>
required log-in data for your personal account has been lost. <br><br>
Please click the link below to enter your new password.<br>
In case the link does not work, please copy the URL and paste it into a new browser window.<br><br>
$link_user <br><br>
We hope your Promic account will be useful to you, and we wish you good business!!<br><br>
With kind regards,<br>
Promic B.V.<br><br>
Platinastraat 34<br>
6031 TW Nederweert<br>
The Netherlands
</div>
</body>";
$send_message = false;
$from = "info@promic.com";
$from_naam = "Promic B.V.";
$onderwerp = "Account data Promic.com";
require_once '../css-js/phpmailer/class.phpmailer.php';
$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($emailadres);
$mail->SetFrom($from, $from_naam);
$mail->AddReplyTo($from, $from_naam);
$mail->Subject = $onderwerp;
$mail->MsgHTML($bericht);
$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) {
$statusVerwerking = "geslaagd";
}else{
$statusVerwerking = "gefaald";
}
}
}
if(empty($statusVerwerking)){ ?>
<div id="systeemFormulier">
<h1>Forgot your password?</h1>
<?php if($verzenden){ ?><div class="foutmelding">Por favor, entre sus datos correctamente.</div><?php } ?>
<form id="aanmeldenAccount" class="en" name="aanmeldenAccount" action="<?php $_SERVER['PHP_SELF']; ?>" method="post"/>
<input id="emailadres" name="emailadres" <?php if($verzenden && !$valid_emailadres){ echo("class=\"error\""); }?> type="text" value="<?php if(!empty($emailadres)){ echo($emailadres); }else{ echo("E-mail address"); } ?>" />
<?php
if ($verzenden == true && !$alGeregistreerd){ ?>
<div class="foutmelding">You’ve filled up a wrong email address, or an email address that does not exist in our data system. Please try again.</div>
<?php } ?>
<a id="systeemFormulierSubmit" class="ctaButton ctaBlack animationBlack">
<span class="left"><span class="text">Request password</span><span class="up"></span><span class="hover"></span></span>
<span class="right"><span class="icon arrowRight"></span><span class="up"></span><span class="hover"></span></span>
</a>
</form>
</div>
<div id="fullVerticalLine"><div class="line"></div></div>
<div id="systeemFormulierRight">
<p>Please enter your e-mail address here to recover your account.</p>
</div>
<?php }else if($statusVerwerking == "geslaagd"){ ?>
<div id="systeemFormulier">
<h1>Forgot your password?</h1>
<p><strong>Dear <?php echo($aanhef." ". $achternaam); ?>,</strong><br /><br />
An email will be send to you. More information has been send to <strong><?php echo($emailadres); ?></strong>.
<br /><br />With kind regards,
<br />Promic B.V.</p>
</div>
<?php }else if($statusVerwerking == "gefaald"){ ?>
<div id="systeemFormulier">
<h1>Forgot your password?</h1>
<p>Apparently, some failures occurred during registration. Unfortunately, it is not possible to send data at this moment. <br />Please try again. If these problems appear more often, please contact us by email at <a href="mailto:info@promic.com">info@promic.com</a>.
<br />Please accept our apologies for any inconvenience.</p>
</div>
<?php } ?>