<?php
include 'db.php';
ini_set('display_errors',1);
error_reporting(E_ALL);
if (isset ($_POST['auth']))
{
$nick = $_POST['login'];
$password = $_POST['password'];
$user = $db->query("SELECT (id, pName, pPassword) FROM users WHERE pName = '" . $nick . "'");
if ($user['pName'] && $user['pPassword'] == $password)
{
$_SESSION['logged_user'] = $user;
header ("Location /index.php");
}
else echo 'ERROR 1';
}
?>