CodeIgniter Forums
need help editing session lib? - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: need help editing session lib? (/showthread.php?tid=7102)



need help editing session lib? - El Forum - 03-25-2008

[eluser]steel_slasher[/eluser]
i want to edit the sessions lib so that it would not only check to see if the session id and useragent match but also if an email address has been assigned to that session id as i cannot think of any other to do it. After looking at the lib i figured this should be right.

Code:
if (isset($session['email']))
            {
                $check=$this->CI->db->simple_query("SELECT `session_id` FROM `ci_sessions` WHERE `email` = '{$session['email']}'");
                if($check=FALSE){
                $this->sess_destroy;
                return FALSE;
            }

i am not going to run it as it will probably lead to huge errors and i am not an expert on CI so i just want to get this code checked before i run it.


need help editing session lib? - El Forum - 03-25-2008

[eluser]Seppo[/eluser]
simple_query won't return false if there is no result. Also you are assigning on the if condition.


need help editing session lib? - El Forum - 03-25-2008

[eluser]steel_slasher[/eluser]
ok so i should change the query type and i dont understand what you mean by "assigning on the if condition"


need help editing session lib? - El Forum - 03-25-2008

[eluser]Seppo[/eluser]
I mean that
[code]
if($check=FALSE){
//should be
if($check==FALSE){


need help editing session lib? - El Forum - 03-26-2008

[eluser]steel_slasher[/eluser]
oh okay no i know what you mean so i will add that in after playing so FPS games on the Wii