Hello.
This is my CMS login page; login.php:
<?php
$servername = "localhost";
$dbname = "mydbname";
$dbusername = "mydbusername";
$dbpassword = "mydbpassword";
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $dbusername, $dbpassword);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$username = $_POST['username'];
$password = $_POST['password'];
$password = md5($password);
$sql = "SELECT * FROM Users WHERE Username = '$username";
$result = $conn->query($sql);
if $password == $result {
header("Location: admin-area.php");
}
$conn->exec($sql);
}
catch(PDOException $e)
{
echo $sql . "<br>" . $e->getMessage();
}
$conn = null;
?>
<html>
<head>
<title>Login Page</title>
</head>
<body>
<form action="admin-area.php" method="post">
Username: <input type="text" name="username"><br>
Password : <input type="text" name="password"><br>
<input type="submit" value="submit">
</form>
</body>
But when i type the complete url of login.php page in the browser, i face with a blank page without the login form. Where is the problem?!