Created
November 24, 2011 04:36
-
-
Save tediscript/1390627 to your computer and use it in GitHub Desktop.
CodeIgniter Auth Library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Description of authlib | |
* | |
* @author tediscript | |
*/ | |
class Authlib { | |
function __construct() { | |
$this->CI = get_instance(); | |
$this->CI->load->library('session'); | |
} | |
public function login($auth_data = array()) { | |
$this->CI->session->set_userdata('auth_data', $auth_data); | |
} | |
public function logout() { | |
$this->CI->session->unset_userdata('auth_data'); | |
} | |
public function get_login() { | |
if (empty($this->CI->userdata('auth_data'))) { | |
return false; | |
} else { | |
return $this->CI->userdata('auth_data'); | |
} | |
} | |
public function is_login() { | |
if (empty($this->CI->userdata('auth_data'))) { | |
return false; | |
} else { | |
return true; | |
} | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment