Jump to content

Enter Password first

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
4 replies to this topic

#1
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
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?

#2
Guest_Jaan_*

Guest_Jaan_*
  • Guests
i guess it's like this

<?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
Lop

Lop

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,172 posts
You could always use .htaccess for this as well.

#4
Guest_Jaan_*

Guest_Jaan_*
  • Guests
yea.. .htaccess is better for it ^^

#5
TcM

TcM

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 11,147 posts
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