![]() |
Logged-in pages - sessions and password check - 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: Logged-in pages - sessions and password check (/showthread.php?tid=27300) |
Logged-in pages - sessions and password check - El Forum - 02-06-2010 [eluser]viisik[/eluser] Beginners question : if a user is logged in and visits multiple pages , is it correct to assume that all the pages / controllers that the user visits has the username/password/session identified in the beginning of each page/controller - so each visited logged in page has something like that in the beginning : function something() { $this->load->library('session'); $username = $_POST['username']; $password = $_POST['password']; if($this->checkme($username, $password)=='yes') { $this->mainpage(); } else{$this->index();} } ------------ where is session info - username - password check put in case of pagination - only in the beginning of the main controller ? Logged-in pages - sessions and password check - El Forum - 02-06-2010 [eluser]bretticus[/eluser] Perhaps your code fudges a little with your intended question but I assume that you don't want to make your users log on for every page. You can check for a session variable though after making them login once. Please do not use CI sessions unless you at least enable encryption or use database sessions. You can have a checkme method for each controller method (function) or another popular alternative is to extend the Controller class with security built in. Logged-in pages - sessions and password check - El Forum - 02-07-2010 [eluser]JoostV[/eluser] Or you can create a base controller MY_Controller with security built in. |