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?
Enter Password first
Started by TcM, Jun 05 2007 04:44 AM
4 replies to this topic
#1
Posted 05 June 2007 - 04:44 AM
|
|
|
#2
Guest_Jaan_*
Posted 05 June 2007 - 11:12 AM
Guest_Jaan_*
i guess it's like this
i hope it helped ^^
<?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>";
}
?>
i hope it helped ^^
#3
Posted 13 June 2007 - 05:03 AM
You could always use .htaccess for this as well.
#4
Guest_Jaan_*
Posted 13 June 2007 - 06:37 AM
Guest_Jaan_*
yea.. .htaccess is better for it ^^
#5
Posted 14 June 2007 - 07:02 AM
Well thanks for helping me. Umm anyways I'm having 'problems' with .htaccess if you can help please see this:-
http://forum.codecal...iendly-url.html
http://forum.codecal...iendly-url.html


Sign In
Create Account


Back to top









