-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.php
More file actions
101 lines (83 loc) · 2.54 KB
/
main.php
File metadata and controls
101 lines (83 loc) · 2.54 KB
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
<?php
session_start();
require "./Controller/func.php";
if (!isset($_SESSION['login'])) {
session_unset();
session_destroy();
header("Location: ./login.php");
exit();
}
else{
sesschk();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Binus CurCol</title>
<link rel="stylesheet" href="./Assets/mainstyle.css">
<script>
function logOut() {
var targetURL = 'login.php';
window.location.href = targetURL;
}
function profile() {
var targetURL = 'profile.php';
window.location.href = targetURL;
}
function send() {
var targetURL = 'send.php';
window.location.href = targetURL;
}
</script>
<style>
.username {
display: flex;
flex-direction: row;
font-size: 15px;
font-weight: bold;
margin-left: 10px;
margin-bottom: 10px;
}
.message{
display: flex;
flex-direction: row;
font-size: 12px;
margin-left: 10px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div class="top-bar" >
<a class="bcc-txt">Binus Curcol</a>
<div class="buttons">
<button class="exit-btn" onclick="send()"> Create Post </button>
<button class="exit-btn" onclick="profile()"> Profile </button>
<form action="./Controller/exit.php" method="POST">
<button class="exit-btn" > Log Out </button>
</form>
</div>
</div>
<div class="container">
<div class="box">
<?php
require "./Controller/conn.php";
$stmt = $conn->prepare("SELECT * FROM post JOIN users ON post.user_id = users.id
WHERE post.user_id IS NOT NULL;");
$stmt->execute();
$result = $stmt->get_result();
while($row = $result->fetch_assoc()){
?>
<div class="username"><?php echo $row["Username"];?></div>
<div class="message"><?php echo $row["message"];?></div>
<?php
}
?>
</div>
</div>
<script src="./Assets/mainscript.js"></script>
</body>
</html>