how to protect a page by password in php?

Discussion in 'PHP' started by kcm4web, Jan 7, 2011.

  1. #1
    i want to protect a page by password. i know it can done by .htaccess but i dont need that. when a user comes to a page a password box appears. after giving right password it will go to the page
     
    kcm4web, Jan 7, 2011 IP
  2. dddougal

    dddougal Well-Known Member

    Messages:
    676
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    108
    #2
    lookup sessions...Its the easiest way to do it..

    Just create a login form as you usually would in html. Store your password in a php variable or database or something. Pass the form data to the page where your data is and check the password against the stored one using if...else or something. If password is right start the session...

    Check here for a start: http://www.devarticles.com/c/a/PHP/PHP-for-Beginners-by-a-Beginners/1/
     
    dddougal, Jan 7, 2011 IP
  3. kcm4web

    kcm4web Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    i have done this . but i want some advance version. like prompt password.
     
    kcm4web, Jan 7, 2011 IP