CodeIgniter Forums
if on session->userdata() - 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: if on session->userdata() (/showthread.php?tid=29464)



if on session->userdata() - El Forum - 04-10-2010

[eluser]Ngulo[/eluser]
hi all i am tryng to make my pages reserved ,so i'm setting userdata('admin');
after a login action into a login.php controller

but when i redirect after login to my other controller user.php i have to make a selection like this to make it reserved:
Code:
if(! $this->session->userdata('admin'))
{redirect('login');}

this code should be incorrect beacause always after login(TRUE validation) i come back to login.php instead of been redirected to home.php

is not a problem of redirecting and there is any other problem

maybe i need a better way to say this:

Code:
if(! $this->session->userdata('admin'))

How can i write in a better way this if() function?

did anyone can help me?

thanks guys


if on session->userdata() - El Forum - 04-10-2010

[eluser]Ngulo[/eluser]
.


if on session->userdata() - El Forum - 04-10-2010

[eluser]mr.crazy[/eluser]
if login ok
redirect(your homepage)


if on session->userdata() - El Forum - 04-10-2010

[eluser]InsiteFX[/eluser]
Create a MY_Controller and add a function check_login(()

Then extend all your controllers from the MY_Controller

InsiteFX


if on session->userdata() - El Forum - 04-10-2010

[eluser]InsiteFX[/eluser]
Read Phil's Article here

InsiteFX