daily pastebin goal
15%
SHARE
TWEET

Untitled

a guest Jun 18th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function ChangePassword()
  2. {
  3.     global $main;
  4.     mysql_connect('127.0.0.1', 'root', 'lol') or die(mysql_error());
  5.     $errors = 0;
  6.    
  7.     $data = $main->func->cleanse( $_POST );
  8.     $e_pass = sha1(strtoupper($main->user->info['username'].":".$data['old']));
  9.    
  10.     if( empty($data['new']) || empty($data['old']) || empty($data['new_confirm']) ) { $errors++; $error_array[0] = 'Enter all required fields.'; }
  11.     if( $data['new'] != $data['new_confirm'] ) { $errors++; $error_array[1] = 'New passwords do not match.'; }
  12.     if( $main->user->info['sha_pass_hash'] != $e_pass ) { $errors++; $error_array[2] = 'Current password does not match.'; }
  13.    
  14.    
  15.     if( $errors != 0 ) { $this->index( $error_array ); }
  16.     else { $this->index( false, 'Password updated.' );
  17.    
  18.         $e_pass = sha1(strtoupper($_SESSION['user_name'].':'.$data['new']));
  19.         //$sql = 'update account set sha_pass_hash = "'.$e_pass.'" where username="'.$_SESSION['user_name'].'" LIMIT 1';
  20.         $sql = mysql_query("UPDATE `logon`.`account` SET sha_pass_hash = '$e_pass' WHERE username = '$_SESSION[user_name]' LIMIT 1") or die(mysql_error());
  21.      }
  22.    
  23.    
  24. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top