You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
612 B
25 lines
612 B
<?php
|
|
session_start();
|
|
require("init.php");
|
|
|
|
|
|
$username = $_POST["username"];
|
|
$pw = $_POST["pw"];
|
|
|
|
$sql = "SELECT * FROM nk_users
|
|
WHERE username='$username' AND password='$pw'";
|
|
$result = mysqli_query($conn, $sql);
|
|
|
|
if(mysqli_num_rows($result) == 1) {
|
|
$row = mysqli_fetch_assoc($result);
|
|
|
|
$_SESSION["logged"] = 1; // stav přihlášení
|
|
$_SESSION["username"] = $row["username"]; // zobrazované jméno
|
|
$_SESSION["role"] = $row["role"]; //hodnota role
|
|
$_SESSION["userid"] = $row["id"]; // jednodušší write
|
|
|
|
header("Location: /");
|
|
} else {
|
|
header("Location: login.php?error=1");
|
|
}
|
|
?>
|