Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- if(isset($_GET['logout'])) {
- session_destroy();
- header('Location: login.php');
- }
- $server = 'localhost';
- $user = 'root';
- $password = 'heslo';
- $db = 'test';
- $conn = new mysqli($server, $user, $password, $db);
- function jmeno() {
- $jmeno = $_SESSION['username'];
- echo $jmeno;
- }
- //isAdmin
- $jmeno = NULL;
- if(!empty($_SESSION['username'])) {
- $jmeno = $_SESSION['username'];
- }
- $sql = "SELECT * FROM login WHERE username = '$jmeno'";
- $vysledek = $conn->query($sql);
- if($vysledek->num_rows > 0) {
- while($rows = $vysledek->fetch_assoc()) {
- $is_Admin = $rows['isAdmin'];
- }
- if($is_Admin == 0) {
- $is_Admin = 0;
- $_SESSION['admin'] = $is_Admin;
- $rank = 'Nezaregistrovaný';
- }
- if($is_Admin == 1) {
- $is_Admin = 1;
- $_SESSION['admin'] = $is_Admin;
- $rank = 'Hráč';
- }
- if($is_Admin == 2) {
- $is_Admin = 2;
- $_SESSION['admin'] = $is_Admin;
- $rank = 'Majitel';
- }
- if($is_Admin == 3) {
- $is_Admin = 3;
- $_SESSION['admin'] = $is_Admin;
- $rank = 'Admin';
- }
- if($is_Admin == 4) {
- $is_Admin = 4;
- $_SESSION['admin'] = $is_Admin;
- $rank = 'Helper';
- }
- if($is_Admin == 5) {
- $is_Admin = 5;
- $_SESSION['admin'] = $is_Admin;
- $rank = 'Moderator';
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement