Your IP : 216.73.216.93


Current Path : /home/users/unlimited/www/facebook.codeskitter.site/xhr/
Upload File :
Current File : /home/users/unlimited/www/facebook.codeskitter.site/xhr/resend_two_factor.php

<?php
if ($f == 'resend_two_factor') {
	$hash = '';
	if (!empty($_SESSION) && !empty($_SESSION['two_factor_hash'])) {
		if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
		    $hash = filter_var($_SESSION['two_factor_hash'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
		} else {
		    $hash = filter_var($_SESSION['two_factor_hash'], FILTER_SANITIZE_STRING);
		}
		$hash = Wo_Secure($hash);
	}
	if (!empty($_COOKIE) && !empty($_COOKIE['two_factor_hash'])) {
		if (version_compare(PHP_VERSION, '8.0.0', '>=')) {
		    $hash = filter_var($_COOKIE['two_factor_hash'], FILTER_SANITIZE_FULL_SPECIAL_CHARS);
		} else {
		    $hash = filter_var($_COOKIE['two_factor_hash'], FILTER_SANITIZE_STRING);
		}
		$hash = Wo_Secure($hash);
	}
	if (empty($hash)) {
		$data['status'] = 400;
		$data['message'] = $wo['lang']['code_two_expired'];
	}
	else{
		$user = $db->where('two_factor_hash',$hash)->where('email_code','','!=')->getOne(T_USERS);
		if (!empty($user)) {
			if ($user->time_code_sent == 0 || $user->time_code_sent < (time() - (60 * 1))) {
				if (Wo_TwoFactor($user->username) === false) {
					$db->where('user_id',$_SESSION['code_id'])->update(T_USERS,array('time_code_sent' => time()));
					cache($_SESSION['code_id'], 'users', 'delete');
					$data = array(
                        'status' => 200,
                        'message' => $wo['lang']['code_successfully_sent']
                    );
				}
				else{
					$data['status'] = 400;
		   			$data['message'] = $wo['lang']['failed_to_send_code'];
				}
			}
			else{
				$data['status'] = 400;
		        $data['message'] = $wo['lang']['you_cant_send_now'];
			}
		}
		else{
			$data['status'] = 400;
		    $data['message'] = $wo['lang']['something_wrong'];
		}
	}
	header("Content-type: application/json");
    echo json_encode($data);
    exit();
}