Ja zrobiłem w mojej grze tak:
Nowe Hasło generowane jest w liczbach...
Kod php:
$new_password = rand(1, 9999);
$pass = md5($new_password);
mysql_query("UPDATE users SET haslo='".$pass."' WHERE email='"mysql_real_escape_string($_POST['email'])"' ") or die (mysql_error());
echo "
<script type='text/javascript'>window.alert('Sparwdź swój Email, tam uzyskasz dalsze informacje!');document.location.href = 'index.php';</script>
";
$headers="MIME-Version: 1.0\r\n";
$headers.="Content-type: text/html; charset=UTF-8\r\n";
$headers.="From: KingPin <info@handball-manager.pl>\r\n";
$content="<html><head><title>Przypomnienie Hasła - Handball-Manager</title</head>
<center>
<body>
TA WIADOMOŚĆ ZOSTAŁA WYSŁANA AUTOMATYCZNIE, PROSIMY NA NIĄ NIE ODPOWIADAĆ!<br />
Twoje Nowe Hasło: <b>".$new_password."</b> <br />
Pozdrawia zespół Handball-Manager</body></center></html>";
mail($_POST["email"], "Przypomnienie Hasła - (HM)", $content, $headers);
Zakładki