3 changed files with 130 additions and 0 deletions
@ -0,0 +1,55 @@ |
|||||
|
-- Adminer 4.7.6 MySQL dump |
||||
|
|
||||
|
SET NAMES utf8; |
||||
|
SET time_zone = '+00:00'; |
||||
|
SET foreign_key_checks = 0; |
||||
|
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO'; |
||||
|
|
||||
|
DROP TABLE IF EXISTS `nk_log`; |
||||
|
CREATE TABLE `nk_log` ( |
||||
|
`id` int(11) NOT NULL, |
||||
|
`id_nk_users` int(11) unsigned NOT NULL, |
||||
|
`logintime` datetime NOT NULL, |
||||
|
KEY `id_nk_users` (`id_nk_users`), |
||||
|
CONSTRAINT `nk_log_ibfk_1` FOREIGN KEY (`id_nk_users`) REFERENCES `nk_users` (`id`) |
||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; |
||||
|
|
||||
|
|
||||
|
DROP TABLE IF EXISTS `nk_prispevky`; |
||||
|
CREATE TABLE `nk_prispevky` ( |
||||
|
`id` int(11) NOT NULL AUTO_INCREMENT, |
||||
|
`id_nk_users` int(11) unsigned NOT NULL, |
||||
|
`title` varchar(128) COLLATE utf8_czech_ci NOT NULL, |
||||
|
`msg` text COLLATE utf8_czech_ci NOT NULL, |
||||
|
`created` datetime NOT NULL, |
||||
|
PRIMARY KEY (`id`), |
||||
|
KEY `id_nk_users` (`id_nk_users`), |
||||
|
CONSTRAINT `nk_prispevky_ibfk_1` FOREIGN KEY (`id_nk_users`) REFERENCES `nk_users` (`id`) |
||||
|
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; |
||||
|
|
||||
|
INSERT INTO `nk_prispevky` (`id`, `id_nk_users`, `title`, `msg`, `created`) VALUES |
||||
|
(1, 3, 'Lorem 1', 'Lorem Ipsum supres', '2023-03-01 23:36:52'), |
||||
|
(2, 2, 'Lorem 11', 'Lorem ipsumus loremos spravenost', '2023-03-01 23:37:30'), |
||||
|
(3, 2, 'Lorem 12', 'Luromes jolontos procentos', '2023-03-01 23:37:40'), |
||||
|
(4, 9, 'Test z PHP', 'LOREM lipsum', '2023-03-09 10:12:35'), |
||||
|
(5, 10, 'Hodnocení', 'Je to tu boží, mám to tady rád ☺', '2023-03-09 10:22:39'); |
||||
|
|
||||
|
DROP TABLE IF EXISTS `nk_users`; |
||||
|
CREATE TABLE `nk_users` ( |
||||
|
`id` int(11) unsigned NOT NULL AUTO_INCREMENT, |
||||
|
`username` varchar(32) COLLATE utf8_czech_ci NOT NULL, |
||||
|
`password` varchar(64) COLLATE utf8_czech_ci NOT NULL, |
||||
|
`role` int(3) NOT NULL, |
||||
|
PRIMARY KEY (`id`) |
||||
|
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8 COLLATE=utf8_czech_ci; |
||||
|
|
||||
|
INSERT INTO `nk_users` (`id`, `username`, `password`, `role`) VALUES |
||||
|
(1, 'admin', 'admin', 1), |
||||
|
(2, 'user1', 'user1', 5), |
||||
|
(3, 'user2', 'user2', 5), |
||||
|
(4, 'mod1', 'mod1', 3), |
||||
|
(5, 'mod2', 'mod2', 3), |
||||
|
(9, 'asd', 'asd', 5), |
||||
|
(10, 'xyz', 'xyz', 5); |
||||
|
|
||||
|
-- 2023-03-09 09:24:37 |
@ -0,0 +1,43 @@ |
|||||
|
<?php |
||||
|
session_start(); |
||||
|
include("init.php"); |
||||
|
?> |
||||
|
<!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>Document</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<h1>Registrace</h1> |
||||
|
<?php |
||||
|
include "menu.php"; |
||||
|
?> |
||||
|
<?php |
||||
|
if(isset($_GET["error"])){ |
||||
|
if ($_GET["error"] == "1") { |
||||
|
echo "<h2>Hesla nejsou stejná</h2>"; |
||||
|
} |
||||
|
} |
||||
|
?> |
||||
|
<form action="action_reg.php" method="post"> |
||||
|
<label for="username">Přihlašovací jméno:</label><br> |
||||
|
<input type="text" name="username" id="username"> |
||||
|
<br> |
||||
|
|
||||
|
<label for="pw1">Heslo:</label><br> |
||||
|
<input type="password" name="pw1" id="pw1"> |
||||
|
<br> |
||||
|
|
||||
|
<label for="pw2">Opakovat heslo:</label><br> |
||||
|
<input type="password" name="pw2" id="pw2"> |
||||
|
<br> |
||||
|
|
||||
|
<br> |
||||
|
<input type="submit" value="Registrovat"> |
||||
|
|
||||
|
</form> |
||||
|
</body> |
||||
|
</html> |
@ -0,0 +1,32 @@ |
|||||
|
<?php |
||||
|
session_start(); |
||||
|
include("init.php"); |
||||
|
|
||||
|
if(!isset($_SESSION["logged"])){ |
||||
|
header("Location: /?error=3"); //error 3 = přístup odepřen |
||||
|
} |
||||
|
?> |
||||
|
<!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>Zápis do knihy</title> |
||||
|
</head> |
||||
|
<body> |
||||
|
<h1>Zápis do knihy</h1> |
||||
|
<?php |
||||
|
include "menu.php"; |
||||
|
?> |
||||
|
<form action="action_write.php" method="post"> |
||||
|
<label for="title">Nadpis:</label><br> |
||||
|
<input type="text" name="title" id="title"><br> |
||||
|
|
||||
|
<label for="msg">Zpráva do knihy:</label><br> |
||||
|
<textarea name="msg" id="msg" cols="30" rows="10"></textarea> |
||||
|
<br> |
||||
|
<input type="submit" value="Zapsat do knihy"> |
||||
|
</form> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue