I saw the tutorial on how to make simple register/lof in/log off system in the tutorials section, but it didn't work. Anyways I would like to know how to make just a simple password box and a button..if the password is correct then you enter in the next page. I can make it with JavaScript, but if someone views the source it can be easily detected, so I would like to use PHP.. any one can help me please?
i guess it's like this
i hope it helpedCode:<?php
// You must define your password below
$password = "dang";
$pass = $_POST['pass'];
$enter = $_POST['enter'];
if(isset($enter) && $pass == $password){
// Change this http:// thingy to your page address
header("Location: http://yoursite.com");
}elseif(isset($enter) && $pass != $password){
echo "Your password is wrong!<br>";
echo "<form action='' method='post'>"
."Password: <input type='text' name='pass' size='30'>"
."<input type='submit' name='enter' value='Enter'>"
."</form>";
}else{
echo "<form action='' method='post'>"
."Password: <input type='text' name='pass' size='30'>"
."<input type='submit' name='enter' value='Enter'>"
."</form>";
}
?>![]()
Last edited by Jaan; 06-05-2007 at 12:17 PM.
You could always use .htaccess for this as well.
yea.. .htaccess is better for it![]()
Well thanks for helping me. Umm anyways I'm having 'problems' with .htaccess if you can help please see this:-
http://forum.codecall.net/search-eng...endly-url.html
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks