From 720808fc3884a415dc483b50796697a095d1b5b8 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 4 Sep 2013 12:18:55 +0200 Subject: Set login session data in one go This reduces the amount of db queries and cookies we create since each update triggers an db update and (which is a bug) sets a new cookie. Signed-off-by: Florian Pritz --- application/libraries/Duser/Duser.php | 10 ++++++---- application/models/muser.php | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/application/libraries/Duser/Duser.php b/application/libraries/Duser/Duser.php index 733616b40..96d61e3cc 100644 --- a/application/libraries/Duser/Duser.php +++ b/application/libraries/Duser/Duser.php @@ -75,10 +75,12 @@ class Duser extends CI_Driver_Library { $CI =& get_instance(); - $CI->session->set_userdata('logged_in', true); - $CI->session->set_userdata('username', $login_info["username"]); - $CI->session->set_userdata('userid', $login_info["userid"]); - $CI->session->set_userdata('access_level', 'full'); + $CI->session->set_userdata(array( + 'logged_in' => true, + 'username' => $login_info["username"], + 'userid' => $login_info["userid"], + 'access_level' => 'full', + )); return true; } diff --git a/application/models/muser.php b/application/models/muser.php index bb67bd6a0..6a488476f 100644 --- a/application/models/muser.php +++ b/application/models/muser.php @@ -101,10 +101,12 @@ class Muser extends CI_Model { ", array($apikey))->row_array(); if (isset($query["userid"])) { - $this->session->set_userdata('logged_in', true); - $this->session->set_userdata('username', ""); - $this->session->set_userdata('userid', $query["userid"]); - $this->session->set_userdata('access_level', 'apikey'); + $this->session->set_userdata(array( + 'logged_in' => true, + 'username' => '', + 'userid' => $query["userid"], + 'access_level' => 'apikey', + )); return true; } -- cgit v1.2.3-24-g4f1b