Change Password
Register
- Account and password can not be empty .
- Account and password can not be less than 4 and Over 15 characters .
- Account and password are written in English letters and numerals.
if(ereg("^([a-zA-Z0-9_-])*$", $_POST['account']) && ereg("^([a-zA-Z0-9_-])*$", $_POST['oldpassword']) && ereg("^([a-zA-Z0-9_-])*$", $_POST['newpassword']) && ereg("^([a-zA-Z0-9_-])*$", $_POST['newpassword2']))
{
if ($page='index.php' && $_POST['account'] && strlen($_POST['account'])<16 && $_POST['oldpassword'] && $_POST['newpassword'] && $_POST['newpassword']==$_POST['newpassword2'])
{
$result=mysql_query("SELECT login,password FROM accounts WHERE login='".@mysql_real_escape_string($_POST['account'])."' AND password='".base64_encode(pack('H*', sha1($_POST['oldpassword'])))."'", $link)
or die ("Error: ".mysql_error());
if (mysql_num_rows($result))
{
mysql_query("UPDATE accounts SET password='".base64_encode(pack('H*', sha1($_POST['newpassword'])))."' WHERE login='".mysql_real_escape_string($_POST['account'])."'", $link)
or die ("Error: ".mysql_error());
print "
Password has been changed.
";
}
else
print "
That's it : ( something went wrong, give another try.
";
mysql_close($link);
}
}
else
{
echo "Restrictions have not been tested for safety. If you are confident that had the correct information, please refer to the administration .";
}
?>