PHP Password Problem.
Posted: Sun Feb 15, 2009 9:51 am
Hey i am trying to do a basic login, i know its not the most secure but i dont need it to be for what i am doing.
1. My first prob is when you are typing in the password it is appearing to the user.... i want it hidden, i do have <input type="hidden"> but doesnt seem to be working.
2. if you enter in the incorrect password it still goes onto the next page no matter what u type in.
Any help would be great.
Thanks
F
1. My first prob is when you are typing in the password it is appearing to the user.... i want it hidden, i do have <input type="hidden"> but doesnt seem to be working.
2. if you enter in the incorrect password it still goes onto the next page no matter what u type in.
Any help would be great.
Thanks
F
Code: Select all
<h1> Administration Log in </h1>
<div id="box2" align="center">
<?php error_reporting (E_ALL ^ E_NOTICE); ?>
<?php
$form_posted=$_POST['form_posted'];
if ($form_posted==1)
{
$user=$_POST['user'];
$pass=$_POST['pass'];
if (($user=="fom") && ($pass=="123"))
{
Echo "Login Successful";
echo "";
}
else
{
?>
<form action="form.php" METHOD="POST" onsubmit="return validate_form(this)" >
<table>
<tr>
<td colspan=2> Login Details Incorrect Please try again</td>
</tr>
<tr>
<td><label>Username</label></td>
<td> <input name="user" /></td>
</tr>
<tr>
<td><label>Password</label></td>
<td> <input name="pass"/></td>
<td> <input type="hidden" name="form_posted" value="1"/></td>
</tr>
<tr>
<td><INPUT class="button" name="submit" TYPE="submit" value="Submit"></td>
</tr>
</table></form> </body></html>
<?php
}
}
else
{
?>
<form action="reports.php" METHOD="POST" onsubmit="return validate_form(this)">
<table><tr>
<td><label>Username</label></td>
<td> <input name="user" /></td>
</tr>
<tr>
<td><label>Password</label></td>
<td> <input name="pass"/></td>
<td> <input type="hidden" name="form_posted" value="1"/></td>
</tr>
<tr>
<td><INPUT class="button" name="submit" TYPE="submit" value="Submit"></td>
</tr>
</table></form> </body></html>
<?php
}
?>