summaryrefslogtreecommitdiffstats
path: root/application/models/muser.php
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-07-12 01:33:58 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-07-12 01:33:58 +0200
commit221b58a8d91e779e4be184257da857c36a0b87e3 (patch)
treeae269b1cdd21a2109030f53c06dd84db514d4de0 /application/models/muser.php
parent61a8dfbe6186c29b5bec36c971a80b081b366091 (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/muser.php')
-rw-r--r--application/models/muser.php8
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()