diff options
author | Florian Pritz <bluewind@xinu.at> | 2012-07-12 01:33:58 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2012-07-12 01:33:58 +0200 |
commit | 221b58a8d91e779e4be184257da857c36a0b87e3 (patch) | |
tree | ae269b1cdd21a2109030f53c06dd84db514d4de0 /application/models | |
parent | 61a8dfbe6186c29b5bec36c971a80b081b366091 (diff) |
Store userid in session
We don't really have to hit the db here every time.
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/models')
-rw-r--r-- | application/models/muser.php | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/application/models/muser.php b/application/models/muser.php index a93865fd4..d123c8701 100644 --- a/application/models/muser.php +++ b/application/models/muser.php @@ -33,6 +33,7 @@ class Muser extends CI_Model { if (crypt($password, $query["password"]) === $query["password"]) { $this->session->set_userdata('logged_in', true); $this->session->set_userdata('username', $username); + $this->session->set_userdata('userid', $query["id"]); return true; } else { return false; @@ -61,12 +62,7 @@ class Muser extends CI_Model { return 0; } - $query = $this->db->query(" - SELECT id - FROM users - WHERE username = ? - ", array($this->get_username()))->row_array(); - return $query["id"]; + return $this->session->userdata("userid"); } function require_access() |