<?php 
 include_once '../../includes/connectConfig.php';
if($_POST)
{	
	$spass= test_input($_POST['password']);
	$passdan = $st_hasher->HashPassword($spass);
	$user_sess = $log_session;
	
	try
	{	
		$stmtg = $db_con->prepare("UPDATE tks_users SET password = '$passdan', acc_stp = 1 WHERE tus_id = '$user_sess'  ");
				
				if($stmtg->execute())
				{
					pages($user_sess,"Created Password");
					
				echo '
					<div class="alert alert-icon-left alert-light-info mb-4" role="alert">
						<button type="button" class="close" data-dismiss="alert" aria-label="Close"> <svg xmlns="http://www.w3.org/2000/svg" data-dismiss="alert" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x close"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg></button>
						<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check-circle"><path d="M22 11.08V12a10 10 0 1 1-5.93-9.14"></path><polyline points="22 4 12 14.01 9 11.01"></polyline></svg>
						<strong>Success!</strong> Password Changed Successful.
					</div>';
				
				exit();
				}
				else
				{
				echo "0";
				exit();
				}
			
				
	}
	catch(PDOException $e){
		echo $e->getMessage();
	}
}

?>