-
Notifications
You must be signed in to change notification settings - Fork 0
/
header.php
executable file
·43 lines (43 loc) · 1.11 KB
/
header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
if(!isset($_SESSION)) {
session_start();
}
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once 'database.php';
$isLog = !empty($_SESSION["uid"]);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>ToDo.list</title>
<link rel="stylesheet" type="text/css" href="style.css" />
<script src="js/jquery-3.1.1.min.js"></script>
</head>
<body>
<div id="ocwrap">
<header>
<div id="logo"><img src="Images/LogoV2.png"></div>
<h1>ToDo list</h1>
</header>
<nav id="top">
<a href="index.php">Home</a>
<?php if (!$isLog)
echo '<a href="login.php">Login</a>
<a href="register.php">Register</a>'; ?>
<?php if($isLog){
echo '<a href="settings.php">';
$db = new Database();
$stmt = $db->prepare("SELECT username FROM users WHERE userid = :uid;");
$stmt->bindValue(":uid", $_SESSION["uid"], SQLITE3_INTEGER);
$sqlResult = $stmt->execute();
$result = $sqlResult->fetchArray();
echo $result["username"];
echo '</a>' . "\n";
echo "\t\t" . '<a href="folder.php">Folder</a>' . "\n";
}
?>
<?php if($isLog) echo '<a href="logout.php">Logout</a>'; ?>
</nav>
<main>