It has been 2 weeks that I started learning Php and I am enjoying it . But right now I am having a little bit problem with my codes. I created this login page that compares password generated randomly with input password . $password is the random password generated and it displays well when I execute the page.. But the problem is when I compare it with $POST['Username'] ,i can't login. But when I compare $POST['Username'] with some strings "abc" , I can access the login page. Where did I go wrong.. Could you help me please.. I appreciate your help ..Here is the code.
<?
session_start();
include("random_password.php");
$rand_pass=$password;
if($_POST['Submitted']=='True')
{
// If the username match up, then continue...
if ( $POST['Username']==$rand_pass) {
// Username matched, set them as logged in and set the Username to a session variable.
$SESSION['Logged_In'] = "True";
}
}
// If they are NOT logged in then show the form to login...
if ($_SESSION['Logged_In'] != "True") {
echo "<br>";
echo"<b>Please login:</b> <br>";
echo "<form method=post action=" .$_SERVER['PHP_SELF'] . ">
Username: <input type=textbox name=Username><br />
<input type=hidden name=Submitted value=True>
<input type=Submit name=Login>
</form>";
}
else
echo "You are logged in as: blah blah blah...<b>";
?>