184 lines
6.5 KiB
PHP
184 lines
6.5 KiB
PHP
<?php
|
|
require("function.php");
|
|
require("layout.php");
|
|
$thread=mysqli_query($con,"SELECT * FROM threads WHERE id = $_GET[id]");
|
|
$users=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM users"));
|
|
|
|
$threads=mysqli_fetch_array($thread);
|
|
$forums=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM forums WHERE id = $threads[forum]"));
|
|
$view=mysqli_query($con,"UPDATE threads SET views = views + 1 WHERE id = $_GET[id]");
|
|
|
|
// $ranks=readranks();
|
|
// $threads[$id][2]++;
|
|
$tccellha="<td bgcolor=$tableheadbg";
|
|
$tccellhb="><center>$fonthead";
|
|
$postlist="$tccellha width=150$tccellhb"."User</font></td>";
|
|
$postlist.="$tccellha colspan=2$tccellhb"."Post</td><tr>";
|
|
$threadpostcount=0;
|
|
$forumid=mysqli_fetch_array(mysqli_query($con,"SELECT threads.forum,threads.id,forums.id FROM forums INNER JOIN threads ON forums.id=threads.forum AND threads.id=$_GET[id]")) or die('error');
|
|
$i=0;
|
|
$ppp=999;
|
|
if ($logpassword!="") {
|
|
$ppp=999;
|
|
if ($ppp==0) { $ppp=999; }
|
|
}
|
|
|
|
|
|
if ($_GET['page']=="") {
|
|
$page=0;
|
|
} else {
|
|
$page=$_GET['page'];
|
|
|
|
}
|
|
|
|
/*
|
|
$min=$ppp*$page;
|
|
$page1=$page+2;
|
|
$ppp=$page1*$ppp;
|
|
$pagelinks="";
|
|
$nposts=mysqli_num_rows(mysqli_query($con,"SELECT id FROM posts WHERE thread = $_GET[id]"));
|
|
|
|
for ($i=0; $i<($nposts/$ppp); $i++) {
|
|
if ($i==$page) {
|
|
$pagelinks.=($i+1)." ";
|
|
} else {
|
|
$pagelinks.="<a href=thread.php?id=$_GET[id]"."&page=$i".">".($i+1)."</a> ";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
*/
|
|
$posts=mysqli_query($con,"SELECT * FROM posts WHERE thread = $_GET[id]");
|
|
while($post = mysqli_fetch_array($posts)){
|
|
$userpost=mysqli_fetch_array(mysqli_query($con,"SELECT users.*, posts.* FROM users INNER JOIN posts ON users.id = posts.user AND posts.id=$post[id]")) or die('error');
|
|
if ($post['thread']==$_GET['id']) {
|
|
$edited=0;
|
|
if ($post['lastedit'] && $post['edituser']) {
|
|
$edited=true;
|
|
$edituser=mysqli_fetch_array(mysqli_query($con,"SELECT id,name FROM users WHERE id = $post[edituser]"));
|
|
}
|
|
|
|
|
|
|
|
$threadpostcount++;
|
|
$bg=$tablebg1;
|
|
if (round($threadpostcount/2)==$threadpostcount/2) {
|
|
$bg=$tablebg2;
|
|
}
|
|
if ($threadpostcount>($page*$ppp) and $threadpostcount<=(($page+1)*$ppp)) {
|
|
if ($threadpostcount>($page*$ppp+1)) {
|
|
$postlist.="<tr>";
|
|
}
|
|
$tcellbg="<td bgcolor=$bg valign=top";
|
|
// $user=$users[$post[1]];
|
|
/*
|
|
if ($userpost[title]=="") {
|
|
|
|
if ($user[powerlevel]==0) {
|
|
$userrank=$user[title];
|
|
$r=0;
|
|
$userrank="";
|
|
while ($ranks[$r][0]!="" and $ranks[$r][0]<($user[0]+1)) {
|
|
$userrank=$ranks[$r][1];
|
|
$r++;
|
|
}
|
|
|
|
}
|
|
$userrank="";
|
|
if ($userpost[powerlevel]==1) {
|
|
$userrank="Moderator";
|
|
}
|
|
if ($userpost[powerlevel]==2) {
|
|
$userrank="Administrator";
|
|
}
|
|
} else {
|
|
$userrank=$userpost[title];
|
|
}
|
|
*/
|
|
$quote="<a href=newreply.php?id=$_GET[id]&postid=$post[id]>Quote</a>";
|
|
// if ($threads[$id][3]==1 or $forumid<0) {
|
|
// $quote="";
|
|
// }
|
|
$edit="";
|
|
if (($loguserid>0 and $post['user']==$loguserid) and $logpassword!="" and $forumid>-1 and $threads['closed']!=1) {
|
|
$edit=" | <a href=editpost.php?id=$post[id]></s>Edit</s></a> | <a href=editpost.php?id=$post[id]&action=delete></s>Delete<s></a>";
|
|
}
|
|
// if ($loguserid>1 and $logpassword!="") {
|
|
// $ip=" | IP: $post[ip]</a>";
|
|
// }
|
|
$userpicture="<img width=60 src=\"$userpost[picture]\">";
|
|
if ($userpost['picture']=="") {
|
|
$userpicture="";
|
|
}
|
|
$postnum="$post[5]"."/";
|
|
if ($post[5]==0) {
|
|
$postnum="";
|
|
}
|
|
|
|
if ($userpost['sex']==0) { $namecolor="color=$malecolor"; }
|
|
if ($userpost['sex']==1) { $namecolor="color=$femalecolor"; }
|
|
if ($userpost['sex']==2) { $namecolor="face=$font size=-1"; }
|
|
|
|
$userrank=$userpost['title'];
|
|
$postdate=date("m-d-y h:i A",$post['date']+$tzoff);
|
|
$postlist.="$tcellbg rowspan=2>$fonttag<a href=profile.php?id=$userpost[user]><font $namecolor>$userpost[name]</font></a>$smallfont<br>$userrank<br>$userpicture<br>";
|
|
$postlist.="Posts: $userpost[posts]</td>";
|
|
$postlist.="$tcellbg height=1><a id=\"$post[id]\"></a>$smallfont"."Posted on $postdate ";
|
|
if ($edited) $postlist.=" <i>(Last edited on ".date("m-d-y h:i A",$post['lastedit']+$tzoff)." by <a href=profile.php?id=$edituer[id]>$edituser[name]</a>)";
|
|
|
|
$postlist.="</td>$tcellbg height=1 nowrap>$smallfont<a href=thread.php?id=$_GET[id]#$post[id]>Link</a> | $quote$edit]<tr>";
|
|
$postlist.="$tcellbg height=120 colspan=2>$fonttag$userpost[postheader]<br>$post[text]<br><br><hr width=150 align=left>$userpost[signature]</td>";
|
|
$edited=0;
|
|
}
|
|
}
|
|
$i++;
|
|
}
|
|
|
|
print $header;
|
|
print "<table border=0 width=100%><td align=left>$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forumid[id]>$forums[title]</a> - ".$threads['title']."</td><td align=right>$smallfont"; if ($forumid>-1) {
|
|
$loguser=mysqli_fetch_array(mysqli_query($con,"SELECT * FROM users WHERE id = '$loguserid'"));
|
|
$modoptions="";
|
|
if ($loguserid!="" and $logpassword!="" and $forumid[id]>-1 and $loguser['debug']==1) {
|
|
$modoptions="<br><a href=editthread.php?id=$_GET[id]>Edit thread<a>";
|
|
}
|
|
print "$modoptions<br>";
|
|
print "<a href=newthread.php?id=$threads[forum]>New Thread</a>";
|
|
|
|
if ($threads[closed]!=1) {
|
|
print " | <a href=newreply.php?id=$_GET[id]>New Reply</a>";
|
|
} else {
|
|
print " | Thread closed";
|
|
}
|
|
|
|
}
|
|
|
|
print "</td></table></center>
|
|
$smallfont"."Pages: Nope $pagelinks<center>
|
|
<table border=0 bgcolor=$tableborder width=$tablewidth align=center cellpadding=0 cellspacing=0>
|
|
<td>
|
|
<table border=0 cellpadding=2 cellspacing=1 width=100% bgcolor=$tableborder>
|
|
";
|
|
|
|
print "$postlist
|
|
</noscript></noembed></embed></noembed></noscript>
|
|
</table>
|
|
</td>
|
|
</table>
|
|
</center>$smallfont"."Pages: Nope $pagelinks<center>
|
|
<table border=0 width=100%><td align=left>$fonttag<a href=index.php>$boardname</a> - <a href=forum.php?id=$forumid[id]>$forums[title]</a> - ".$threads[title]."</td><td align=right>$smallfont";
|
|
if ($forumid[id]>-1) {
|
|
print "<a href=newthread.php?id=$threads[forum]>New Thread</a>";
|
|
if ($threads[closed]!=1) {
|
|
print " | <a href=newreply.php?id=$_GET[id]>New Reply</a>";
|
|
} else {
|
|
print " | Thread closed";
|
|
}
|
|
print "$modoptions";
|
|
}
|
|
print "</td></table>
|
|
";
|
|
|
|
print "$footer<br>";
|
|
rendertime();
|
|
?>
|