-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
52 lines (48 loc) · 1.42 KB
/
index.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
52
<!-- Home page. App starts here. -->
<?php
include('config.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="assets/style.css" rel="stylesheet" title="Style" />
<title>Home</title>
</head>
<body>
<div class="content">
<?php
//We display a welcome message and, if the user is logged in, we display the username
?>
Hello
<membername>
<?php
if(isset($_SESSION['username'])) {
echo ' '.htmlentities($_SESSION['username'], ENT_QUOTES, 'UTF-8');}
?>
</membername>!
<br />
Welcome on our very secure, much safe, so fancy messaging system.<br /><br />
<?php
//If the user is logged in, we display links to see the list of users, his/her pms and a link to log out
if (isset($_SESSION['username'])) {
echo 'Please see here for a <a href="users.php">list of all users</a> you can send a message to.<br /><br />';
echo '<a href="new_pm.php" class="link_new_pm">Write new message</a><br />';
//We display the links
?>
<a href="mailbox.php" class="link_new_pm">Mailbox</a>
<br /><br />
<a href="logout.php">Logout</a>
<?php
}
else {
//Otherwise, we display a link to sign up / log in
?>
<a href="login.php">Log in</a><br />
<a href="sign_up.php">Sign up</a>
<?php
}
?>
</div>
</body>
</html>