-
Notifications
You must be signed in to change notification settings - Fork 2
/
home.php
89 lines (83 loc) · 2.61 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
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
<?php include("db_connect.php") ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<LINK href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body>
<?php
if(isset($_SESSION['username']))
{
echo('
<div class="header">
<img src="logo.jpg"/>
</div>
<div class="body">
<table padding-left="5px" cellspacing="0">
<tr><td class="blank"></td>
<td class="tab1">home</td>
<td class="tab2"><a href="profile.php">profile</a></td>
<td class="tab3"><a href="calendar.php">calendar</a></td>
<td class="tab4"><a href="groups.php">groups</a></td>
<td class="login"><font color="#ffffff">welcome! | </font><a href="logout.php"> logout</a>');
include('searchbar.html');
echo("</td></tr></table>");
echo("
<table cellspacing='0'><tr><td class='content'>
<a href='events.php'>View Events</a>
");
//key time title value author
$query = "SELECT * FROM news order by time desc";
$result = mysqli_query($db,$query);
while($row = mysqli_fetch_array($result))
{
$title = $row['title'];
$content = str_replace("\n","<br>",$row['value']);
$time = $row['time'];
$author = $row['author'];
$id = $row['id'];
echo("<h2>$title</h2><h5>$content</h5>");
}
echo('</td></tr></div>');
echo('</body>');
}
else
{
echo('<body>
<div class="header">
<img src="logo.jpg"/>
</div>
<div class="body">
<table cellspacing="0"><tr><td>
<table padding-left="5px" cellspacing="0">
<tr>
<td class="blank"></td>
<td class="tab1">home</td>
<td class="tab2"><a href="register.php">register</a></td>
</tr>
</table></td>
<td><table width="63px"><tr><td></td></tr></table></td><td><table cellspacing="0" class="login2">
<tr><form action="login.php" method="post">
<td padding-left="60px">username:<br/><input type="textfield" name ="username" size="16" maxlength="16"/></td>
<td>password:<br/><input type="password" name="password" size="16" maxlength="16"/><input type="submit" value="login"></></td>
</tr>
</table></td></tr>
</table>');
$query = "SELECT * FROM news order by time desc";
$result = mysqli_query($db,$query);
echo('<table cellspace="0">');
echo("<td class='content'>");
while($result && $row = mysqli_fetch_array($result))
{
$title = $row['title'];
$content = str_replace("\n","<br>",$row['value']);
$time = $row['time'];
$author = $row['author'];
$id = $row['id'];
echo("<h2>$title</h2><h5>$content</h5>");
}
echo('</td></tr></div>');
echo('</body>');
}
?>
</html>