예제 #1
1
 public function index()
 {
     $this->load->helper('cookie');
     delete_cookie('login');
     $this->load->helper('url');
     redirect('/login/', 'refresh');
 }
예제 #2
0
	function _remap($segment)
	{
		$this->load->library('session');
		$this->session->sess_destroy();
		$this->load->module_library(FUEL_FOLDER, 'fuel_auth');
		$this->load->helper('cookie');
		$this->fuel_auth->logout();
		$config = array(
			'name' => $this->fuel_auth->get_fuel_trigger_cookie_name(),
			'path' => WEB_PATH
		);
		delete_cookie($config);
		
		$redirect = $this->config->item('logout_redirect', 'fuel');
		if ($redirect == ':last')
		{
			$this->load->helper('convert');
			
			// if ($segment == 'index')
			// {
			// 	$redirect = fuel_uri('login');
			// }
			// else
			// {
				$redirect = uri_safe_decode($segment);
			//}
		}
		redirect($redirect);
	}
예제 #3
0
파일: User.php 프로젝트: stormlab/Stormlab
 function clear_level($name = 'ci_user')
 {
     /*  Current CI instance, plus helper. */
     $CI =& get_instance();
     $CI->load->helper('cookie');
     delete_cookie($name);
 }
예제 #4
0
 public function __construct()
 {
     $CI =& get_instance();
     $this->u = $CI->input->cookie("scun", TRUE);
     $this->p = $CI->input->cookie("sctkn", TRUE);
     if ($this->u && $this->p) {
         $user = $CI->db->select(" users.`ID`, users.`name`, users.`email`, users.`access_level`,\n\t\t\t \t users.`default_ticket_category`, users.`email_notification`, \n\t\t\t \t users.`locked_category`")->where("email", $this->u)->where("token", $this->p)->get("users");
         if ($user->num_rows() == 0) {
             $this->loggedin = false;
         } else {
             $this->loggedin = true;
             $this->info = $user->row();
             if ($this->info->access_level == -1) {
                 $CI->load->helper("cookie");
                 $this->loggedin = false;
                 $CI->session->set_flashdata("globalmsg", "This account has been deactivated and can no longer be used.");
                 delete_cookie("scun");
                 delete_cookie("sctkn");
                 redirect(base_url());
             } elseif ($this->info->access_level == -2) {
                 $CI->load->helper("cookie");
                 $this->loggedin = false;
                 $CI->session->set_flashdata("globalmsg", "This account has been BANNED and can no longer be used.");
                 delete_cookie("scun");
                 delete_cookie("sctkn");
                 redirect(base_url());
             }
         }
     }
 }
예제 #5
0
 function returnTo($url)
 {
     $this->load->helper('cookie');
     $rt = get_cookie('return_to');
     delete_cookie('return_to');
     redirect($rt ? $rt : $url);
 }
예제 #6
0
 public function do_login($userinfo)
 {
     $this->session->unset_userdata('user');
     $this->load->helper('cookie');
     delete_cookie('p');
     $where = array('loginname' => $userinfo['username'], 'password' => md5($userinfo['password']));
     $query = $this->db->select('id, name, loginname, password, isenable')->where($where)->get('users');
     if ($query->num_rows() == 1) {
         $row = $query->row();
         if ($row->isenable == '0') {
             $this->say = array('success' => '0', 'message' => '该账户已被禁用');
         } else {
             $loginInfo = array('userId' => $row->id, 'userName' => $row->name);
             $query = $this->db->query('select DISTINCT privilegeid from ' . $this->db->dbprefix('group_privilege') . ' where groupid in (select groupid from ' . $this->db->dbprefix('user_group') . ' where userid = ' . $row->id . ')');
             //find all priivleges and write into the cookie be named 'p'
             $returnPrivileges = array();
             if ($query->num_rows() > 0) {
                 foreach ($query->result_array() as $p) {
                     $returnPrivileges[] = $p['privilegeid'];
                 }
                 $this->input->set_cookie('p', json_encode($returnPrivileges), 3600);
             } else {
                 $this->input->set_cookie('p', '', 3600);
             }
             $this->session->user = $loginInfo;
             $this->say = array('success' => '1', 'message' => $this->session->user);
         }
     } else {
         $this->say = array('success' => '0', 'message' => '用户名密码错误');
     }
     return $this->say;
 }
예제 #7
0
 public function login()
 {
     $username = $this->input->post('username');
     $password = $this->input->post('password');
     $remember_check = $this->input->post('remember_check');
     if (isset($remember_check)) {
         set_cookie('ck_username', $username, time() + 60);
         set_cookie('ck_password', $password, time() + 60);
         set_cookie('ck_remember', $remember_check, time() + 60);
     } else {
         delete_cookie('ck_username');
         delete_cookie('ck_password');
         delete_cookie('ck_remember');
     }
     $salt = '$2a$04$123456789123456789123$';
     $hashed_password = crypt($password, $salt);
     $where_arr = array('admin_name' => $username, 'admin_pass' => $hashed_password);
     $query = $this->db->get_where("tbl_admin", $where_arr);
     $row = $query->row_array();
     //คิวรี่ข้อมูลมาแสดงแค่รายการเดียว
     if (isset($row)) {
         $newdata = array('ses_admin_id' => $row['admin_id'], 'ses_admin_name' => $row['admin_name']);
         $this->session->set_userdata($newdata);
         // อัพเดทข้อมูลการล็อกอินของ admin เช่น ล็อกอินล่าสุด
         $update_data = array('admin_lastlogin	' => date("Y-m-d H:i:s"));
         $this->db->update('tbl_admin', $update_data, array('admin_id' => $row['admin_id']));
     }
     redirect('admin');
     // ไปหน้า admin
 }
예제 #8
0
 public function index()
 {
     delete_cookie('id');
     delete_cookie('key');
     session_destroy();
     redirect('/');
 }
예제 #9
0
파일: Login.php 프로젝트: Thavia/plb
 function logout()
 {
     delete_cookie('key', 'localhost', '/', 'mycookie_');
     delete_cookie('user', 'localhost', '/', 'mycookie_');
     $this->session->sess_destroy();
     redirect(site_url());
 }
예제 #10
0
 public function logout()
 {
     $this->session->sess_destroy();
     delete_cookie();
     redirect('admin/', 'refresh');
     exit;
 }
예제 #11
0
 public function admin_login_validation()
 {
     $this->form_validation->set_rules('password', 'Password', 'required|trim');
     $this->form_validation->set_rules('email', 'Email', 'required|valid_email|trim|callback_validate_credentials');
     if ($this->form_validation->run()) {
         $data = array('email' => $this->input->post('email'), 'is_logged_in' => 1);
         $this->session->set_userdata($data);
         if ($this->input->post('remember') !== null) {
             $cookie = array('name' => 'admin_jp_un', 'value' => $this->input->post('email'), 'expire' => time() + 100 * 24 * 60 * 60);
             $this->input->set_cookie($cookie);
             $cookie = array('name' => 'admin_jp_pw', 'value' => $this->input->post('password'), 'expire' => time() + 100 * 24 * 60 * 60);
             $this->input->set_cookie($cookie);
         } else {
             delete_cookie('admin_jp_un');
             delete_cookie('admin_jp_pw');
         }
         redirect('login/dashboard');
     } else {
         //echo 1; exit;
         //$this->login();
         //redirect('main/login');
         $this->load->view('admin/login');
     }
     //echo $_POST['email'];
     //echo $this->input->post('email');
 }
예제 #12
0
 public function view($page = 'home')
 {
     $this->load->model('api_model');
     $this->load->database();
     if (!file_exists(APPPATH . '/views/pages/' . $page . '.php')) {
         // Whoops, we don't have a page for that!
         die("<center><font face=tahoma><div dir=rtl>صفحه مورد نظر پیدا نشد.");
     }
     if ($page == "api") {
         $data['title'] = ucfirst($page);
         // Capitalize the first letter
         $this->load->view('pages/' . $page, $data);
         return;
     }
     $data['title'] = ucfirst($page);
     // Capitalize the first letter
     $this->load->view('templates/header', $data);
     if (null != get_cookie("username") && null != get_cookie("password") && null != get_cookie("name") && null != get_cookie("id")) {
         $u = get_cookie("username");
         $p = get_cookie("password");
         $query = $this->db->query("SELECT * FROM user WHERE email = '" . $u . "'  AND sha1(password)='" . $p . "'");
         if ($query->num_rows() < 1) {
             delete_cookie("username");
         }
         $this->load->view('pages/' . $page, $data);
     } else {
         $this->load->view('pages/home-nologin', $data);
     }
     $this->load->view('templates/footer', $data);
 }
예제 #13
0
파일: ajax.php 프로젝트: leyuan/ViewPal
 public function logout()
 {
     $this->session->unset_userdata('username');
     $cookiedata = array('name' => 'vp_username', 'value' => '', 'expire' => 0);
     delete_cookie($cookiedata);
     echo 1;
 }
예제 #14
0
파일: mUser.php 프로젝트: Swift-Jr/thmdhc
 function logout()
 {
     unset($_SESSION['uatoken']);
     delete_cookie('uatoken');
     data('AUTHENTICATED', FALSE);
     redirect('/site-admin/');
 }
예제 #15
0
 public function deleteToken()
 {
     delete_cookie(self::TOKEN_COOKIE_NAME, null, -1, '/');
     if (!empty($_COOKIE[self::TOKEN_COOKIE_NAME])) {
         unset($_COOKIE[self::TOKEN_COOKIE_NAME]);
     }
 }
예제 #16
0
파일: login.php 프로젝트: cordova2009/SMA
 /**
  * 用户退出
  *
  * @access public
  * @return void
  */
 public function logout($url = 'index-bp')
 {
     $this->load->helper('cookie');
     delete_cookie('P');
     $this->auth->process_logout();
     redirect(site_url(str_replace('-', '/', $url)));
 }
예제 #17
0
파일: account.php 프로젝트: Cavalero/CORA
 public function authenticate()
 {
     $this->load->model('msettings');
     $acc_settings = $this->msettings->get_set_acc();
     $username = $_POST['username'];
     $userpass = !$acc_settings[0]->use_md5 ? $_POST['userpass'] : md5($_POST['userpass']);
     $this->load->model('maccount');
     $account = $this->maccount->authenticate($username, $userpass);
     if (null != $account) {
         $this->session->set_userdata('account_id', $account[0]->account_id);
         $this->session->set_userdata('userid', $account[0]->userid);
         $this->session->set_userdata('group_id', $account[0]->group_id);
         $this->session->set_userdata('sex', $account[0]->sex);
         if (isset($_POST['remember']) and 1 == $_POST['remember']) {
             $cookie_user = array('name' => 'userid', 'value' => $account[0]->userid, 'expire' => '2592000', 'path' => '/');
             $cookie_log = array('name' => 'login', 'value' => 'true', 'expire' => '2592000', 'path' => '/');
             $this->input->set_cookie($cookie_user);
             $this->input->set_cookie($cookie_log);
         } else {
             delete_cookie('userid');
             delete_cookie('login');
         }
         $this->load->model('mlogs');
         $log_data = array('type' => 'Login', 'user1' => $account[0]->account_id, 'date' => date("Y-m-d H:i:s"), 'ip' => $_SERVER['REMOTE_ADDR'], 'note' => 'Account Login');
         $log_insert = $this->mlogs->add_log_tcp($log_data);
         $return_value = base_url();
     } else {
         $return_value = base_url() . 'account/login?msgcode=404';
     }
     redirect($return_value, 'refresh');
 }
 public static function logout($user)
 {
     // remove autologin
     $ci =& get_instance();
     $ci->load->helper('cookie');
     delete_cookie('autologin_native');
 }
예제 #19
0
 public function logout()
 {
     delete_cookie(PREFIX . 'login_remember');
     $this->auth->logout();
     $this->session->sess_destroy();
     redirect('login');
 }
예제 #20
0
 public function logout()
 {
     $this->load->helper(array('cookie', 'url'));
     $this->input->set_cookie('uid', 0, 86400);
     delete_cookie('uid');
     redirect('/', 'location', 301);
 }
예제 #21
0
    function requireAuth($body = FALSE)
    {
        // Check for SSL
        if (!isset($_SERVER['HTTPS'])) {
            redirect("https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']);
            exit;
        }
        // Check for Session
        if (!$this->isAuthenticated()) {
            // Kill Lingering Session Data
            $this->CI->load->helper('cookie');
            delete_cookie('sso_checksum');
            $this->CI->session->sess_destroy();
            if (!$body) {
                $body = '
			<article>
			<header>
				<h2>Authentication Required</h2>
				<p>
					We protect your account with end-to-end SSL encryption, access control management, and
					state of the art technology.  What&apos;s more, it&apos;s fast and easy.
				</p>
			</header>
			<p>You must login before you can continue.</p>
			<a href="' . site_url('sso/login') . '" class="button">Log In</a>
			</article>
			';
            }
            $this->CI->display->setPageTitle('Dashboard');
            $this->CI->display->setViewBodyStr($body);
            exit;
        }
    }
예제 #22
0
 public function __construct()
 {
     parent::__construct();
     $this->time_begin = time();
     //设置头部为json
     //$this->output->set_content_type('application/json', strtolower($this->config->item('charset')));
     $admin = array();
     if ($this->input->get_post('sessiontoken')) {
         $session = $this->session_token_model->getSession($this->input->get_post('sessiontoken'));
         $this->session_token = $this->input->get_post('sessiontoken');
         if ($session) {
             $this->admin_id = $session['admin_id'];
             $this->admin_name = $session['admin_name'];
             $where = array('admin_name' => $session['admin_name']);
             $admin = $this->admin_model->getOne($where);
         } else {
             delete_cookie('login_sessiontoken');
         }
     }
     if (!$admin) {
         $json = array('success' => false, 'msg' => '请重新登录', 'code' => 99);
         echo json_encode($json);
         exit;
     }
 }
예제 #23
0
 public function getLoginData($u, $p)
 {
     try {
         $query = $this->db->from('account')->where('username', $u)->limit(1)->get();
         if ($query->num_rows() > 0) {
             $row = $query->row();
             $password = hash_hmac('md5', $p, salt);
             // 比對密碼,若登入成功則呈現登入狀態
             if ($password == $row->password) {
                 // 檢查是否為最高權限管理者
                 if ($row->groups != 'administration') {
                     $query = $this->db->select('acl')->from('account_group')->where(array('id' => $row->groups, 'status' => 0))->limit(1)->get();
                     $row2 = $query->row();
                     // 群組已關閉或本身帳號已關閉
                     if ($query->num_rows() <= 0 || $row->status != '0') {
                         $data = array("ip" => $this->input->ip_address(), "pID" => $row->id, "name" => $row->name, "username" => $row->username, "message" => $this->msg[0]);
                         $this->db->insert('account_record', $data);
                         return array(FALSE, $this->message->msg['login'][7], '');
                     } else {
                         $this->session->set_userdata('acl', unserialize($row2->acl));
                     }
                 } else {
                     $this->session->set_userdata('acl', 'administration');
                 }
                 // 計算登入次數及更新登入時間
                 $data = array('loginTime' => date('Y-m-d H:i:s'), 'ip' => $this->input->ip_address());
                 $this->db->where('id', $row->id);
                 $this->db->update('account', $data);
                 $userdata = array('pID' => $row->id, 'pName' => $row->name, 'status' => 'success');
                 $this->session->set_userdata($userdata);
                 $this->load->helper('cookie');
                 if ($this->input->post('rememberme') != NULL && $this->input->post('rememberme') == 'true') {
                     set_cookie('remUser', $u, 86400 * 30);
                     set_cookie('remPass', $p, 86400 * 30);
                 } else {
                     if (get_cookie('remUser', TRUE)) {
                         delete_cookie("remUser");
                         delete_cookie("remPass");
                     }
                 }
                 $data = array("ip" => $this->input->ip_address(), "pID" => $row->id, "name" => $row->name, "username" => $row->username, "message" => $this->msg[1]);
                 $this->db->insert('account_record', $data);
                 return array(TRUE, $this->message->msg['login'][6], '/w-admin/home');
             } else {
                 // 密碼錯誤!
                 $data = array("ip" => $this->input->ip_address(), "pID" => $row->id, "name" => $row->name, "username" => $row->username, "message" => $this->msg[2]);
                 $this->db->insert('account_record', $data);
                 return array(FALSE, $this->message->msg['login'][4], '');
             }
         } else {
             // 帳號不存在!
             $data = array("ip" => $this->input->ip_address(), "pID" => 0, "name" => '未知', "username" => '未知', "message" => $this->msg[3]);
             $this->db->insert('account_record', $data);
             return array(FALSE, $this->message->msg['login'][5], '');
         }
     } catch (PDOException $e) {
         exit($e->getMessage());
     }
 }
예제 #24
0
 function _delete_autologin()
 {
     $user_id = $this->get_uuid();
     if ($user_id != null) {
         $this->user_session->clear_sessions($user_id);
         delete_cookie('sg_auth_cookie', get_site_host(), get_site_path(), '');
     }
 }
예제 #25
0
 public function delete_remember_me()
 {
     $this->db->where('id_session', $this->read_remember_me());
     $this->db->delete('sessions');
     $this->db->where('id_session', session_id());
     $this->db->delete('sessions');
     delete_cookie('skubbs_kmli');
 }
예제 #26
0
파일: login.php 프로젝트: ubiopen/KI_Board
 function out()
 {
     if (IS_MEMBER) {
         $this->session->sess_destroy();
         delete_cookie('ck_mb_id');
     }
     goto_url('/');
 }
예제 #27
0
파일: Coache.php 프로젝트: z32556601/kljk
 public function logout()
 {
     if ($val = get_cookie(COACHE_LOGIN_COOKIE_KEY)) {
         delete_cookie(COACHE_LOGIN_COOKIE_KEY);
     }
     header('Location: ' . BASE_URL . '/coache');
     exit;
 }
 public function logout()
 {
     $this->load->model('user_model', 'User');
     $logout = $this->User->logout($this->session->userdata("username"), $this->session->userdata("password"));
     delete_cookie("eventribe-remember-token");
     $this->session->sess_destroy();
     redirect(base_url());
 }
예제 #29
0
파일: login.php 프로젝트: sendojay/biovalys
    public function logout()
    {
        delete_cookie('biovalys');
        $this->session->sess_destroy();
        $arr = array('title' => '<i class="fa fa-exclamation-circle"></i>
 SignOut!!!', 'detail' => 'Thank for use System', 'url' => base_url('sitecontrol/login'));
        echo $this->model_utility->alert($arr);
    }
예제 #30
0
 /**
  * Sign out
  *
  * New page description
  *
  * @access  public
  * @param   none
  * @return  redirect
  * @route   n/a
  */
 function signout()
 {
     $this->CI->load->helper('string');
     $this->CI->db->where('user_id', $this->CI->session->userdata('user_id'))->update('users', array('auto_login_token' => 'LOGGED_OUT_' . random_string('alnum', 24)));
     delete_cookie("session_token");
     delete_cookie("session");
     $this->CI->session->destroy();
 }