boldbaba Posted December 5, 2009 Share Posted December 5, 2009 Hey everyone. I have a question. I have script that seems to have come from phpfreaks it is a members script. it allows people to set up a membership on there website. I have everything set up fine and it is all working. The problem i have is the password section. At the moment they have a register form and then they get an email with there encrypted password sent from phpmyadmin. They then login and go to the members section. But lets say my members section was called members.html when i go the browser and type in that url anyone can get in. How do i set it up that it is password protected page but allow the customer to use the password that they received from phpmyadmin. Thanks everyone for your help John Quote Link to comment Share on other sites More sharing options...
oni-kun Posted December 5, 2009 Share Posted December 5, 2009 You would simply create a session, disallowing any use not logged in (within the session with the authenticated password you can pull from the database), than it will disallow access to members.php.. if ($_SESSION['loggedin'] == false) { echo "You must first log in to view this page!"; } else { echo "Welcome ".$_SESSION['username']." to the members area!" } Simple example, and you can set the session in login.php etc. redirecting to members.php. IF you want it to remain HTML, than you'll need to write a long script to parse a .htpassword from that.. but that's more HTTP than php. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.