View file forum/showtopic.php

File size: 11.2Kb
<?php
ERROR_REPORTING(0);
require("../init.php");
$id=(int)$_GET["id"];
if($id<1)
{header("location: ../index.php?msg=Your%20Comment%20Is%20Too%20long");
exit();}
$level=user_info($user, level);
$username=user_info($user, username);
//TOPIC DETAILS
$tquery=mysql_query("SELECT * FROM b_topics WHERE id=$id");
$tnum=mysql_num_rows($tquery);
if($tnum==0)
{header("location: topics.php?msg=Your%20Comment%20Is%20Too%20long");}
$tinfo=mysql_fetch_assoc($tquery);
$fid=$tinfo["forumid"];
$title=$tinfo["subject"];
$author=$tinfo["poster"];
$tmessage=$tinfo["message"];
if(!isloggedin())
{ $tmessage="<div class='msg'><center><b><marquee scrolldelay='200'><font size='5'>THREAD LOCKED</font></marquee></b></br><a href='".$config->url."register.php' target='_blank' title='REGISTER'><u><font color='red'>REGISTER</font></u></a> OR <a href='".$config->url."relogin.php' target='_blank' title='LOGIN'><u><font color='red'>LOGIN</font></u></a><br> TO VIEW THIS THREAD</center></div>";
} else { $tmessage="$tmessage";}
$tmessage=bbcode($tmessage);
$tmessage=smiley($tmessage);
$locked=$tinfo["locked"];
$tdate=$tinfo["date"];
$tdate=date("h:i D, d M Y", $tdate);
$tid=$tinfo["id"];
$hints=$tinfo["hints"]+1;
mysql_query("UPDATE b_topics SET hints='$hints' WHERE id='$tid'");
$rank=getrank($level);
//FORUMS
$finfo=mysql_fetch_assoc(mysql_query("SELECT * FROM b_forums WHERE id=$fid"));
$fname=$finfo["name"];
$fid=$finfo["id"];
echo"<title>$config->title &raquo; Forum &raquo; $title</title>";
echo"<style type='text/css'><!--
.style2 {font-family: Arial, Helvetica, sans-serif; color: #FF0000; font-size: 12px;}
.style3 {color: #FF0000}
.style5 {color: #FF0000; font-weight: bold;}
body,td,th {font-family: Arial, Helvetica, sans-serif; font-size: 13px;}
--></style>
<div class='body_width'>";
include"../topnav.php";
echo"<div class='breadcrumb'><a href='../index.php'>Home</a> &raquo; <a href='index.php'>Forum</a> &raquo; <a href='topics.php?id=$fid'>$fname</a> &raquo; $title</div><br/>";
echo"<center>";
include"../ads.php";
fblike();
echo"</center>";
$msg=$_GET["msg"];
if(!empty($msg))
{echo"<div class='msg'>$msg</div>";}
if(isset($_POST["submit"]))
{$poster=$_POST["poster"];
$topicid=$_POST["topicid"];
$message=$_POST["message"];
$date=time();
//CLEAN
if(strlen($message)>200)
{header("location: topics.php");
exit();}
if(strlen($message)<2 || empty($message))
{echo"<div class='msg'>Your message is too short</div>";}
else
{$topicid=cleanvalues($topicid);
$message=cleanvalues($message);
$insert=mysql_query("INSERT INTO b_replies SET poster='$poster', date='$date', topicid='$id', message='$message'");
mysql_query("UPDATE b_topics SET lastposter='$poster', lastpostdate='$date' WHERE id=$id");
if(!$insert)
{$msg3="An error occured";}
else
{$kquery=mysql_fetch_array(mysql_query("SELECT * FROM b_users WHERE username='$poster'"));
$cd=$kquery["rate"]+5;
mysql_query("UPDATE b_users SET rate=$cd Where username='$poster'");
$msg3="Reply Successfully Added";}
echo"<div class='msg'>$msg3</div>";}}
//REPLIES
$self=$_SERVER["PHP_SELF"];
$rowsperpage=10;
$range=7;
if(isset($_GET["currentpage"]) && is_numeric($_GET["currentpage"]))
{$currentpage=(int)$_GET["currentpage"];}
else
{$currentpage=1;}
$offset=($currentpage-1)*$rowsperpage;
$numrows=mysql_num_rows(mysql_query("SELECT * FROM b_replies WHERE topicid=$id"));
$totalpages=ceil($numrows/$rowsperpage);
if($currentpage>$totalpages)
{$currentpage=$totalpages;}
if($currentpage<1)
{$currentpage=1;}
$rquery=mysql_query("SELECT * FROM b_replies WHERE topicid=$id ORDER BY id Asc LIMIT $offset, $rowsperpage");$rnum=mysql_num_rows($rquery);
echo"</center>";
?>
<?php
echo"<div style='margin-top: 5px;' class='grid3'>";
if($browser!='mobile')
echo'';
echo"</div>";
?>
<?php
echo"<div class='grid3 middle'>
<div id='post-info'>Forum &raquo; $fname</div>
<div class='thread'>
<div class='thread-main-post'>
<div id='post-head'>$title <br/> <span class='st_sharethis_hcount' displayText='ShareThis'></span>
<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_linkedin_hcount' displayText='LinkedIn'></span>
<span class='st_email_hcount' displayText='Email'></span></div>
<div id='post-info'>
<span class='left'>Total Views: $hints</span> &nbsp; | &nbsp; <span class='right'>Total Replies: $numrows</span>
<div class='clearfix'></div></div>";
$onlinequery=mysql_query("SELECT DISTINCT * FROM b_onlineforum WHERE id=$id"); echo"<ul><li><select><option>Users In Here</option>";
while($row=@mysql_fetch_array($onlinequery))
{
$netvision=$row["netvision"];
echo"<option>$netvision</option>";
} echo"</select></li></ul>";

$pavt=user_info($author, photo);
while($row=@mysql_fetch_array($onlinequery))
{
$netvision=$row["netvision"];
echo"<option>$netvision</option>";
} echo"</select></li></ul>";

$pavt=user_info($author, photo);
if(empty($pavt))
{$pavt="../images/nophoto.png";}
else
{$pavt="../avatars/$pavt";}
$uid=user_info($author, userID);
$coins=getworth($author);
$post=user_info($author, rate);
$recent=date("U")-9000;
$lasttime=cleanvalues2(user_info($author, lasttime));
if($recent<$lasttime)
{
$on="<font color='#00ff00'>&bull;</font>";
}
else
{
$on="<font color='red'>&bull;</font>";
}
$rating=getrating($post);
$llv=user_info($author, level);
if($llv==0)
{$rnk='<img style="vertical-align: middle" src="../images/novice.png"/>';}
else
if($llv==1)
{$rnk='<img style="vertical-align: middle" src="../images/crown2.png"/>';}
else
if($llv==2)
{$rnk='<img style="vertical-align: middle" src="../images/crown3.png"/>';}
$rcount=mysql_num_rows(mysql_query("SELECT * FROM b_replies WHERE poster='$author'"));
$tcount=mysql_num_rows(mysql_query("SELECT * FROM b_topics WHERE poster='$author'"));
if($level>1)
{if($locked==0)
{$link2="<a href='action.php?action=movetopic&tid=$tid'>MOVE</b></a> - <a href='action.php?action=lock&id=$tid'><b>LOCK</b></a> - <a href='action.php?action=edittopic&tid=$tid'><b>EDIT</b></a> - <a href='tag2.php?action=update&tid=$tid'><b>TAG</b></a>";}
else
{$link2="<a href='action.php?action=movetopic&id=$tid'><b>MOVE</b></a> - <a href='action.php?action=unlock&id=$tid'><b>UNLOCK</b></a> - <a href='action.php?action=edittopic&id=$tid'><b>EDIT</b></a> - <a href='tag2.php?action=update&tid=$tid'><b>TAG</b></a>";}}
echo"<div id='main-post'>
<table class='info_post' width='100%'><tbody><tr>
<td><a href='$pavt'><img src='$pavt' alt='Photo' height='70' width='50'/></a></td>
<td><a href='../profile.php?uid=$uid'>$rnk <b>$author $on</b></a> ($coins) <br/> <b>Rank</b>: $rating <br/> <b>Created Topics</b>: $tcount <br/> <b>Replies</b>: $rcount</td></tr></tbody></table>
<br/>Posted on: $tdate <br/> $tmessage <br/> $like <br/> $link2</div>";
echo"<div class='info_post'><b><font color='red'>$username</font></b> <b>Please Click on the share & like button above to share this topic with your friends</b></div>
<h3 class='comment_header'><font color='#ffffff'>Replies. No Spamming Plz.</h3></font>";
if($rnum==0)
{echo"<div class='msg'>No reply yet. Be the first of all your friends to Reply below and gain #5 <b><font color='red'>JL</font></b> Credit Instantly</div>";}
else
{while($rinfo=mysql_fetch_assoc($rquery))
{$poster=$rinfo["poster"];
$topicid=$rinfo["topicid"];
$favt=user_info($poster, photo);
if(empty($favt))
{$favt="../images/nophoto.png";}
else
{$favt="../avatars/$favt";}
$plev=user_info($poster, level);
if($plev==0)
{$rnk='<img style="vertical-align: middle" src="../images/novice.png"/>';}
else
if($plev==1)
{$rnk='<img style="vertical-align: middle" src="../images/crown2.png"/>';}
else
if($plev==2)
{$rnk='<img style="vertical-align: middle" src="../images/crown3.png"/>';}
$uid=user_info($poster, userID);
$coins=getworth($poster);
$posts=user_info($poster, rate);
$rate=getrating($posts);
$recent=date("U")-2000;
$lasttime=cleanvalues2(user_info($poster, lasttime));
if($recent<$lasttime)
{
$on2="<font color='#00ff00'>&bull;</font>";
}
else
{
$on2="<font color='red'>&bull;</font>";
}

$rcount=mysql_num_rows(mysql_query("SELECT * FROM b_replies WHERE poster='$poster'"));
$tcount=mysql_num_rows(mysql_query("SELECT * FROM b_topics WHERE poster='$poster'"));
$pid=$rinfo["id"];
$message=$rinfo["message"];
$date=$rinfo["date"];
$date=date("h:i D, d M Y", $date);
//BBCODE
$message=smiley(cleanvalues2($message));
$message=bbcode($message);
if(isloggedin())
{$quote="<div align='center'><a href='quote.php?action=copy&id=$pid&tid=$tid'><img src='../images/quote.png' alt='[Quote]'/></a></div>";}
$link="<a href='action.php?action=delete&id=$pid&tid=$tid'>Delete</a> - <a href='action.php?action=edit&id=$pid&tid=$tid'>Edit</a>";
$link0="";
$link4=($level>0) ? $link : $link0;
$query=mysql_fetch_array(mysql_query("SELECT * FROM b_topics WHERE id=$topicid"));
$subject=$query["subject"];
echo"<div id='posts'>
<table class='info_post' width='100%'><tbody><tr>
<td><a href='$favt'><img src='$favt' alt='Photo' height='70' width='50'/></a></td>
<td><a href='../profile.php?uid=$uid'>$rnk <b>$poster $on2</b></a> ($coins) <br/> <b>Rank</b>: $rate <br/> <b>Created Topics</b>: $tcount <br/> <b>Replies</b>: $rcount</td></tr></tbody></table>
<br/>Posted on: $tdate <br/> $message <br/> $quote <br/> $link4</div>";}
echo"<div class='pager'>";
if($currentpage>1)
{echo"<a href='$self?currentpage=1&id=$id'>[<b>First</b>]</a>";
$prevpage=$currentpage-1;
echo"<a href='$self?currentpage=$prevpage&id=$id'>[<b>Prev</b>]</a>";}
for($x=($currentpage-$range); $x<(($currentpage+$range)+1); $x++)
{if(($x>0) &&($x<=$totalpages))
{if($x==$currentpage)
{echo"[<font color='red'>$x</font>]";}
else
{echo"<a href='$self?currentpage=$x&id=$id'>[<b>$x</b>]</a>";}}}
if($currentpage!=$totalpages)
{$nextpage=$currentpage+1;
echo"<a href='$self?currentpage=$nextpage&id=$id'>[<b>Next</b>]</a>";
echo"<a href='$self?currentpage=$totalpages&id=$id'>[<b>Last</b>]</a>";}
echo"</div>";}
if($locked==0)
{if(isloggedin())
{echo"<p><span class='style2'>Please do not spam, else you might lose your  account!</span></p>
<b><u>Reply</u></b>
<center><a href='".$config->url."content/bbcodes.php'>Design Post</a> | <a href='".$config->url."content/smileys.php'>Add Smileys</a></center>
<form action='#' method='POST'>
<input type='hidden' name='topicid' value='$id'>
<input type='hidden' name='poster' value='$user'>
<textarea name='message'></textarea>
<br/><input type='submit' name='submit' value='Reply' class='button'></form>";}
else
{echo "<div class='msg'><font color='red'>Please <a href='".$config->url."relogin.php' target='_blank' title='LOGIN'><u>LOGIN</u></a> or <a href='".$config->url."register.php' target='_blank' title='REGISTER'><u>REGISTER</u></a> To Add Replies</font></div>";}}
else
{echo"<div class='msg'><font color='red'><b>This topic has been locked by an Admin</b></font></div>";}
$rel=mysql_query("SELECT * FROM b_topics WHERE MATCH(subject) AGAINST('$title') LIMIT 5");
if(mysql_num_rows($rel)<0)
{echo"";}
else
{echo"<br/><div class='b_head'>Similar Topics</div>";
echo"<ul class='file-cat-list'><li>";
while($rel2=mysql_fetch_assoc($rel))
{$reltitle=$rel2["subject"];
$relid=$rel2["id"];
echo"<a href='showtopic.php?id=$relid'>$reltitle</a><hr/>";}}
echo"</li></ul>";
echo"</div></div>";
include"../footer.php";
?>