-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhome.php
53 lines (43 loc) · 1.34 KB
/
home.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
53
<?php
session_start();
include 'dbh.php';
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link rel="stylesheet" type="text/css" href="home.css">
</head>
<body>
<div id="main">
<h1 style="background-color: #6495ed;color:white;"> <?php echo
$_SESSION['name']?>-online</h1>
<div class="output">
<?php
$sql = "SELECT * FROM posts ";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "" . $row["name"]. " " .":: " . $row["msg"]." --" .$row["date"]. "<br>";
echo "<br>";
}
} else{
echo "0 results";
}
$conn->close();
?>
</div>
<form method="post" action="send.php">
<textarea name="msg" placeholder="Type the message to send....."
class="form-control"></textarea><br>
<input type="submit" value="Send">
</form>
<br>
<form action="logout.php">
<input style="width: 100%; background-color: #6495ed; color:white; font-size: 20px;" type ="submit" value = "Logout">
</div>
</body>
</html>