Skip to content

Commit

Permalink
repair old passwords
Browse files Browse the repository at this point in the history
  • Loading branch information
benjamw committed Jul 24, 2014
1 parent c3eaba6 commit b1d2812
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions includes/login.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,14 @@
WHERE p_username = '".sani($_POST['txtUsername'])."'
";
$player = $mysql->fetch_assoc($query, __LINE__, __FILE__);

// check for an old password and update if needed
if ((false !== $player) && (32 === strlen($player['p_password']))) {
if (md5($_POST['pwdPassword']) === $player['p_password']) {
$player['p_password'] = password_make($_POST['pwdPassword']);
$mysql->insert(T_PLAYER, array('p_password' => $player['p_password']), " WHERE `p_id` = '{$player['p_id']}' ");
}
}
}
else // we need to log in
{
Expand Down

0 comments on commit b1d2812

Please sign in to comment.