I have a PHP authentication system on my website using the $_SESSION variable.
A form submits a username and password to the file \"login.php\". It is handled like t
First of all: the index logedin
seems strange for keeping track of a user being logged in. Is this just a typo on SO, or really a code-typo?
Second (depending on the desired behavior), try another approach for making pages login-protected. Your page should look something like
// put some plain HTML here
Where login.inc.php
handles the session, cookies. In particular, the authorized
function should return TRUE if a client is already logged in. If a client is not logged in, it should display a form with action $_SERVER['PHP_SELF']
and return FALSE. If you name the submit-input something like login_submit
, you can let login.inc.php
handle the verification.
This way, you don't need to refer users to a dedicated login page, and after logging in, user are directly shown the requested page. You can tweak this a bit to make query-strings persistent through login as well.