Jump to content

Password Protected Page


laado

Recommended Posts

if you don't care about setting sessions you can just have a php form with method=post and action=passwordprotectedpage.php .... then on that page you can get the values from the form and see if they match up with whatever you want them too.... if you are only using a password.. can be something like this for example<?phpif($_POST['password'] == "mypassword"){?> This is information that will be shown if the correct password was submitted<?php}else{ echo "Password is incorrect.";}?>

Link to comment
Share on other sites

can you explain it further??

if you don't care about setting sessions you can just have a php form with method=post and action=passwordprotectedpage.php .... then on that page you can get the values from the form and see if they match up with whatever you want them too.... if you are only using a password.. can be something like this for example<?phpif($_POST['password'] == "mypassword"){?> This is information that will be shown if the correct password was submitted<?php}else{ echo "Password is incorrect.";}?>
Link to comment
Share on other sites

yourpage.php

<html><head><title></title></head><body><?phpif($_POST['password'] == "mypassword"){?>This is information that will be shown if the correct password was submitted<?php}else{?><form action='yourpage.php' method='post'>Password: <input type='password' name='password'><br /><input type='submit' value='Submit'></form><?php}?></body></html>

Link to comment
Share on other sites

in and if/else PHP statement, what code would you put in if you wanted the person to be redirected to a page based on whether or not the provided the right information/password?nm, a simple google search did it for me.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...