CodeIgniter Forums
front and back offcie - 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: front and back offcie (/showthread.php?tid=19120)



front and back offcie - El Forum - 05-28-2009

[eluser]aktosci[/eluser]
I am doing a back office application. That means that user have to login.

How do you do that ? do you have exemple ? Is the authentification system included in this framework of do I have to write it from scratch?

Thanks.


front and back offcie - El Forum - 05-28-2009

[eluser]louis w[/eluser]
There are authentication libs which have already been developed for CI. Did you try searching the forums?


front and back offcie - El Forum - 05-28-2009

[eluser]aktosci[/eluser]
I created my own auth solution but as I use session it does not work

echo "session".$_SESSION['user'];
I got
A PHP Error was encountered

Severity: Notice

Message: Undefined variable: _SESSION

It does not work in controler but in a view only.


front and back offcie - El Forum - 05-28-2009

[eluser]louis w[/eluser]
Check out the Session Library.

Code Igniter clears out the SESSION variable (and GET/POST) for security reasons. This is their built in library for interacting with the session. Offers some nice things like encryption, etc.


front and back offcie - El Forum - 05-28-2009

[eluser]Dam1an[/eluser]
If you insist on using PHP essions over CI ones, you need to remember to start the session (using session_start())


front and back offcie - El Forum - 05-29-2009

[eluser]aktosci[/eluser]
Thanks you I could do what I wanted !

On my view I change my Session php to session ci

$this->session->set_userdata('ut', $_SESSION['us']);

and then I can user on my model

$this->session->userdata('ut');


front and back offcie - El Forum - 05-30-2009

[eluser]dsloan[/eluser]
Have a look at http://codeigniter.com/wiki/Category:Contributions::Libraries::Authentication