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.
57 lines
1.4 KiB
57 lines
1.4 KiB
<?php
|
|
session_start();
|
|
include("init.php");
|
|
|
|
if(isset($_SESSION["role"])){
|
|
if($_SESSION["role"] != 1){
|
|
header("Location: /?error=2");
|
|
}
|
|
}
|
|
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Navštěvní kniha</title>
|
|
</head>
|
|
<body>
|
|
<h1>Návštěvní kniha - ADMIN</h1>
|
|
|
|
<?php
|
|
include "menu.php";
|
|
?>
|
|
<hr>
|
|
<!-- PHP výpis pro příspěvky -->
|
|
<h2>Příspěvky</h2>
|
|
<?php
|
|
$sql = "SELECT nk_prispevky.id, nk_users.username, nk_prispevky.title, nk_prispevky.msg, nk_prispevky.created, nk_users.role
|
|
FROM nk_prispevky
|
|
INNER JOIN nk_users ON nk_prispevky.id_nk_users = nk_users.id
|
|
ORDER BY nk_prispevky.id DESC";
|
|
$result = mysqli_query($conn,$sql);
|
|
|
|
if (mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)){
|
|
echo "<p>id:".$row["id"].";title".$row["title"]."</p>";
|
|
}
|
|
}
|
|
?>
|
|
|
|
<h2>Users</h2>
|
|
<?php
|
|
|
|
$sql = "SELECT * FROM nk_users";
|
|
$result = mysqli_query($conn,$sql);
|
|
|
|
if (mysqli_num_rows($result) > 0) {
|
|
while ($row = mysqli_fetch_assoc($result)){
|
|
echo "<p>id:".$row["id"]."; user:".$row["username"]."</p>";
|
|
}
|
|
}
|
|
|
|
?>
|
|
</body>
|
|
</html>
|