<?
require_once('include/global.php');
require_once('include/mail_lib.php');

set_time_limit(1200);

// check
	if (! $_POST['type'] || ! $_POST['device_token']) {
		msg('올바른 URL로 접근하여 주십시오');
	}

	if ($_POST['type'] === 'TRUSTED') {

		// 전체삭제가 아닐 경우에는 해당 토큰만 삭제해야 함.
		$q_where = '';
		if ($_POST['device_token'] !== 'ALL') {
			$q_where = " AND device_token='" . $_POST['device_token'] . "'";
		}

		$sql = "
				UPDATE
					" . $TB['MEMBER_DEVICE'] . "
				SET is_trusted = 'N'
				WHERE 
				m_no='" . $AUTH['auth_m_no'] . "'"
			. $q_where;

		db_query($sql);
	} elseif ($_POST['type'] === 'LOGIN') {
		session_logout($AUTH['auth_m_no'], $_POST['device_token']);
	}

// end
movepage('2fa_config.php');


require_once('include/global_end.php');
?>