header ("Content-Type: text/html; charset=iso-8859-9");
?>
if(!file_exists('GameEngine/config.php')) {
header("Location: install/");
exit;
}
include("GameEngine/config.php");
include("GameEngine/Lang/" . LANG . ".php");
include("GameEngine/Database.php");
include("GameEngine/Mailer.php");
include("GameEngine/Generator.php");
if(!isset($_REQUEST['npw'])){
header("Location: login.php");
exit;
}
?>
<script></script>
<script></script>
<script></script>
<script></script>
// user input email and submit
if(isset($_POST['email']) && isset($_POST['npw'])){
$uid = intval($_POST['npw']);
$email = $database->getUserField($uid, 'email', 0);
$username = $database->getUserField($uid, 'username', 0);
if($email != $_POST['email']){
echo "Girdiğiniz mail adresi veri tabanında eşleşmedi.
\n";
}else{
// generate password and cpw
$npw = $generator->generateRandStr(7);
$cpw = $generator->generateRandStr(10);
$database->addPassword($uid, $npw, $cpw);
// send password mail
$mailer->sendPassword($email, $uid, $username, $npw, $cpw);
echo "Password was sent to: ${_POST['email']}
\n";
}
// user click the link in 'password forgotten' email
}else if(isset($_GET['cpw']) && isset($_GET['npw'])){
$uid = intval($_GET['npw']);
$cpw = preg_replace('#[^a-zA-Z0-9]#', '', $_GET['cpw']);
if(!$database->resetPassword($uid, $cpw)){
echo 'The password has not been changed. Perhaps the activation code has already been used.
';
}else{
echo 'The password has been successfully changed.
';
}
// user click 'generate password' link in login fail page, display input form here
}else {
?>
Before you can request a new password you have to enter the email address that has been used to register the account.
Afterwards you will receive an e-mail with a new password. The password will only work after confirming it, though.
}
?>