-
Notifications
You must be signed in to change notification settings - Fork 0
/
topic.php
74 lines (59 loc) · 1.2 KB
/
topic.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
<?php
session_start();
require('connect.php');
if(@$_SESSION["username"])
{
?>
<html>
<head>
<title>Home page</title>
</head>
<body>
<?php include("header.php"); ?>
</body>
<center>
<br />
<a href="post.php"><button>Post topic</button></a>
<br />
<br />
<?php
if($_GET["id"])
{
$check = mysql_query("SELECT * FROM topics WHERE topic_id='".$_GET['id']."'");
//echo $topic_creator;
if(mysql_num_rows($check))
{
while($row = mysql_fetch_assoc($check))
{
$check_u = mysql_query("SELECT * FROM users WHERE user_name ='".$row['topic_creator']."'");
while($row_u = mysql_fetch_assoc($check_u))
{
$get_user_id = $row_u['user_id'];
}
echo "<h2>".$row['topic_name']."</h2>";
echo "<h5>By <a href='profile.php?id=$get_user_id'>".$row['topic_creator'].'</a>',"</h5>";
echo "<h5>Date: ".$row['post_date']."<h5>",'<br />';
echo "<h4>".$row['topic_content']."<h4>",'<br />';
}
}
else
{
echo "topic not found";
}
}
else
{
header("Location: index.php");
echo "not found.";
}
?>
<body>
</body>
</html>
<?php
}
else
{
echo "You must logged in.";
}
?>