0

I just really can't figure out what I am doing wrong. Localy it works fine but when I use it on my websever it doesnt work anymore. so if anyone can help me figure out what mistake I am making it would really help me out.

<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;
      }
    }
}
?>
Praveen Kumar Purushothaman
  • 164,888
  • 24
  • 203
  • 252

0 Answers0