-
Notifications
You must be signed in to change notification settings - Fork 1
/
session.php
52 lines (28 loc) · 1.04 KB
/
session.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
44
45
46
47
48
49
50
51
<?php
session_start();
if (array_key_exists("userIn", $_COOKIE)) {
$_SESSION['id'] = $_COOKIE['userIn'];
}
if (array_key_exists("id", $_SESSION)) {
include 'connect.php';
$query = "Select `content` from users WHERE email = '" . mysqli_real_escape_string($link, $_SESSION['id']) . "'";
$row = mysqli_fetch_array(mysqli_query($link, $query));
$diaryContent = $row['content'];
} else {
header("location: index.php");
}
include 'header.php';
$today = date('m/d/y h:i:s A');
?>
<nav class="navbar navbar-toggleable-md navbar-light bg-faded navbar-fixed-top">
<a class="navbar-brand" href="#">Secret Diary</a>
<div id="test">
<a class="float-lg-right" href='index.php?Logout=1'><button class="btn btn-outline-success my-2 my-sm-0" type="submit">Log Out</button></a>
</div>
</nav>
<div class="container diaryContainer">
<textarea id="diary" class="form-control"><?php echo $diaryContent.' '.$today.'-> ';?></textarea>
</div>
<?php
include 'footer.php';
?>