PDA

View Full Version : Help Password



Jamieb
01-10-2007, 09:13 PM
Hey.. iv got a page.. i want people to have to use a pass to get on.. i want it to be just a pass box.. no username.. how do i do this?

Recursion
01-10-2007, 09:15 PM
just make one username and password in the cpanel HTACCESS Pword Directory thing. Or there is a PHP code to match a code that it put into a box with a code say in a MySQL database then if its correct, forward the user to a page, if incorrect, display an error message. I suck at PHP so don't ask me ;]

Florx
02-10-2007, 12:09 AM
.htaccess is the easiest by far

Colin-Roberts
02-10-2007, 12:17 AM
Something like this would work:

<?php
$password = "somepassword";

if ($_POST['txtPassword'] != $password) {

?>

<h1>Login</h1>

<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<p><label for="txtpassword">Password:</label>
<br /><input type="password" title="Enter your password" name="txtPassword" /></p>

<p><input type="submit" name="Submit" value="Login" /></p>

</form>

<?php

}
else {

?>

page goes here.

<?php

}

?>

Want to hide these adverts? Register an account for free!