我真的无法弄清楚我做错了什么。 Localy它工作正常但是当我在我的websever上使用它时它不再起作用了。所以,如果有人能帮助我弄清楚我犯了什么错,那真的会帮助我。
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<h1>poll met cms</h1>
<form class="user-form" action="" method="post">
inlognaam: <input type="text" name="inlognaam"><br>
wachtwoord: <input type="password" name="wachtwoord"><br>
<input type="submit" name="opslaan">
<a href="./registratie.php">Register</a>
<a href="./wachtwoord_vergeten.php">Wachtwoord vergeten</a>
</body>
</html>
<?php
ob_start();
session_start();
require_once("./database.php");
$db = Database::getConnection();
if(isset($_POST['opslaan'])) {
if($_POST['inlognaam'] != '' && $_POST['wachtwoord'] != '') {
$inlognaam = $_POST['inlognaam'];
$wachtwoord = $_POST['wachtwoord'];
$result1 = $db->prepare("SELECT * FROM gebruiker WHERE inlognaam = '".$inlognaam."' AND wachtwoord = '".$wachtwoord."'");
$result1->execute();
$result = $result1->fetchAll();
if($result)
{
$id = $result[0]['id'];
$_SESSION["logged_in"] = true;
$_SESSION["inlognaam"] = $inlognaam;
$_SESSION["id"] = $id;
header("Location: ./admin.php");
exit;
}
}
}
?>