<?php 
	require_once 'singles.php';
	if(isset($_POST['current_password'])){
		if(isset($_POST['new_password'])){
			if(isset($_POST['new_confirm_password'])){
				$current_password = trim(strtolower(mysqli_real_escape_string($conn,$_POST['current_password'])));
				$new_password = trim(strtolower(mysqli_real_escape_string($conn,$_POST['new_password'])));
				$new_confirm_password = trim(strtolower(mysqli_real_escape_string($conn,$_POST['new_confirm_password'])));
					
						if(!empty($current_password)){
							if(!empty($new_password)){
								if(!empty($new_confirm_password)){
									if($current_password == trim(strtolower($infos['pass']))){
							
											if($new_password == $new_confirm_password){
												
														//balance update 
												 $stmt_update_my_pass = $conn->prepare("UPDATE info SET bal = ? WHERE email =?");
												 $stmt_update_my_pass->bind_param("ss",$d_new_bal1,$current_user_email);
												 if($stmt_update_my_pass -> execute()){
													 note_msg('Password Changed','../change-password/',1);
												 }else{
													 note_msg('Unable to handle your request at this time, Try again later','../change-password/',2);
												 }
 
												
											}else{
									note_msg('New password and confirm password does not match','../change-password/',2);
											}
										
									}else{
									note_msg('Incorrect current passsword','../change-password/',2);
										
									}
								}else{
									note_msg('All fields are required','../change-password/',2);
									
								}
							}else{
									note_msg('All fields are required','../change-password/',2);
									
								}
						}else{
									note_msg('All fields are required','../change-password/',2);
									
								}
					
				
			}
		}
	}

?>