Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function ChangePassword()
- {
- global $main;
- mysql_connect('127.0.0.1', 'root', 'lol') or die(mysql_error());
- $errors = 0;
- $data = $main->func->cleanse( $_POST );
- $e_pass = sha1(strtoupper($main->user->info['username'].":".$data['old']));
- if( empty($data['new']) || empty($data['old']) || empty($data['new_confirm']) ) { $errors++; $error_array[0] = 'Enter all required fields.'; }
- if( $data['new'] != $data['new_confirm'] ) { $errors++; $error_array[1] = 'New passwords do not match.'; }
- if( $main->user->info['sha_pass_hash'] != $e_pass ) { $errors++; $error_array[2] = 'Current password does not match.'; }
- if( $errors != 0 ) { $this->index( $error_array ); }
- else { $this->index( false, 'Password updated.' );
- $e_pass = sha1(strtoupper($_SESSION['user_name'].':'.$data['new']));
- //$sql = 'update account set sha_pass_hash = "'.$e_pass.'" where username="'.$_SESSION['user_name'].'" LIMIT 1';
- $sql = mysql_query("UPDATE `logon`.`account` SET sha_pass_hash = '$e_pass' WHERE username = '$_SESSION[user_name]' LIMIT 1") or die(mysql_error());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement