CodeIgniter Forums
What the best way to..... - 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: What the best way to..... (/showthread.php?tid=48784)



What the best way to..... - El Forum - 01-28-2012

[eluser]the_unforgiven[/eluser]
Hi Guys,

I'm wanting to know what is the best way to do the following:

IF i have an admin area where i can login into the admin panel to do whatever but then if i have a user section on the frontend how can i get it so that it show all differeent sessions so if im logged in as a user it says hi, username for user panel and same for if logged into admin panel?


What the best way to..... - El Forum - 01-28-2012

[eluser]Jan_1[/eluser]
different names?!


What the best way to..... - El Forum - 01-28-2012

[eluser]skunkbad[/eluser]
Set a cookie that indicates that the user is logged in, and put their first and last name there too, as a convenience for use in the application.


What the best way to..... - El Forum - 01-28-2012

[eluser]the_unforgiven[/eluser]
Yes diffferent names i have a users table sin the db and admins but when i login as a user i can login into admin and done want that to happen.

Set a cookie how would i acheive that?


What the best way to..... - El Forum - 01-28-2012

[eluser]limit[/eluser]

If your already using sessions: When a user logs in, you can just make a function to pull the username from the user table and then store it in the session.

(eg: select username from users where user_id = $user_id

Why your able to login to both admin and the user side depends on how you setup your database and code. There is not enough info to help you with that.


What the best way to..... - El Forum - 01-29-2012

[eluser]the_unforgiven[/eluser]
Yes i have made two functions to pull admins in one function then users in another but i can still login has a user into the admin area, which i shouldn;t be allowed to do.