Code:
<?php
// **********************************************************************
// Rusnak PHP Adoptables Script
// Copyright 2009 Brandon Rusnak
// For help and support: http://www.rusnakweb.com/forum/
//
// Redistribution prohibited without written permission
// File ID: profile.php
// Shows a user profile, or a member list.
// **********************************************************************
// Wake the sleeping giant
// **********************************************************************
// Basic Configuration Info
// **********************************************************************
include("inc/functions.php");
include("inc/config.php");
include("lang/lang.php");
$themeurl = "templates/forumtemp.html";
// **********************************************************************
// Define our top links by calling getlinks()
// **********************************************************************
$links = getlinks();
// **********************************************************************
// Define our ads by calling getads()
// **********************************************************************
$ads = getads("any");
// **********************************************************************
// Grab any dynamic article content from the content table
// **********************************************************************
$article_title = $pagecontent[title];
$article_content = $pagecontent[content];
$article_content = nl2br($article_content);
// **********************************************************************
// Grab any settings that we will need for the current page from the DB
// **********************************************************************
$browsertitle = grabanysetting("browsertitle");
$sitename = grabanysetting("sitename");
$slogan = grabanysetting("slogan");
// **********************************************************************
// Check and see if the user is logged in to the site
// **********************************************************************
$loginstatus = logincheck();
$isloggedin = $loginstatus[loginstatus];
$loggedinname = $loginstatus[username];
// **********************************************************************
// End Prepwork - Output the page to the user
// **********************************************************************
// This page handles user profiles and shows the site members...
$query = "SELECT * FROM ".$prefix."messages WHERE touser='".$loggedinname."' and status='unread'";
$result = mysql_query($query);
$num = mysql_numrows($result);
if($num > 0){
$msg = "
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#F9AE00' class='ftable'>
<td>
<table width='888px' border='1' cellpadding='3' cellspacing='1' bordercolor='1' bgcolor='#FECF61'>
<tr>
<td><center>You have a new message(s): <a href='messages.php'>Visit Message Center</a>(<b>".$num."</b>)<br></center></td>
</tr>
</table>
</table><br>";
}
$table = "".$msg."<br>".$article_content."";
$status2 = "".grabanysetting("status")."";
$reason2 = "".grabanysetting("reason")."";
if($status2 == "1") {
$article_content = "
<table>
<table width='100%' border='1'>
<tr>
<td width='100' align='center'><strong>Your Administrator has turned the board offline. If your administrator has listed a reason, it is given below:</strong></td>
</tr>
<tr>
<td width='100' align='center'><strong>".$reason2."</strong></td>
</tr></table></table><br>";
}
else {
$id=$_GET['id'];
$query = "SELECT * FROM forum_question WHERE id='".$id."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$fid=@mysql_result($result,$i,"fid");
$tname=@mysql_result($result,$i,"name");
$tname = stripslashes($name);
$query = "SELECT * FROM forum WHERE fid='".$fid."'";
$result = mysql_query($query);
$topic=@mysql_result($result,$i,"topic");
$ftopic = "".$topic."";
// get value of id that sent from address bar
$fid=$_GET['fid'];
$id=$_GET['id'];
$query = "SELECT * FROM forum_question WHERE id='".$id."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
while ($i < $num) {
$topic=@mysql_result($result,$i,"topic");
$fid=@mysql_result($result,$i,"fid");
$id=@mysql_result($result,$i,"id");
$detail=@mysql_result($result,$i,"detail");
$name=@mysql_result($result,$i,"name");
$datetime=@mysql_result($result,$i,"datetime");
$status=@mysql_result($result,$i,"status");
$topic = stripslashes($topic);
$detail = stripslashes($detail);
$name = stripslashes($name);
$name = "".$name."";
$fid = "".$fid."";
$signature = getsignature($name);
$postbar = getpostbar($name);
if($loggedinname != "$name"){
}
else if($loggedinname == "$name"){
$edit = "<a href='editpost.php?do=edit&id=".$id."&fid=".$fid."'>Edit Post</a>";
}
if($isloggedin == "yes"){
$treport = " | <a href='editpost.php?do=reportthread&id=".$id."'>Report Post</a>";
$pm = " | <a href='messages.php?act=newpm&user=".$name."'>Send ".$name." a Private Message</a>";
}
else{
$treport = "";
$pm = "";
}
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$edit2 = " | <a href='editpost.php?do=delete&id=".$id."&fid=".$fid."'>Delete Post</a>";
$status2 = "
<table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'>
<form name='form1' method='post' action='update_thread.php'>
<select name='status' id='status'>
<option value='none' selected>No Selection</option>
<option value='Locked'>Lock Thread</option>
<option value='Open'>Open Thread</option>
<option value='1'>Stick Thread</option>
<option value='2'>Un-Stick Thread</option>
</select>
<input name='fid' type='hidden' id='fid' value='".$fid."'>
<input name='id' type='hidden' id='id' value='".$id."'>
<input type='submit' name='Submit' value='Submit'>
</form>
</td>
</tr>
</table><br>";
}
$article_title = "<a href='main_forum2.php'>4U Forum</a> / <a href='main_forum.php?fid=".$fid."'>".$ftopic."</a> / ".$topic."";
$table = $table."
<table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='thead' width='100%'><strong>Date/time : </strong>".$datetime."<center><strong>".$topic."</strong></center></td>
</tr>
</table>
<td class='tr'><table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='trow'><center><a href='profile2.php?user=".$name."'><strong>".$name."</strong></a></center><br><center>".$postbar."</center></td>
<td class='trow' valign='top' width='100%'>
".$detail."".$signature."</td>
</tr>
</table></td>
<table width='100%' border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'>".$edit."".$edit2."".$treport."".$pm."</td>
</tr>
</table><br>
";
$id=$_GET['id'];
$query = "SELECT * FROM forum_answer WHERE question_id='".$id."' ORDER BY a_id ASC";
$result = mysql_query($query);
$num = mysql_numrows($result);
while ($i < $num) {
$a_name=@mysql_result($result,$i,"a_name");
$a_answer=@mysql_result($result,$i,"a_answer");
$a_id=@mysql_result($result,$i,"a_id");
$a_datetime=@mysql_result($result,$i,"a_datetime");
$a_answer = stripslashes($a_answer);
$name = "".$a_name."";
$signature = getsignature($name);
$postbar = getpostbar($name);
if($isloggedin == "yes"){
$preport = " | <a href='editpost.php?do=reportpost&id=".$id."&a_id=".$a_id."'>Report Post</a>";
$apm = " | <a href='messages.php?act=newpm&user=".$a_name."'>Send ".$a_name." a Private Message</a>";
}
else{
$preport = "";
$apm = "";
}
$group = getgroup();
$cancp = cancp($group);
if($cancp != "yes"){
}
else if($cancp == "yes"){
$edit = "<a href='editpost.php?do=editreply&fid=".$fid."&question_id=".$id."&a_id=".$a_id."'>Edit Post</a>";
$edit2 = " | <a href='editpost.php?do=deletereply&fid=".$fid."&question_id=".$id."&a_id=".$a_id."'>Delete Post</a>";
}
$table = $table."
<table border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'><strong>Date/time : </strong>".$a_datetime."</td>
<td class='tr' width='20%'><center><strong>ID</strong>:".$a_id."</center></td>
</tr>
</table>
<td class='tr'><table border='0' cellpadding='3' cellspacing='1' bordercolor='1' class='ftable2a'>
<tr>
<td class='trow'><center><a href='profile2.php?user=".$a_name."'><strong>".$a_name."</strong></a>".$postbar."</td>
<td class='trow' valign='top' width='100%'>
".$a_answer."".$signature."</td>
</tr>
</table></td>
<table border='0' cellpadding='3' cellspacing='0' bordercolor='1' class='ftable2a'>
<tr>
<td class='tr' width='100%'>".$edit."".$edit2."".$preport."".$apm."</td>
</tr>
</table><br>
";
$i++;
}
$i++;
}
$query = "SELECT view FROM forum_question WHERE id='".$id."'";
$result = mysql_query($query);
$num = mysql_numrows($result);
$view=@mysql_result($result,"view");
// if have no counter value set counter = 1
if(empty($view)){
$view=1;
$query = "INSERT INTO forum_question(view) VALUES('".$view."') WHERE id='".$id."'";
$result = mysql_query($query);
}
// count more value
$addview=$view+1;
$query = "UPDATE forum_question SET view='".$addview."' WHERE id='".$id."'";
$result = mysql_query($query);
if($status == "Locked" or $isloggedin != "yes"){
$post = "";
}
else if($status == "Open" or $isloggedin == "yes"){
$post = "
<BR>
<form name='form1' method='post' action='add_answer.php'>
<td>
<table width='100%' border='0' cellpadding='0' cellspacing='0' class='ftable2a'>
<tr>
<td class='trow'><input name='a_name' type='hidden' id='a_name' value='".$loggedinname."' />
<center><strong>Reply:</strong></center>
<center><textarea name='a_answer' cols='45' rows='3' id='a_answer'></textarea></center>
<input name='name' type='hidden' value='".$name."'>
<input name='pam' type='hidden' value='5'>
<input name='a_topic' type='hidden' value='".$topic."'>
<input name='dip' type='hidden' value='1'>
<input name='id' type='hidden' value='".$id."'>
<input name='fid' type='hidden' value='".$fid."'>
<center><input type='submit' name='Submit' value='Submit'> <input type='reset' name='Submit2' value='Reset'></center></td>
</tr>
</table>
</td>
</form>
";
}
$table = $table."
".$status2."
".$post."
";
}
// **********************************************************************
// Begin Template Definition
// **********************************************************************
//Define our current theme
$file = $themeurl;
// Do the template changes and echo the ready template
$template = file_get_contents($file);
$template = replace(':ARTICLETITLE:',$article_title,$template);
$template = replace(':ARTICLECONTENT:',$article_content,$template);
$template = replace(':TABLE:',$table,$template);
$template = replace(':ARTICLEDATE:',$article_date,$template);
$template = replace(':BROWSERTITLE:',$browsertitle,$template);
$template = replace(':SITENAME:',$sitename,$template);
//Define our links
$template = replace(':LINKSBAR:',$links,$template);
//Get the content for the side bar...
$sidebar = getsidebar();
$template = replace(':SIDEFEED:',$sidebar,$template);
//Get the ad content...
$template = replace(':ADS:',$ads,$template);
//Get the slogan info
$template = replace(':SLOGAN:',$slogan,$template);
echo $template;
// **********************************************************************
// End Template Definition
// **********************************************************************
?>