<?php
/**
 * session_update - Updates the session timeout regardless of the session update value
 *
 * @author $Author: dtong $
 * @version $Id: session_update.php,v 1.6 2011/02/11 09:09:26 dtong Exp $
 * @copyright Copyright (c) 2010, Tiller Software Co., Ltd.
*/

class Session_update extends CI_Controller {
	function __construct() {
		parent::__construct();
	}

	function index() {
		global $g_sess_update;
		if ( !$this->login_model->isAuthenticated() ) {
			echo 'failed';
			exit;
		}
		$g_sess_update = TRUE;
		@$this->session->sess_update();
		echo 'success';
		exit;
	}

	//ignore the session timer and force an update
	function force_update() {
		global $g_sess_update_ignore_timer;
		$g_sess_update_ignore_timer = TRUE;
		$this->index();
	}

	function check_sess() {
		if ( !$this->login_model->isAuthenticated() ) {
			$this->load->model('auth/survey_login_model');
			if ( !$this->survey_login_model->isAuthenticated() ) {
				echo 'failed';
				exit;
			}
		}
		echo 'success';
		exit;
	}
}