<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Logout extends CI_Controller {

	function __construct(){
		parent::__construct();
        	$this->load->helper('url');
        	$this->load->helper('form');
                $this->load->library('session'); //加载session
		$this->load->model('CsdjDB');
		$this->load->model('CsdjSkins');
	}

	public function index()
	{

                //删除在线状态
                $updata['CS_Zx']=0;
                $this->CsdjDB->get_update ('user',$this->session->userdata('cs_id'),$updata);

                $ulogin['cs_id']="";
                $ulogin['cs_name']="";
                $ulogin['cs_pass']="";
                $this->session->set_userdata($ulogin);
                if(empty($_SERVER['HTTP_REFERER'])){
                     $this->CsdjSkins->Msg_url('恭喜您，退出成功，正在转向登入页面!',site_url('user/login'),'ok');  //退出成功
                }else{
                     $this->CsdjSkins->Msg_url('恭喜您，退出成功，正在转向登入页面!',$_SERVER['HTTP_REFERER'],'ok');  //退出成功
                }
        }
}

