-
Notifications
You must be signed in to change notification settings - Fork 10
/
Forum_View.php
160 lines (133 loc) · 4.24 KB
/
Forum_View.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
151
152
153
154
155
156
157
158
159
160
<?php require("Left.php"); ?>
<html>
<head>
</head>
<body>
<?php require("_Forum_view.php"); ?>
<form method="post" id="topicform" name="topicform" action="Forum_View.php?id=<?php echo $_GET['id'];?>">
<br>
<table width="90%" border="1">
<tr>
<td><?php echo htmlentities($row['title'])." - ".$row['name']."";?>
<?php
if ($row['name'] == $name or in_array($name, $admin_array)){
$sql = "SELECT * FROM topics WHERE id = '" .mysql_real_escape_string(stripslashes($_GET['id'])). "'";
$res = mysql_query($sql) or die(mysql_error());
$row = mysql_fetch_array($res);
if( $row['locked'] == 1){
echo "<a href=\"Forum_Edit.php?action=edit&id=" . $_GET['id'] . "\" onFocus=\"if(this.blur)this.blur()\"> ( Edit</a>";
echo " - ";
echo "<a href=\"Forum_View.php?action=lock&id=" . $_GET['id'] . "\" onFocus=\"if(this.blur)this.blur()\">Lock Topic )</a>";
}// if row is locked.
}// if name is name poster.
?>
</span></td>
</tr>
<tr>
<td><table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr>
<td align="left" ></td>
</tr>
<tr>
<td align="left"><?php
$row['message'] = htmlentities($row['message']);
$row['message'] = nl2br($row['message']);
$row['message'] = stripslashes($row['message']);
echo $row['message']; ?></td>
</tr>
</table></td>
</tr>
</table>
<br />
<?php
$csql = "SELECT * FROM replys WHERE tid ='" .mysql_real_escape_string($_GET['id']). "' ORDER BY id DESC";
$cres = mysql_query($csql) or die(mysql_error());
while ($row = mysql_fetch_array($cres)){
?>
<table width="90%" border="1">
<tr>
<td><?php
echo "".$row['name']." Wrote: ";
if(in_array($name, $admin_array)){
echo "<a href=\"Forum_View.php?action=Rreply&rid=".$row['id']."&id=" . $_GET['id'] . "\" onFocus=\"if(this.blur)this.blur()\">( x )</a>";
}
?></td>
</tr>
<tr>
<td><?php
$row['message'] = htmlentities($row['message']);
$row['message'] = nl2br($row['message']);
$row['message'] = stripslashes($row['message']);
$row['comment'] = htmlentities($row['comment']);
$row['comment'] = nl2br($row['comment']);
$row['comment'] = stripslashes($row['comment']);
echo $row['message'];
?>
<br />
<?php
echo $row['comment'];
?></td>
</tr>
</table>
<br />
<?php
}
?>
<br />
<table width="450" border="0" align="center" cellspacing="0">
<tr>
<td width="150" align="left"><?php
if( $page > 1){
$previouspage = $page - 1;
echo "<input type=\"button\" onClick=\"window.location='Forum_View.php?id=".$_GET['id']."&page=".$previouspage."'\" value=\"Previous.\" onFocus=\"if(this.blur)this.blur()\">";
}
?></td>
<td width="150" align="center"><?php
$numofpages = ceil($totaltopics / $amount);
?></td>
<td width="150" align="right"><?php
if($page < $numofpages){
if(empty($_GET['page'])){ $page == "1";}
$pagenext = $page + 1;
echo "<input type=\"button\" onClick=\"window.location='Forum_View.php?id=".$_GET['id']."&page=".$pagenext."'\" value=\"Next.\" onFocus=\"if(this.blur)this.blur()\">";
}
?></td>
</tr>
</table>
<br />
<table width='90%' border='1' align='center'>
<tr align='left'>
<td align='center'>Reply in topic</td>
</tr>
<tr align='left'>
<td align='center'><textarea name="message" cols="50" rows="10" />
</textarea>
<?php if(isset($_POST['Preview'])){ echo htmlspecialchars($_POST['message']); } ?>
</textarea></td>
</tr>
<?php if(isset($_POST['Preview'])){ ?>
<tr>
<td align='left'>Preview:</td>
</tr>
<tr>
<td align='center'><?php
$preview_message = $_POST['message'];
$preview_message = htmlentities($preview_message);
$preview_message = nl2br($preview_message);
echo $preview_message;
?></td>
</tr>
<?php } ?>
<tr align='left' >
<td align='center'><table width="200" border="0" align="right" cellspacing="0">
<tr>
<td width="100" align="center"><input name="Reply" type="submit" value="Reply." onFocus="if(this.blur)this.blur()"/></td>
<td align="center"><input name="Preview" type="submit" id="Preview" value="Preview." onFocus="if(this.blur)this.blur()"/></td>
</tr>
</table></td>
</tr>
</table>
</form>
</body>
</html>
<?php require("Right.php"); ?>