1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
| <?PHP
if(isset($_POST['email1']) && isset($_POST['email2'])){
//récupération du formulaire
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
//On verifie si l'email est valide
if(filter_var($email1, FILTER_VALIDATE_EMAIL));
else
{
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: 0.9,
minWidth: 400 ,
height: 120,
position: [480,350],
});
});
setTimeout( function() {
window.location.href = ("http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/passe_perdu.php");
}, 5000 );
</script>';
echo'<div id="dialog" style="display:none;font-size:10px;" title="Erreur courreil"><img src="design/1.gif" width="24" height="24" border="0"><br />
<center><b>Votre premier adresse <br/> courreil n\' est pas valide!!!!</b></center></div>';
return FALSE;}
//On verifie si l'email_2 est valide
if(filter_var($email2, FILTER_VALIDATE_EMAIL));
else{
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: 0.9,
minWidth: 400 ,
height: 120,
position: [480,350],
});
});
setTimeout( function() {
window.location.href = ("http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/passe_perdu.php");
}, 5000 );
</script>';
echo'<div id="dialog" style="display:none;font-size:10px;" title="Erreur courreil"><img src="design/1.gif" width="24" height="24" border="0"><br />
<center><b>Votre deuxième adresse <br/> courreil n\' est pas valide!!!!</b></center></div>';
return FALSE;}
//On verifie les deux email si elle dont égale
if($email1==$email2);
else{
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: 0.9,
minWidth: 400 ,
height: 120,
position: [480,350],
});
});
setTimeout( function() {
window.location.href = ("http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/passe_perdu.php");
}, 5000 );
</script>';
echo'<div id="dialog" style="display:none;font-size:10px;" title="Erreur courreil"><img src="design/1.gif" width="24" height="24" border="0"><br />
<center><b>Vos adresse <br/> courreil ne sont pas les même!!!!</b></center></div>';
return FALSE;}
$_SESSION['security_code'] = $_POST['security_code'];
if( $_SESSION['security_code'] == $_POST['security_code'] && !empty($_SESSION['security_code'] ) ) {
// Insert you code for processing the form here, e.g emailing the submission, entering it into a database.
unset($_SESSION['security_code']);
} else {
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: 0.9,
minWidth: 400 ,
height: 120,
position: [480,350],
});
});
setTimeout( function() {
window.location.href = ("http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/passe_perdu.php");
}, 5000 );
</script>';
echo'<div id="dialog" style="display:none;font-size:10px;" title="Erreur security_code"><img src="design/1.gif" width="24" height="24" border="0"><br />
<center><b>Le code de sécurité <br/> n\'est pas valable!!!!</b></center></div>';
}
// Controle de l'adresse mail si elle est dans la base de donnée
$reponse = $connection->prepare('SELECT * FROM comptes WHERE email=:email');
$reponse->execute(array(':email'=> $email1));
while($infos = $reponse->fetch(PDO::FETCH_OBJ)){
$new_mail = $infos->email;
/*si il n'y a pas de resultat*/
if(isset($new_mail) == 0){
echo' <script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: 0.9,
minWidth: 400 ,
height: 160,
position: [480,350],
});
});
setTimeout( function() {
window.location.href = ("http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/passe_perdu.php");
}, 5000 );
</script>';
echo'<div id="dialog" style="display:none;font-size:10px;" title="Erreur courriel"><img src="design/1.gif" width="24" height="24" border="0"><br />
<center><b>Adresse mail inconnue <br/> contacter le webmaster!!!!</b></center></div>';
return FALSE;
}else{
// Creation d'un identifiant
$tail = 8;
$lett = "abcdefghijklmnopqrstuvwxyz0123456789AZERTYUIOPMLKJHGFDSQWXCVBN";
srand(time());
for ($i=0;$i<$tail;$i++)
{
@$pass2.=substr($lett,(rand()%(strlen($lett))),1);
}
$pass1 = hash("sha512", $pass2);
$compte = ('UPDATE comptes SET pass=:pass WHERE email=:email');
$req = $connection->prepare($compte);
$req->execute(array(':pass'=> $pass1,
':email'=> $new_mail));
////////////////////////////////////////////////envois mail password /////////////////////////////////
$boundary = md5(uniqid(rand()));
//Code envois du mail
echo'<script>
$(document).ready(function() {
$("#dialog").dialog({
modal: true,
opacity: 0.9,
minWidth: 400 ,
height: 160,
position: [480,350],
});
});
setTimeout( function() {
window.location.href = ("http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']).'/index.php");
}, 5000 );
</script>
<div id="dialog" title=Password"><img src="cssstyle/imdesign/1.gif" width="24" height="24" border="0"><br />
Vous allez être rediriger
</div>';
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
?> |
Partager