php Login page error
Posted: Sat Feb 04, 2012 11:24 pm
Someone help me on this....
I want to check the username and password i enter in to the form.
The problem i face is, though i submit the form with wrong password 'success_page.php' get processed.
Here is my codes.....
This is login.php
And this is success_page.php
I want to check the username and password i enter in to the form.
The problem i face is, though i submit the form with wrong password 'success_page.php' get processed.
Here is my codes.....
This is login.php
Code: Select all
<?php
error_reporting(0);
$username = "jawahar";
$password = "welcome";
if(isset($username) && isset($password)) {
if(($username = $_REQUEST['username']) && ($password = $_REQUEST['password']))
{
header('location:success_page.php');
}
else
{
$msg = "Login failed!";
}
}
else
{
$username = "";
$password = "";
}
?>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<div align="center">
<form name="loginfrm" action="" method="post">
User Name: <input type="text" name="username" /><br /><br>
Password : <input type="password" name="password" /><br /><br>
<input type="submit" name="submit" value="Login" />
<div align="center"><?php echo $msg; ?></div>
</form>
</div>
</body>
</html>
And this is success_page.php
Code: Select all
<html>
<head>
<title>Login success</title>
</head>
<body>
<div align="center" style="color:#FF0000; font-size:20px;">
You have Successfully Logged in!...
</div>
</body>
</html>