Can someone help me out with this bit of code. Today when i tryed to onto the administrators side of my site i was greeted with not being abke to log in because my password had been changed. Now i have gotten 33 emails in reguard to this on march 3, meaning 33 requests for email change from my server for my acount. Like i said i just tryed to log in and the hashed password was different, so obviously someone changed something somehow, someone redirected the password recovery to their email acount, or they could have even bypassed that im not sure, all i know is i need to get this fixed.
PHP Code:if (isset ($_POST['forgot']))
{
$backslash = '\\';
$invalid = array ('http', ':', '/', '//', '?', '<', '>', ('' . '$'), '{', '}', '\'', '&', '%', '#', '\\');
$email = $_POST['email'];
$email = str_replace ($invalid, '', $email);
$email = mysql_real_escape_string($email);
$result = mysql_query ('' . 'SELECT username, email from users WHERE email=\'' . $email . '\'');
$found = mysql_num_rows ($result);
if ($found < 1)
{
echo '<div class="error">Email not found in database ' . $email . '<img src="images/error.gif"></div>';
}
else
{
$worked = mysql_fetch_array ($result);
$username = $worked['username'];
$random = unique_id (25);
mysql_query ('' . 'INSERT INTO lostpassword VALUES (\'' . $random . '\', \'' . $username . '\')');
$message = '' . 'Someone has requested a lost password request for your account at ' . $sitename . '.To set a new password, please go to ' . $siteurl . '/?p=forgot&code=' . $random;
mail ($email, '' . 'Lost Password at ' . $sitename, $message, ((('' . 'From: ' . $emailaddress . '') . 'Reply-To: ' . $emailaddress . '') . ''));
echo '<div class="error">New password request email sent <img src="images/complete.gif"></div>';
}
}





Bookmarks