-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlogged.php
More file actions
30 lines (24 loc) · 960 Bytes
/
logged.php
File metadata and controls
30 lines (24 loc) · 960 Bytes
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
<?php
session_start();
include("connection.php");
// user is successfully logged in
if((array_key_exists("username",$_SESSION) && $_SESSION["username"]!="")){
$query="SELECT * FROM `users` WHERE `email`='".$_SESSION["username"]."'";
$result=mysqli_query($link,$query);
$row=mysqli_fetch_array($result);
$diarycontent=$row["Message"];
$username=explode("@",$_SESSION["username"]);
}
//If user is not logged in
else{
header("Location: index.php");
}
include("header.php");
?>
<div class="navigation">
<div class="logo">Secret Diary</div>
<div class="logout"><a href="index.php?signout=1"><button class="btn" id="logoutbutton">Log Out</button></a></div>
<div class="username"><h6>Hello <span id="user"><?php echo $username[0]; ?></span></h6></div>
</div>
<div class="textarea"><textarea id="diarycontent"><?php echo $diarycontent ?></textarea></div>
<?php include("footer.php");?>