SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Guru
    Join Date
    Sep 2004
    Location
    Provo, UT
    Posts
    865
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Security enforced by a required login

    I have several pages that I want to protect. Only users that are logged in should be able to see them. What is the best way to protect these? I am familiar with sessions.

    Thanks.

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Personally I would use sessions. If you know how to do it.... do it!


    SpikeZ
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    gimme the uuuuuuuuuuu duuudie's Avatar
    Join Date
    Feb 2004
    Location
    Switzerland
    Posts
    2,253
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The simplest way is to check against your db if the submitted password and username match. If they do, set a session['isloggedin'] to true. At the top of your pages, check if this session = true. If not, redirect to login page. If yes, display the content.

    For a more efficient approach, read this excellent article by Harry F:

    http://www.sitepoint.com/article/ant...access-control


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
  •