diff --git a/recovery.php b/recovery.php index d07541b..9fd7f22 100644 --- a/recovery.php +++ b/recovery.php @@ -1,92 +1,142 @@ +include 'layout/overall/header.php'; +if ($config['mailserver']['accountRecovery']) { + // Fetch, sanitize and assign POST and GET variables. + $mode = (isset($_GET['mode']) && !empty($_GET['mode'])) ? getValue($_GET['mode']) : false; + $email = (isset($_POST['email']) && !empty($_POST['email'])) ? getValue($_POST['email']) : false; + $character = (isset($_POST['character']) && !empty($_POST['character'])) ? getValue($_POST['character']) : false; + $password = (isset($_POST['password']) && !empty($_POST['password'])) ? getValue($_POST['password']) : false; + $username = (isset($_POST['username']) && !empty($_POST['username'])) ? getValue($_POST['username']) : false; + //data_dump($_GET, $_POST, "Posted data."); -

Account Recovery

- -check($_POST['captcha_code']) == false) { + $status = false; + } + } + if ($status) { + if (!$username) { + // Recover username + $salt = ''; + if ($config['TFSVersion'] != 'TFS_03') { + // TFS 0.2 and 1.0 + $password = sha1($password); + } else { + // TFS 0.3/4 + if (config('salt') === true) { + $saltdata = mysql_select_single("SELECT `salt` FROM `accounts` WHERE `email`='$email' LIMIT 1;"); + if ($saltdata !== false) $salt .= $saltdata['salt']; } - // end EDOM - } else { echo 'That character name does not exist.'; } - } else { echo 'You need to type in a character name from your account.'; } - + $password = sha1($salt.$password); + } + $user = mysql_select_single("SELECT `p`.`id` AS `player_id`, `a`.`name` FROM `players` `p` INNER JOIN `accounts` `a` ON `p`.`account_id` = `a`.`id` WHERE `p`.`name` = '$character' AND `a`.`email` = '$email' AND `a`.`password` = '$password' LIMIT 1;"); + if ($user !== false) { + // Found user + + $mailer = new Mail($config['mailserver']); + $title = "$_SERVER[HTTP_HOST]: Your username"; + $body = "

Account Recovery

"; + $body .= "

Your username is: $user[name]
"; + $body .= "Enjoy your stay at ".$config['mailserver']['fromName'].".
"; + $body .= "


I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.

"; + $mailer->sendMail($email, $title, $body, $user['name']); + + ?> +

Account Found!

+

We have sent your username to .

+

If you can't find the email within 5 minutes, check your junk/trash inbox as it may be mislocated there.

+ +

Account recovery failed!

+

Submitted data is wrong.

+ Account Recovery"; + $body .= "

Your new password is: $newpass
"; + $body .= "We recommend you to login and change it before you continue playing.
"; + $body .= "Enjoy your stay at ".$config['mailserver']['fromName'].".
"; + $body .= "


I am an automatic no-reply e-mail. Any emails sent back to me will be ignored.

"; + $mailer->sendMail($email, $title, $body, $user['name']); + ?> +

Account Found!

+

We have sent your new password to .

+

If you can't find the email within 5 minutes, check your junk/trash inbox as it may be mislocated there.

+ +

Account recovery failed!

+

Submitted data is wrong.

+ +

Account Recovery

+ + +
+
+
+ Username:
'; + else echo '
'; + if ($config['use_captcha']) { + ?> + Write the image symbols in the text field to verify that you are a human: + CAPTCHA Image
+ + [ Different Image ]

+ + +
+ +

Do you wish to recover your username or password?

+ - -
- -
- - +

System Disabled

+

The admin have disabled automatic account recovery.

+ - - \ No newline at end of file +include 'layout/overall/footer.php'; ?> \ No newline at end of file