I am in the process of creating a simple PHP-CMS. I have of course also created a simple login Form, which as you can see uses an SQL query to check if the Username and Password that are typed in match, etc.
This worked fine for months now until recently I changed something in this file (I cannot remember what: Sorry) and now all I get when I enter the correct username/password is a whitescreen! I have enabled errorreporting in PHP but I get nothing
Can someone help me/check my code for the error?
Many thanks in advance!
this here is the PHP loginpanel.php file.
<?php
error_reporting(E_ALL);
ob_start();
if(isset($_POST["SubmitBtn"]))
{
$username = $_POST["Name"];
$password = $_POST["Pass"];
$pdo = new PDO("mysql:host=fdb6.awardspace.net;dbname=1645626_cms","***","****");
$query = $pdo->prepare("SELECT * FROM T_Users WHERE Username = :username AND Password = :password");
$query->bindParam(":username", $username);
$query->bindParam(":password", $password);
$query->execute();
// geneste if voor het inloggen indien aan de voorwaarde hierboven voldaan word+countdown/welkomstbericht
if($result = $query->fetch(PDO::FETCH_OBJ))
{
echo "Welcome " .$result->Username. "!";
echo '<p>You will be logged in in 5 seconds.</p>';
session_start();
$_SESSION["Name"] = $username;
header("Location:http://stuff.romulus310ftp.dx.am/CMS/login/adminpanel.php");
}
else
{
echo "You entered the wrong password or username. Please try again.";
}
}
// ifje voor de registratie-countdown
if (isset($_POST["RegistrateBtn"]))
{
echo '<p>You will be redirected in 5 seconds.</p>';
header("Location:http://stuff.romulus310ftp.dx.am/CMS/login/registrationpanel.php");
}
?>
And this is its' HTML
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CMS by Romulus</title>
<link rel="stylesheet" type="text/css" href="CSS/style.css">
</head>
<body>
<form action="#" method="post" class="form">
Name: <input type="text" name="Name">
</br>
Passw: <input type="password" name="Pass">
</br>
<input type="submit" value="Enter" name="SubmitBtn">
<input type="submit" value="Register" name="RegistrateBtn">
</form>
</body>
</html>
EDIT: I found out I get the error "Fatal error: Uncaught exception 'PDOException' with message 'could not find driver'" which according to a friend of mine means there is a problem at my host. Is this true?