-
Notifications
You must be signed in to change notification settings - Fork 1
/
topic.php
150 lines (132 loc) · 4.58 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
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<html>
<head>
<title>Complete Discussion</title>
<link rel="stylesheet" type="text/css" href="css/topic.css">
<style>
.divigr:hover{
background-color:#e6f2ff;
width:51.5%;
transition-duration: 0.4s;
}
button.but
{
position:fixed;top:300px;right:0px;
background-color:#4CAF50;
color: white;
font-family: verdana;
font-size: 17px;
height:45px;
width:105px;
cursor: pointer;
transition-duration: 0.4s;
transition:width 2s;
}
button.but:hover
{
background-color:#2A88AD;
color:white;
width:200px;
}
</style>
</head>
<body>
<div style="border:1px solid black; width:42%; height:200px; border-radius:10px; position:fixed; top:85px; right:32px; border-width:2px;">
<div style="background-color:#f2f2f2; height: 29px; border-radius:10px 10px 0 0;"><p align="center" style="text-align:center; margin-left:180px; margin-top:3px; font-weight:bold; font-size:25px;">Latest Discussions....</p></div>
<hr style="width:2px;">
<a href="posts.php">
<button type="button" class="but" >POST</button>
</a>
<?php
include 'connect.php';
$query=mysql_query("SELECT * FROM topics ORDER BY topic_date DESC LIMIT 3");
while($row = mysql_fetch_assoc($query))
{
$topic=$row['topic_subject'];
$id=$row['topic_id'];
// echo "<p>$topic</p><br>";
echo "<p ><a href='topic.php?posts_topic=$id' style='text-decoration:none; color:black; font-size:22px; font-weight:black; margin-left: 20px; '>
".$topic." </a><br><br>";
}
?>
</div>
<?php
include 'connect.php';
include 'nvgbar.php';
$topicid=$_GET['posts_topic'];
$query = mysql_query("SELECT * FROM topics WHERE topic_id='$topicid'");
if(!$query)
{
echo 'error';
}
else
{
while($row = mysql_fetch_assoc($query))
{
$name=$row['topic_subject'];
$descr=$row['topic_descr'];
$date=$row['topic_date'];
$date2=date('d-m-Y', strtotime($date));
$cat=$row['topic_cat'];
$by=$row['topic_by'];
$query4=mysql_query("SELECT username FROM users WHERE id='$by'");
$row4= mysql_fetch_assoc($query4);
$username=$row4['username'];
echo "<div class='heading' style='background-color:#f2f2f2;
width:51.5%; margin-left:15px'><h1 style='text-align:left; color:black; font-size: 40px;'>   $name</h1>
<br>
<p style='font-size:20px; font-weight:bold;'>    $descr</p>
<br><br>
<p style='font-size:15px; font-weight:bold;'>     Asked by:</p> <p style='font-size:15px; font-weight:bold; color:blue;'>$username</p>     <p style='font-size:15px; font-weight:bold;'>On:</p> <p style='font-size:15px; font-weight:bold; color:blue;'>$date2</p>
<br>
<p style='font-size:15px; font-weight:bold; font-color:blue;'>      in:</p><p style='font-size:15px; font-weight:bold; color:blue;'>$cat</p></div>";
}
}
/* <p><?php echo $descr; ?></p>
<p>Asked by:</p> <p><?php echo $username; ?></p><p>On:</p> <p><?php echo $date; ?></p>
<p>in:</p><p><?php echo $cat; ?></p>*/
$query2 = mysql_query("SELECT * FROM posts WHERE posts_topic='$topicid' ORDER BY posts_date ASC");
$numrows = mysql_num_rows($query2);
echo "<br><p style='font-size:21px; font-weight:bold; color:black;'>   $numrows Replies</p><br><br><br>";
if(!$query2)
{
echo 'error';
}
else
{
while($row2= mysql_fetch_assoc($query2))
{
echo"<hr style='width:51.5%; float:left; size:2px; margin-left:0px'><br><br>";
$content=$row2['posts_content'];
$date=$row2['posts_date'];
$by=$row2['posts_by'];
$query3=mysql_query("SELECT username FROM users WHERE id='$by'");
$row3= mysql_fetch_assoc($query3);
$name=$row3['username'];
echo "<div class='divigr'><br><br>";
echo "<p style='color:blck; font-size:20px; margin-left:15px'> $name<p><br><br>";
echo "<p style='font-size:20px;font-color:silver; font-weight:bold; margin-left:15px'> $content<p><br><br><p style='font-size:15px; font-weight:bold; margin-left:15px'> replied on:</p> ";
echo date('d-m-Y', strtotime($date));
echo "<br>";
echo "</div>";
}
}
?>
<br><br><br>
<p style='font-size:20px; font-weight:bold; color:blue; margin-left:15px;'>Know the answer:</p>
<form method="post" action="reply.php?id1=<?php echo $topicid; ?>" class="woohoo">
<fieldset class="account-info">
<label>
Reply
</label>
<textarea rows="7" cols="90" name="reply" class="textarea">
</textarea>
<br>
</fieldset>
<fieldset class="account-action">
<input class="btn" type="submit" name="submit" value="Reply" >
</fieldset>
</form>
<br><br><br><br><br>
</body>
<?php include 'footer.php'; ?>
</html>