View Single Post
Old 07-13-2006, 04:35 AM   PM User | #1
jamesplato
New Coder

 
Join Date: Jul 2006
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
jamesplato is an unknown quantity at this point
Simple Log In Page, No SQL or Cookies.

Here is a simple login script I found ...I am not an expert in PHP (yet)...I do not have any idea how to add an error message, when one enters the wrong pasword, but this script is very easy and simple...though might not be the most secure....it will keep the average looker out Works for Mozilla& IE

PHP Code:
<?php

// Define your username and password
$username "someuser";
$password "somepassword";

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

?>

<h1>Login</h1>

<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">


<label for="txtUsername">Username:</label>

<input type="text" title="Enter your Username" name="txtUsername" /></p>



<label for="txtpassword">Password:</label>

<input type="password" title="Enter your password" name="txtPassword" /></p>



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

</form>

<?php

}
else {

?>



This is the protected page. Your private content goes here.</p>

<?php

}

?>
Source: TotallyPHP (http://www.totallyphp.co.uk)

Last edited by jamesplato; 07-13-2006 at 05:01 AM..
jamesplato is offline   Reply With Quote