<?php
  session_start();
  $cockDatabase = "dulow";
  $host = "localhost";
  $user = "root";
  $password = "";

  $conn = new mysqli($host,$user,$password,$cockDatabase);
  if($conn->connect_error){
      die("Verbindung fehlgeschlagen: " . $conn->connect_error);
  }
  $sql = "SELECT id FROM users WHERE user='". $_POST['user'] .
         "' AND pw='". $_POST['pw'] ."' ";
  $result = $conn->query($sql);
  // echo $result->fetch_array()['id'];
  if ($result->num_rows == 1) {
    $_SESSION['id'] = $result->fetch_array()['id'];
  }
  header('Location: /');
?>
