![]() |
session problem - 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: session problem (/showthread.php?tid=28995) |
session problem - El Forum - 03-27-2010 [eluser]kosaidpo[/eluser] heyy guys im tryin to make a simple login this is my model where i fetch the session data Code: function m_login(){ and here my contoller where i verify the session data but it seems it doesnt work cus when i remove the cookie it still go through the if stmt am i makin some mistakes ?? anynone can correct me tnx Code: function login(){ between is there any function or tip to verify the hole array session cus affectin evry variable with the session item its kinda not so good i find tnx in advance session problem - El Forum - 03-27-2010 [eluser]ciGR[/eluser] I misunderstand what exactly you ask, so if you mean you have problem at this Code: if(!$this->forum_model->m_login()){ every time this code runs, the session created from the m_login method, so and if you clean your cookies when you run the if statement, if the user exists in your database the $this->forum_model->m_login returns true. I suggest you to restrict you model only with database operation and keep input, sessions in your controller. session problem - El Forum - 03-27-2010 [eluser]kosaidpo[/eluser] ohh yeah it looks so logic idk why ididnt notice nx dude so now i shud call my check_session methode out of the login methode right when the check_session is called it ll run on her own without callin the login methode so it ll try to login again yeahh thats it i guess tnx dude and wht abt to verify the seesion data as in can i verify the hole asession-array i dont like to verify item by item ?? tnx again session problem - El Forum - 03-27-2010 [eluser]ciGR[/eluser] For the last question you should save an array to your session, for example Code: $user = Array( and for get the data in array you can use the Code: $user = $this->session->userdata('user'); session problem - El Forum - 03-27-2010 [eluser]kosaidpo[/eluser] if you didnt notice i use this in my code above : D but tnx what i look for is sumthin like this Code: foreach($this->sesion->userdata($data_session) as $elm){ i hope im enough clear tnx session problem - El Forum - 03-27-2010 [eluser]ciGR[/eluser] I saw what you have in your code. You have this Code: $this->session->set_userdata($session_data); But I suggest you the Code: $this->session->set_userdata('user',$session_data); In your code as you can see you get the values one at atime with Code: $username = $this->session->userdata('username'); But with the second way I tell you can get an array from your session. Code: $user = $this->session->userdata('user'); Hope to understand the difference. session problem - El Forum - 03-27-2010 [eluser]kosaidpo[/eluser] yeah dude i jst did Grr@me i dont kno where was my mind when i saw you sugges tnx : D |