- Impact
- 31
This is an alternative to Javascript and all other ways of password identification for a page view! You can also use MySQL for multiple kinds of passwords, but if you only want a couple, this is the way to go: (This requires NO MySQL)
-Thanks
-RageD
PHP:
<?php
// Let's define the page that we will see the login form & page title
$pagetitle = "Page Title Here";
if($page == ""){ ?>
<HTML>
<TITLE><?php echo($pagetitle); ?></TITLE>
<BODY>
<form name="login" method="post" action="?page=login">
Password: <input type=password name="password"><br>
<input type=submit value="Login"><input type=reset>
</form>
</BODY>
</HTML>
<?php
// Let's end that section with the following bracket
}
// Start the login page
if($page == "login"){
// The value '$password' comes from name="password" in the password field
if($password !== "PasswordHere"){
echo('Incorrect Password');
exit;
}
else{
echo('You are now logged in!! Page content goes here!');
}
}
?>
-Thanks
-RageD
Last edited: