Advertisement
Guest User

Untitled

a guest
May 7th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.41 KB | None | 0 0
  1. if ($_SERVER['REQUEST_METHOD']=='POST' && $_POST['uname']!='')
  2. {
  3.     $row = mysql_fetch_array(mysql_query("SELECT id_account, passask FROM forum_accounts f LEFT JOIN (account a) ON a.id = f.id_account WHERE LOWER(username)=LOWER('".$_POST['uname']."')"));
  4.     $passans = mysql_query("SELECT passans FROM forum_accounts WHERE id_account = ".$row['id_account']);
  5.     if ($row['id_account'] == '')
  6.     {
  7.         unset($_POST['uname']);
  8.         errborder('Invalid Account Name.');
  9.     }
  10. }
  11. if ($_SERVER['REQUEST_METHOD']=='POST' && $_POST['uname'] != '' && $_POST['passans'] != '')
  12. {
  13.     if ($_POST['newpass'] == $_POST['passconf'] and $_POST['passans'] == $passans)
  14.     {
  15.         function sha_password($user,$pass)
  16.         {
  17.             $user = strtoupper($user);
  18.             $pass = strtoupper($pass);
  19.                 $SHA1P = ($user.':'.$pass);
  20.             return hash('sha1', $SHA1P);
  21.         }
  22.         $newpass = sha_password($_POST['uname'], $_POST['newpass']);
  23.         $sql = "UPDATE account SET sha_pass_hash = '" . $newpass . "' WHERE username = '" . $_POST['uname'] . "'";
  24.         mysql_query($sql) or die("Error: " . mysql_error());
  25.     }
  26.     else if ($_POST['newpass'] !== $_POST['passconf'])
  27.     {
  28.         unset($_POST['newpass']);
  29.         unset($_POST['passconf']);
  30.         unset($_POST['passans']);
  31.         errborder('Passwords did not match!');
  32.     }
  33.     else if ($_POST['passans'] !== $passans)
  34.     {
  35.         unset($_POST['newpass']);
  36.         unset($_POST['passconf']);
  37.         unset($_POST['passans']);
  38.         errborder('Invalid security question answer!');
  39.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement