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
| <?php
session_start();
$_SESSION['adresse_mail']=$_POST['adresse_mail'];
$destinataire = $_SESSION['adresse_mail'];
if(preg_match('`^[[:alnum:]]([-_.]?[[:alnum:]])*@[[:alnum:]]([-.]?[[:alnum:]])*\.([a-z]{2,4})$`',$destinataire))
{
mysql_connect("localhost","exemple","mot de passe bidon");
mysql_select_db("pic_login");
$reponse=mysql_query('SELECT login, mdp FROM pic_login WHERE mail="'.$_SESSION['adresse_mail'].'"') or die(mysql_error());
$donnees = mysql_fetch_array($reponse);
mysql_close();
$objet = "Picavisio" ;
$message = '<html>
<head>
<style type="text/css">
<!--
.Style1 {
font-family: "Lucida Sans";
font-weight: bold;
}
.Style2 {font-family: "Lucida Sans"}
-->
</style>
</head>
<body>
<span class="Style2">Stocker vos photos et faites les voir avec des superbes visionneuses sur
<a href="http://picavisio.free.fr">http://picavisio.free.fr</a> !
</span>
<p class="Style1">Votre login est :'.$donnees['login'].'</p>
<p class="Style1">Votre mot de passe est :'.$donnees['mdp'].'</p>
</body>
</html>
';
/* Si lon veut envoyer un mail au format HTML, il faut configurer le type Content-type. */
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\n";
/* Quelques types dentêtes : errors, From cc's, bcc's, etc */
$headers .= "From: Picavisio <picavisio@free.fr>\n";
// On envoi lemail
if ( mail($destinataire, $objet, $message, $headers) )
{
echo "Envoi du mail réussi !";
?>
<p><a href="index.php">Retour</a></p>
<?
}
else
{
echo "Echec de lenvoi du mail";
?>
<p><a href="index.php">Retour</a></p>
<?
}
}
else
{
echo " Votre adresse n'est pas valide !";?>
<a href="demande_adresse.php">Retour</a>
<?
}
?> |
Partager