SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist jkh1978's Avatar
    Join Date
    May 2001
    Location
    Northern Virginia
    Posts
    445
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    controlling user logging in to website

    I want to have some pages tailored to the person logged in, and these pages unavailable if someone does not log in.

    I am familar with htaccess and the pop up password boxes, but i want to use php and make it fancier. I want tocheck the entered password against a database.

    How do i control that the pages are not viewed until someone logs in, and how do i control that these pages are tailored to the user that logged in?

    Is sessions (which i know little about), cookies, passing a hidden value, htaccess, etc... which is the better method? and are any of these secure?

  2. #2
    Yugo full of anvils bronze trophy hillsy's Avatar
    Join Date
    May 2001
    Location
    :noitacoL
    Posts
    1,859
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've done something like this a while ago in ColdFusion Express, using session variables.

    Basically, you have a login screen which checks username/password against a table in the DB. Depending on whether the user's got it right or not, they can either be dumped back at the login with a simple redirect, or let into the site.

    If they've got it right, then a session variable is set. Every page has an include which checks for the existence of this variable, and drops them out to the login screen if it's not present, or if it's timed out.

    HTH
    that's me!
    Now A Pom. And a Plone Nut
    Broccoli Martinez Airpark

  3. #3
    SitePoint Wizard johnn's Avatar
    Join Date
    Mar 2001
    Location
    Southern California, USA
    Posts
    1,181
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Take a look at this article Managing users with PHP sessions. It's a good one.

    John

  4. #4
    Don't get too close, I bite! Nicky's Avatar
    Join Date
    Jul 1999
    Location
    Lancashire, UK
    Posts
    8,277
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I agree with John, that article might help you, so will many others that can be found on SitePoint.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •