-
This is a rudimentary Password approach. Three seperate scripts.
You must have PHP.
******This PHP script is run at a local server to generate a Hash. This should not be on the Prod site.
<?php
$pwd = "MyPassword"; // this page generates the hash code for the password
$hash = md5($pwd);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Password Generator</title>
</head>
<body>
<?php echo $hash ?>
</body>
</html>
***** This page is a logon screen where the user would enter the Password used above
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form action="AnterPDFIndex.php" method="post" name="PWDform" target="_self">
<input name="userPWD" type="text" />
<input name="goBtn" type="submit" value="View PDF" />
</form>
</body>
</html>
******* This is the form processing script. User must enter correct password to get Hashes to match
<?php
session_start(); // must be written prior to sending any page headers to browser
$pwd = $_POST['userPWD'];
$hash = md5($pwd);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Successful Logon page</title>
</head>
<body>
<?php
if ($hash != "48503dfd58720bd5ff35c102065a52d7") { // This is the hash generated by genPwd.php
?>
Sorry you are not authorized to view this page.
Password Incorrect.
<?php return;
}
?>
Logon successful Add further HTML here.
</body>
</html>
[/code]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks