208 lines
6.6 KiB
PHP
208 lines
6.6 KiB
PHP
<?php
|
|
include('include/entete.php');
|
|
|
|
include('config/config.inc.php');
|
|
include('config/lib.inc.php');
|
|
|
|
|
|
if(isset($_POST['action']) && $_POST['action']=='go_mdp'){
|
|
|
|
foreach($_POST as $cle=>$val) $$cle=$val;
|
|
|
|
$maCleDeCryptage = getCleDeCryptage();
|
|
$email_cap2=crypter($maCleDeCryptage,$email_recov);
|
|
|
|
$affich='';
|
|
|
|
$query="select * from capitaines where email_cap=:email_cap";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
$data=$queryRequest->fetchAll();
|
|
$id=$data[0]['id_cap'];
|
|
$new_mdp=Password(8,0);
|
|
$query="update capitaines set mdp_cap=:new_mdp where id_cap=:id";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':new_mdp', md5($new_mdp), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id', $id, PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
|
|
$affich.='<table cellpadding="3" style="font-family:ARIAL; width:600px;">';
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"><img src="" /></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"><img src="cid:bando" alt="" width="600" height="150" border="0" /></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Bonjour,</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Veuillez trouver ci-dessous votre nouveau mot de passe <b>Capitaine</b> pour le site DECIDAY.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"><a href="http://deciday.fr/connexion-cfa.php">http://deciday.fr/connexion-cfa.php</a></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Votre nouveau mot de passe : </td><td>'.$new_mdp.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Cordialement.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">L\'équipe DECIDAY.</td>';
|
|
$affich.='</tr>'."\n";
|
|
|
|
$affich.='</table>';
|
|
|
|
}
|
|
|
|
$query="select * from eta where email_ref=:email_cap";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':email_cap', $email_cap2, PDO::PARAM_STR );
|
|
$queryRequest->execute();
|
|
$test=$queryRequest->rowCount();
|
|
if($test>0){
|
|
$data=$queryRequest->fetchAll();
|
|
$id=$data[0]['id_eta'];
|
|
$new_mdp=Password(8,0);
|
|
$query="update eta set mdp_ref=:new_mdp where id_eta=:id";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':new_mdp', md5($new_mdp), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id', $id, PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
|
|
$affich.='<table cellpadding="3" style="font-family:ARIAL;">';
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"><img src="" /></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"><img src="cid:bando" alt="" width="600" height="150" border="0" /></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Bonjour,</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Veuillez trouver ci-dessous votre nouveau mot de passe <b>Référent</b> pour le site DECIDAY.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"><a href="http://deciday.fr/connexion-cfa.php">http://deciday.fr/connexion-cfa.php</a></td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td align="right">Votre nouveau mot de passe : </td><td>'.$new_mdp.'</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">Bien cordialement.</td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2"> </td>';
|
|
$affich.='</tr>'."\n";
|
|
$affich.='<tr>';
|
|
$affich.='<td colspan="2">L\'équipe DECIDAY.</td>';
|
|
$affich.='</tr>'."\n";
|
|
|
|
$affich.='</table>';
|
|
|
|
}
|
|
|
|
if(!empty($affich)){
|
|
|
|
require 'config/class.phpmailer.php';
|
|
require 'config/phpmailer.settings.php';
|
|
|
|
$to=$email_recov;
|
|
$objet="Votre nouveau mot de passe pour le site DECIDAY";
|
|
|
|
|
|
$mail->IsHTML(true);
|
|
$mail->AddEmbeddedImage('images/bandeau-contact.jpg', 'bando', 'bandeau-contact.jpg');
|
|
$mail->Subject = utf8_decode($objet);
|
|
$mail->Body = utf8_decode($affich);
|
|
$mail->AddAddress($to);
|
|
//$mail->AddBCC('deciday@fafih.com');
|
|
$mail->AltBody = "/-------//--------/";
|
|
$mail->send();
|
|
|
|
$_SESSION['msg']='Un message va vous être envoyé avec votre nouveau mot de passe.';
|
|
header('location:connexion-cfa.php');
|
|
exit();
|
|
|
|
}else{
|
|
|
|
$_SESSION['msg']='L\'e-mail est inconnu.';
|
|
header('location:connexion-cfa.php');
|
|
exit();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
if(isset($_POST['action']) && $_POST['action']=='go_first'){
|
|
foreach($_POST as $cle=>$val) $$cle=$val;
|
|
|
|
if(isset($_SESSION['cfa_num']) && !empty($_SESSION['cfa_num'])){
|
|
$query = 'select * from eta where id_eta=:id_eta';
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':id_eta', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
if($queryRequest->rowCount()!=1){
|
|
header('location:connexion-cfa.php');
|
|
exit();
|
|
}
|
|
$query="update eta set mdp_ref=:new_mdp, date_co=:date_co where id_eta=:id";
|
|
$db = connect_base();
|
|
$queryRequest = $db->prepare( $query );
|
|
$queryRequest->bindParam( ':new_mdp', md5($mdp_first), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':date_co', date('Y-m-d'), PDO::PARAM_STR );
|
|
$queryRequest->bindParam( ':id', $_SESSION['cfa_num'], PDO::PARAM_INT );
|
|
$queryRequest->execute();
|
|
$_SESSION['msg']='Votre nouveau mot de passe a bien été enregsitré.';
|
|
header('location:connexion-cfa.php');
|
|
exit();
|
|
}
|
|
|
|
header('location:connexion-cfa.php');
|
|
exit();
|
|
}
|
|
?>
|