Jump to content
Sign in to follow this  
PHPremote

need overall algorithm or sequence for login test using sessions

Recommended Posts

I need an overall algorithm or sequence for login test using sessions. I am all turned around. I had to make up my own flowchart on paper.

To access the username, for example, once the user is already logged in, I put a session_start() at the beginning of the site header script, called from within a page like "search.php". But to log in or out, I need to access it before that. I think I need to put session_start() at the beginning of each individual page.

Passing variables like SESSION['validlogin'] seems to be haphazard, but I think that is a logic error somewhere.

I was trying to make it really elegant before, with a single redirection script once logged in, but that was not working. So, back to basics.

Share this post


Link to post
Share on other sites

I think I need to put session_start() at the beginning of each individual page.

You do.  It's common to have one or more files that every other file will include, files that do things like set up a database connection, define variables or functions that might be used on any page, and start the session.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...