Welcome Guest, Not a member yet? Register   Sign In
Logged-in pages - sessions and password check
#1

[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 ?
#2

[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.
#3

[eluser]JoostV[/eluser]
Or you can create a base controller MY_Controller with security built in.




Theme © iAndrew 2016 - Forum software by © MyBB