Thursday, February 11, 2010

Making a hardcoded Admin Password gateway using PHP


hardcoded Admin Password gateway using PHP

First you will use a form to pass

the $pw variable to the php script. When entering passwords into forms it is a
good idea to use the "password" input box instead of the "text" one, so that as
you type there are asterisks in place of the input. Something like this will
work fine:

Using a hardcoded admin

pasword system

The HTML for the above form looks like:

<form method="

Arial;color:blue">POST"
action="example18.php3"
color:black">>
<div
color:red">align="left"
color:black">><p><
Arial;color:purple">font face="
Arial;color:blue">BankGothic Md BT
color:red">">Admin password?</font>
<input type="
Arial;color:blue">password"
name="pw"
blue" style="font-family:Arial;">14
color:red">"><input type="
Arial;color:blue">submit"
value="Submit"
color:black">></p>
</div><
Arial;color:purple">/form>

Now the php code to check the submitted password versus the hardcoded one is:

<?
$adminpass = "test123";
if ($pw == $adminpass)
{
print("Welcome to the administration area!");
}
else
{
print("Wrong password");
}
?>

No comments:

Post a Comment