<?php
$lcheck = "b";
$z = "b";
include ("config.php");
include ("forum_functions.php");

$autobron = "no";

//line 422
if ($ipbancheck2 > "0") {
echo re_direct("1500", "index.php");
echo "You have been banned from the forums! Taking you to main website of <b>".$sitename."</b>.";
} else {

$yourpoints = points();

/*if ($forumskin == "") {
$ffetch1 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."fskins WHERE id = '1'"));
$ffetch2 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."fskins WHERE id = '4'"));
if (($ffetch1 > "0") or ($ffetch2 > "0")) {
if ($ffetch1 > "0") {
$forumskin = "1";
}
if ($ffetch2 > "0") {
$forumskin = "4";
}
} else {
$forumskin = "3";
}
}*/

global $forumtheme;

$tempfetch = loadTemplate("forum/templates/".$forumtheme."/header.php");
$tempfetch1 = loadTemplate("forum/templates/".$forumtheme."/footer.php");
$tempfetch2 = loadTemplate("forum/templates/".$forumtheme."/header2.php");
$tempfetch3 = loadTemplate("forum/templates/".$forumtheme."/footer2.php");
$tempfetch4 = loadTemplate("forum/templates/".$forumtheme."/home-header.php");
$tempfetch5 = loadTemplate("forum/templates/".$forumtheme."/home-footer.php");
$tempfetch6 = loadTemplate("forum/templates/".$forumtheme."/flist.php");
$tempfetch7 = loadTemplate("forum/templates/".$forumtheme."/clist.php");
$tempfetch8 = loadTemplate("forum/templates/".$forumtheme."/subforum.php");
$tempfetch9 = loadTemplate("forum/templates/".$forumtheme."/forum-header.php");
$tempfetch10 = loadTemplate("forum/templates/".$forumtheme."/forum-footer.php");
$tempfetch11 = loadTemplate("forum/templates/".$forumtheme."/topic-header.php");
$tempfetch12 = loadTemplate("forum/templates/".$forumtheme."/tlist.php");
$tempfetch13 = loadTemplate("forum/templates/".$forumtheme."/post.php");

	$skin1[] = "/{version}/";
	$skin1[] = "/{sitename}/";
	$skin1[] = "/{users}/"; // amount of users online
	$skin1[] = "/{online}/"; // the users that are online
	$skin1[] = "/{pms}/"; // amount of private messages
	$skin1[] = "/{new}/"; // amount of new private messages
	$skin1[] = "/{pm}/"; // display new private messages
	$skin1[] = "/{welcome}/"; // Displays "Welcome username" if person is logged in, other wise "Welcome Guest" and a link to login
	$skin1[] = "/{chooseskin}/";
	$skin1[] = "/{skinname}/"; // the name of the current skin being used
	$skin2[] = $version;
	$skin2[] = $setting[sitename];
	$skin2[] = online();
	$skin2[] = usersonline();
	$skin2[] = totalpms();
	$skin2[] = newpms();
	$skin2[] = pms();
	$skin2[] = welcome();
	$skin2[] = fskin();
	$skin2[] = skinname();
eval (" ?>" . str_replace($skin1, $skin2, stripslashes($tempfetch)) . " <?php ");

echo "<style type='text/css'>.quote {
	line-height: 125%;
	background-color: ".$tempfetch[16]."; border: ".$tempfetch[14]."; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px
}
.quote1 {
	line-height: 125%;
	background-color: ".$tempfetch[15]."; border: ".$tempfetch[14]."; border-style: solid;
	border-left-width: 1px; border-top-width: 1px; border-bottom-width: 0px; border-right-width: 1px;
}
.avatar {
   line-height: 125%;
   border: ".$tempfetch[14].";
   border-style: solid;
   border-right-width: 1px;
   border-left-width: 0px;
   border-top-width: 0px;
   border-bottom-width: 0px;
}</style>";

echo '<script language="JavaScript"> 
function openDir(form) { 
var newIndex = form.fieldname.selectedIndex; 
if ( newIndex == 0 ) { 
alert( "Please select a location!"); 
} else { 
cururl = form.fieldname.options[ newIndex ].value; 
window.location.assign( cururl ); 
} 
} 
</script><script language="JavaScript"> 
function openDir2(form) { 
var newIndexa = form.fskin2.selectedIndex; 
if ( newIndexa == 0 ) { 
alert( "Please select a location!"); 
} else { 
cururl = form.fskin2.options[ newIndexa ].value; 
window.location.assign( cururl ); 
} 
} 
</script>';

if ($setting[wysiwyg] == "True") {
echo wysiwyg();
} else {
eval (" ?>" . admin_header() . " <?php ");
if ($setting[wysiwyg] == "True" && $_GET['load'] != "templates") {
echo wysiwyg();
}
}

echo "<script language='javascript'>function awindow(towhere, newwinname, properties) {window.open(towhere,newwinname,properties);}</script>";

$npms = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."pm WHERE jo = '".$_COOKIE[$pre."username"]."' AND viewed = '1'"));
$tpms = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."pm WHERE jo = '".$_COOKIE[$pre."username"]."'"));
$sql = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."'"));
$sdata[] = "{bordercolor}";
$sdata[] = "{bgcolor1}";
$sdata[] = "{bgcolor2}";
$sdata[] = "{bgcolor3}";
$sdata[] = "{forumurl}";
$sdata[] = "{chooseskin}";
$sdata[] = "{login}";
$sdata[] = "{register}";
$sdata[] = "{memberslist}";
$sdata[] = "{boardcp}";
$sdata[] = "{welcome}";

$pdata[] = $tempfetch[14];
$pdata[] = $tempfetch[15];
$pdata[] = $tempfetch[16];
$pdata[] = $tempfetch[17];
$pdata[] = $forumsurl;
$pdata[] = fskin();
if ($_COOKIE[$pre."username"]) {
$pdata[] = "&nbsp;<a href='index.php?load=elite'><img src='a_images/fprofile.jpg' style='border:1px solid black'></a>";
$pdata[] = "&nbsp;<a href='logout.html'><img src='a_images/logout.jpg' style='border:1px solid black'></a>";
} else {
$pdata[] = "+&nbsp;<a href='login.html'>Login</a>";
$pdata[] = "+&nbsp;<a href='register.html'>Register</a>";
}
$pdata[] = "&nbsp;<a href='boards.php?t=list'><img src='a_images/mlist.jpg' style='border:1px solid black'></a>";
if ($sql > "0") {
$pdata[] = "&nbsp;<a href='boardcp.php'><img src='a_images/boardcp.jpg' style='border:1px solid black'></a>";
} else {
$pdata[] = "";
}
if ($_COOKIE[$pre."username"] == "") {
$pdata[] = "<b>Welcome Guest!</b>";
} else {
$pdata[] = "<b>Welcome ".$_COOKIE[$pre."username"]."!</b>&nbsp;[ <a href='logout.html'>Logout</a> ]<br><b>Inbox:</b> <a href='index.php?load=pm&box=in'>$npms</a> new, <b>Total:</b> <a href='index.php?load=pm&box=in'>$tpms</a>";
}
eval (" ?>" . str_replace($sdata, $pdata, stripslashes($tempfetch2)) . " <?php ");

if (($_GET['t'] == "track") && ($_GET['id'])) {
if ($useridn == "") {
echo re_direct("1500", $_SERVER['HTTP_REFERER']);
echo "Sorry but you can't track threads since you are not a member. Taking you back to previous page";
} else {
echo "<SCRIPT LANGUAGE='JavaScript'>var agree=confirm('";
if ($_GET['type'] == "add") {
echo "Are you sure you want to track this topic";
} else {
echo "Are you sure you no longer want to track this topic";
}
echo "?');if (agree)document.write('');elsehistory.go(-1);</SCRIPT>";

if ($_GET['type'] == "add") {
mysql_query("INSERT INTO ".$pre."elite VALUES ('null', '".$useridn."', '".$_GET['id']."', 'topic', '".time()."')");
} else {
mysql_query("DELETE FROM ".$pre."elite WHERE pid = '".$useridn."' AND game = '".$_GET['id']."' AND type = 'topic'");
}

echo re_direct("1500", $_SERVER['HTTP_REFERER']);
if ($_GET['type'] == "add") {
echo "You are now tracking the topic";
} else {
echo "You are no longer tracking this topic";
}
echo ". Taking you back to the previous page";
}
}

if (($_GET['t'] == "banip") && ($_GET['ip'])) {
$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp"));
if ($ou > "0") {
echo "<SCRIPT LANGUAGE='JavaScript'>var agree=confirm('Confirm ban of IP ".$_GET['ip']."?');if (agree)document.write('');elsehistory.go(-1);</SCRIPT>";

mysql_query("INSERT INTO ".$pre."ipban VALUES ('null', '".$_GET['ip']."', 'yes', 'no', 'no', '".time()."')");

echo re_direct("1500", $_SERVER['HTTP_REFERER']);
echo "<b>".$_GET['ip']."</b> IP address has been banned. Taking you back to the previous page";
}
}

if (($_GET['t'] == "ip") && ($_GET['ip'])) {
$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp"));
if ($ou > "0") {
echo "<center><a href='http://www.melissadata.com/Lookups/iplocation.asp?ipaddress=".$_GET['ip']."'><b>".$_GET['ip']."</b></a>&nbsp;&nbsp;-&nbsp;&nbsp;<a href='boards.php?t=banip&ip=".$_GET['ip']."'><b>Ban IP</b></a>";
echo "</center><table cellpadding='3' cellspacing='0' border='0' width='98%' style='border:1px solid ".$tempfetch[14]."' align='center'><tr bgcolor='".$tempfetch[15]."'><td><b>Username</b></td><td><b># of posts</b></td></tr>";
$query = mysql_query("SELECT * FROM ".$pre."users");
while($r = mysql_fetch_array($query)) {

$fetch = mysql_fetch_row(mysql_query("SELECT id FROM ".$pre."profile WHERE username = '".$r[username]."'"));
$pcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE ip = '".$_GET['ip']."' AND uid = '".$fetch[0]."'"));

$color = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$r[rank]."'"));

if (($pcount > "0") && ($fetch[0])) {
echo "<tr bgcolor='".$tempfetch[17]."'><td><a href='index.php?load=elite&user=".$fetch[0]."'><font color='".$color[0]."'>".$r[username]."</font></a></td><td>".$pcount."</td></tr>";
}
}

$query = mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '' AND ip = '".$_GET['ip']."'");
while($r = mysql_fetch_array($query)) {
echo "<tr bgcolor='".$tempfetch[17]."'><td>Guest</td><td>1</td></tr>";
}
echo "</table>";
}
}

if (($_GET['t'] == "report2") && ($_GET['id'])) {
if ($_COOKIE[$pre."username"] == "") {
echo "You need to <a href='index.php?action=login'>login</a> or <a href='index.php?action=register'>register</a>.";
} else {
$message = "Hello,<br><br>".$_COOKIE[$pre."username"]." has reported the following post to moderators/admins:<br><br><a href=\"".$_POST[post]."\">".$_POST[subject]."</a><br><br><b>Message:</b> ".stripslashes($_POST[message])."<br><br><b>Posters Username:</b> <a href=\"index.php?load=elite&user=".$_POST[userid]."\">".$_POST[user]."</a><br><b>Posters IP Address:</b> <a href=\"boards.php?t=ip&ip=".$_POST[ip]."\">".$_POST[ip]."</a><br><br>Thank you";

$sql = mysql_query("SELECT * FROM ".$pre."boardcp WHERE level = 'global' OR level = 'admin' OR level = 'mod' AND place = '".$_POST['forum']."'");
while($i = mysql_fetch_array($sql)) {
$user = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$i[uid]."'"));
mysql_query("INSERT INTO ".$pre."pm VALUES ('null', '1', 'Post Reported - ".$_POST['subject']."', '".$message."', '".$_COOKIE[$pre."username"]."', '".$user[0]."', '".time()."', 'report')") or die(mysql_error());
}
echo re_direct("2500", $_POST['post']);
echo "Report has been posted, moderators and admins have received the report. Taking you back to the post.";
}
}

if (($_GET['t'] == "giverep2") && (is_numeric($useridn))) {
mysql_query("INSERT INTO ".$pre."reputation VALUES ('null', '".$_POST['type']."', '".$useridn."', '".$_POST['uid']."', '".addslashes($_POST['comment'])."', '".$f2part1.$_POST['tid'].$f2part2."', '".time()."')");

$topicname = mysql_fetch_row(mysql_query("SELECT name FROM ".$pre."forums WHERE id = '".$_POST['tid']."'"));

echo re_direct("2500", $f2part1.$_POST['tid'].fthrough($topicname[0], "").$f2part2);
echo "Reputation has been given. Taking you back to the topic.";
}

if (($_GET['t'] == "rep") && (is_numeric($_GET['id']))) {
$uid = $_GET['id'];
$sql = mysql_query("SELECT * FROM ".$pre."reputation WHERE forwho = '".$uid."'");

echo "<table cellpadding='5' align='center' cellspacing='0' border='0' width='98%' style='border:1px solid ".$tempfetch[14]."'>";
if (mysql_num_rows($sql) > "0") {
echo "<tr bgcolor='".$tempfetch[15]."'><td><b>From</b></td><td><b>When</b></td><td><b>Topic</b></td><td><b>Comment</b></td><td><b>Type</b></td></tr>";
}
while($r = mysql_fetch_array($sql)) {
$sql2 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$r[fromwho]."'"));
$ra = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$sql2[0]."'"));
$color = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$ra[0]."'"));

$ex2 = explode($f2part1, $r[url]);
$ex = explode($f2part2, $ex2[1]);

$topic = mysql_fetch_row(mysql_query("SELECT subject FROM ".$pre."posts WHERE id = '".$ex[0]."'"));

echo "<tr bgcolor='".$tempfetch[17]."'><td><a href='index.php?load=elite&user=".$r[fromwho]."'><font color='".$color[0]."'>".$sql2[0]."</font></a></td><td>".date($fdformat3, $r[date])."</td><td><a href='".$r[url]."'>".stripslashes($topic[0])."</a></td><td><p>".stripslashes($r[comment])."</p></td><td>";
if ($r[type] == "1") {
echo "Positive <b><font color='blue'>+</font></b>";
} else {
echo "Negative <b><font color='red'>-</font></b>";
}
echo "</td></tr>";
}
echo "<tr bgcolor='".$tempfetch[15]."'><td><b>Total Reputation Amount:</b></td><td>".reputation($uid)."</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr></table>";
}

if (($_GET['t'] == "giverep") && (is_numeric($_GET['id']))) {
$id = $_GET['tid'];
$uid = $_GET['id'];
$type = $_GET['type'];

$repcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."reputation WHERE fromwho = '".$useridn."' AND forwho = '".$uid."'"));
if ((($useridn == "") or ($useridn == $uid) or ($repcount > "0"))) {
echo "An error has occured. Either you are not <a href='login.html'>logged in</a>, you are trying to give reputation for yourself or you have already given this user reputation. Taking you back to the post.";
} else {
$user = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$uid."'"));

echo "<form action='boards.php?t=giverep2' method='post'>";

echo "<input type='hidden' name='uid' value='".$uid."'><input type='hidden' name='tid' value='".$id."'><input type='hidden' name='type' value='".$type."'>";

echo "<table cellpadding='5' align='center' cellspacing='0' border='0' width='98%' style='border:1px solid ".$tempfetch[14]."'><tr bgcolor='".$tempfetch[16]."'><td><b>Reputation For</b></td><td><a href='".$f2part1.$id.$f2part2."'>".$user[0]."</a></td></tr><tr bgcolor='".$tempfetch[15]."'><td><b>Type of/Current Reputation</b></td><td>";
if ($type == "1") {
echo "Positive";
} else {
echo "Negative";
}
echo "/";
echo reputation($uid);
echo "</td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Comment</b></td><td><textarea name='comment' cols='40' rows='10'></textarea></td></tr><tr bgcolor='".$tempfetch[15]."'><td><input type='submit' value='Submit Reputation'></td><td>&nbsp;</td></tr></table></form>";
}
}

if (($_GET['t'] == "report") && ($_GET['id'])) {
$id = $_GET['id'];
$info = mysql_fetch_row(mysql_query("SELECT subject,type,tid,uid,ip,fid FROM ".$pre."posts WHERE id = '".$id."'"));
$name = mysql_fetch_row(mysql_query("SELECT subject,type,tid,uid,ip,fid FROM ".$pre."forums WHERE id = '".$info[tid]."'"));

if ($info[1] == "post") {
$post = $f2part1.$info[2].$f2part2."#".$id;
} else {
$post = $f2part1.$id.$f2part2;
}
$user = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$info[3]."'"));

echo "<form action='boards.php?t=report2&id=".$id."' method='post'>";

echo "<input type='hidden' name='post' value='".$post."'><input type='hidden' name='subject' value='".stripslashes($info[0])."'><input type='hidden' name='userid' value='".$info[3]."'><input type='hidden' name='user' value='".$user[0]."'><input type='hidden' name='ip' value='".$info[4]."'><input type='hidden' name='forum' value='".$info[5]."'>";

echo "<table cellpadding='5' align='center' cellspacing='0' border='0' width='98%' style='border:1px solid ".$tempfetch[14]."'><tr bgcolor='".$tempfetch[16]."'><td><b>Reported Post</b></td><td><a href='".$post."'>".$info[0]."</a></td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Message</b></td><td><textarea name='message' cols='40' rows='10'></textarea></td></tr><tr bgcolor='".$tempfetch[15]."'><td><input type='submit' value='Submit Report'></td><td>&nbsp;</td></tr></table></form>";
}

if ($_GET['t'] == "list") {
echo "<table cellpadding='3' cellspacing='0' border='0' width='98%' style='border:1px solid ".$tempfetch[14]."' align='center'><tr bgcolor='".$tempfetch[15]."'><td><b>Username</b></td><td><b>E-Mail</b></td><td><b>Level</b></td><td><b>Rank</b></td>";
if (($userlevel < "6") && ($userlevel > "0")) {
echo "<td><b>Last Visit</b></td>";
}
echo "</tr>";
$res = "SELECT * FROM ".$pre."users";
if ($_GET['rank']) {
$res .= " WHERE rank = '".$_GET['rank']."'";
}
$res .= " ORDER BY `id` DESC";
$query = mysql_query($res);
while($row = mysql_fetch_array($query)) {
echo "<tr bgcolor='".$tempfetch[17]."'><td>";

$query2 = mysql_query("SELECT id FROM ".$pre."profile WHERE username = '".$row[username]."'");
$pn1 = mysql_fetch_row($query2);
$pn2 = mysql_num_rows($query2);

$s = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$row[rank]."'"));

$pn = $pn2;
$pid = $pn1[0];
if ($pn == "") {
	echo "$row[username]";
} else {
	echo "<a href='index.php?load=elite&user=".$pn1[0]."'>$row[username]</a>";
}
	echo "</td><td><a href='mailto:".$row[email]."'>$row[email]</a></td><td>$row[level]</td><td><a href='boards.php?t=rankslist'><font color='".$s[0]."'>".$row[rank]."</font></a></td>";
	if (($userlevel < "6") && ($userlevel > "0")) {
	echo "<td>";
	if (($row[logged] == "") or ($row[logged] == "0")) {
	echo "N/A";
	} else {
	echo date($fdformat3, $row[logged]);
	}
	echo "</td>";
}
echo "</tr>";
}
echo "</table>";
}

if ($_GET['t'] == "rankslist") {
echo "<table cellpadding='3' cellspacing='0' border='0' width='98%' style='border:1px solid ".$tempfetch[14]."' align='center'><tr bgcolor='".$tempfetch[15]."'><td><b>Rank Name</b></td><td><b>Posts Required</b></td><td><b>Users</b></td></tr>";

$ranks = mysql_query("SELECT * FROM ".$pre."ranks ORDER BY `name` DESC");
while($s = mysql_fetch_array($ranks)) {

$rankcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."users WHERE rank = '".$s[name]."'"));

echo "<tr bgcolor='".$tempfetch[17]."'><td><a href='boards.php?t=list&rank=".$s[name]."'><font color='".$s[color]."'>".$s[name]."</font></a></td><td>".$s[points]."</td><td><a href='boards.php?t=list&rank=".$s[id]."'>".$rankcount."</a></td></tr>";
}
echo "</table>";
}

if (($_GET['t'] == "") && ($_GET['f'] == "")) { // forum - home
$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{sitename}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $setting[sitename];
echo str_replace($cdata, $ddata, stripslashes($tempfetch4));
unset($cdata, $ddata);

$query = mysql_query("SELECT * FROM ".$pre."forums WHERE type = 'cat' ORDER BY `ord`");
while($row = mysql_fetch_array($query)) {

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{name}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = stripslashes($row[name]);
echo str_replace($cdata, $ddata, stripslashes($tempfetch7));
unset($cdata, $ddata);

	$forums = mysql_query("SELECT * FROM ".$pre."forums WHERE cat = '".$row[name]."' AND type = 'forum' ORDER BY `ord` ASC");
	while($row2 = mysql_fetch_array($forums)) {
		$id = "$row2[id]";

	$rankcheck = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE id = '".$useridn."'"));
	$rankcheck2 = mysql_fetch_row(mysql_query("SELECT level FROM ".$pre."userlevels WHERE name = '".$rankcheck[0]."'"));
	$rankrequ = mysql_fetch_row(mysql_query("SELECT rankreq FROM ".$pre."forums WHERE type = 'forum' AND id = '".$id."'"));

	//If a forum has a rank requirement, check it against a user's rank and hide the forum if the user doesn't meet it
	if($rankrequ[0] < $rankcheck2[0])
	{
	} else {
	
		$topicsa = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$row2[id]."' AND type = 'topic' OR fid = '".$row2[id]."' AND type = 'Sticky' OR fid = '".$row2[id]."' AND type = 'Announcement'"));	
		$replies = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$row2[id]."' AND type = 'post'"));
		$replies2 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$row2[id]."'"));

		$row3 = mysql_fetch_row(mysql_query("SELECT id,tid,type,subject,date,uid FROM ".$pre."posts WHERE fid = '".$row2[id]."' ORDER BY `id` DESC"));

if ($row2[locked]) {
$icon .= "<img src='a_images/forum_locked.jpg' title='Locked Forum' alt='Locked Forum' style='border: 1px solid ".$tempfetch[14]."'>";
} else {
if ($logged < $row3[4]) {
$icon .= "<img src='a_images/forum_new.jpg' title='New Post(s)' alt='New Post(s)' style='border: 1px solid ".$tempfetch[14]."'>";
} else {
$icon .= "<img src='a_images/forum_nonew.jpg' title='No new Post(s)' alt='No new Post(s)' style='border: 1px solid ".$tempfetch[14]."'>";
}
}
$link = "<a href='".$f1part1.$row2[id].$f1part2."'>".stripslashes($row2[name])."</a>";
$des = stripslashes($row2[des]);
$sql = mysql_query("SELECT * FROM ".$pre."boardcp WHERE level = 'mod' OR level = 'global' OR level = 'admin'");
$fnum1 = mysql_num_rows($sql);

if ($fnum1 > "0") {
$mods .= "<small>Mods: ";
}
	for($i = 1; $r = mysql_fetch_assoc($sql); $i++) {
	$sql2 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$r[uid]."'"));
	$ra = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$sql2[0]."'"));
    $color = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$ra[0]."'"));
    if (($row2[id] == $r[place]) && ($r[type] == "forum")) {
    $bla3 = "yes";
	} else {
	$bla3 = "";
	}
	if ((($r[level] == "admin") or ($r[level] == "global") or ($bla3))) {
	$mods .= "<a href='index.php?load=elite&user=".$r[uid]."'>";
    if ($color[0]) {
	$mods .= "<font color='".$color[0]."'>".$sql2[0]."</font>";
	} else {
	$mods .= $sql2[0];
	}
	$mods .= "</a>&nbsp;&nbsp;";
	}
	}

if (($fnum1 > "0") or ($fnum2 > "0")) {
$mods .= "</small>";
}

$tuser = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$row3[5]."'"));
$ra = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$tuser[0]."'"));
$color = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$ra[0]."'"));

	    if ($replies2 > "0") {
        $lpost .= "<a href='".$f2part1.$row3[1].$f2part2;
		if ($row3[2] == "post") {
		$lpost .= "#".$row3[0];
		}
	    $lpost .= "'>";

		if ($row3[3] == "") {
		$lpost .= "Post";
		} else {
		$lpost .= stripslashes($row3[3]);
		}
		$lpost .= "</a><br>By: ";
		if ($row3[5] == "") {
		$lpost .= "Guest";
		} else {
		$lpost .= "<a href='index.php?load=elite&user=".$row3[5]."'>";
		if ($color[0]) {
	    $lpost .= "<font color='".$color[0]."'>".$tuser[0]."</font>";
	    } else {
	    $lpost .= $tuser[0];
	    }
		$lpost .= "</a>";
		}

		$lpost .= "<br>At: <i>".date($fdformat3, $row3[4])."</i></div>";
	} else {
		$lpost .= "<div align='center'>No Posts Made</div>";
	}

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{name}";
$cdata[] = "{icon}";
$cdata[] = "{description}";
$cdata[] = "{mods}";
$cdata[] = "{topics}";
$cdata[] = "{replies}";
$cdata[] = "{lastpost}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $link;
$ddata[] = $icon;
$ddata[] = $des;
$ddata[] = $mods;
$ddata[] = $topicsa;
$ddata[] = $replies;
$ddata[] = $lpost;
echo str_replace($cdata, $ddata, stripslashes($tempfetch6));
unset($cdata, $ddata, $link, $icon, $des, $mods, $lpost);
}
}
}

echo logging();
$posts = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'post'"));
$topics = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'topic' OR type = 'Announcement' OR type = 'Sticky'"));
$members = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."users"));
$online = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."users WHERE logged = '".time()."'"));
$staff = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp"));

$lmember = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."users ORDER BY `id` DESC"));
$lmember2 = mysql_fetch_row(mysql_query("SELECT id FROM ".$pre."profile WHERE username = '".$lmember[0]."'"));
	
	if ($online == "1") {
	$sonline .= "There is <i>".$online."</i> user";
	} else {
	$sonline .= "There are <i>".$online."</i> users";
	}
	$sonline .= " online at ".date($fdformat2, time());
    
	$ranksabc = mysql_query("SELECT * FROM ".$pre."ranks ORDER BY `points` ASC LIMIT 5");
    while($sab = mysql_fetch_array($ranksabc)) {
	$rank2 .= "[<a href='boards.php?t=list&rank=".$sab[name]."'><font color='".$sab[color]."'>".$sab[name]."</font></a>]&nbsp;";
	}

	$sqleee421 = mysql_query("SELECT * FROM ".$pre."users WHERE logged = '".time()."'");
    while($i = mysql_fetch_array($sqleee421)) {
	$mrank = $i[rank];
	$yid = mysql_fetch_row(mysql_query("SELECT id FROM ".$pre."profile WHERE username = '".$i[username]."'"));
	$ranks2 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '".$yid[0]."'"));
	$ranksa = mysql_query("SELECT * FROM ".$pre."ranks ORDER BY `points` ASC");
    while($sa = mysql_fetch_array($ranksa)) {
	if (($myrank == "") && ($_COOKIE[$pre."username"])) {
	if (($ranks2 > $sa[points]) or ($ranks2 == $sa[points])) {
	mysql_query("UPDATE ".$pre."users SET rank = '".$sa[name]."' WHERE username = '".$_COOKIE[$pre."username"]."' AND password = '".$_COOKIE[$pre."password"]."'");
	}
	}
	}
	$s = mysql_fetch_row(mysql_query("SELECT id,color FROM ".$pre."ranks WHERE name = '".$mrank."' ORDER BY `points` DESC"));
	$rank .= "<a href='index.php?load=elite&user=".$yid[0]."'><font color='".$s[1]."'>".$i[username]."</font></a>&nbsp;";
}

if ($rank == "") {
//echo "<a href='index.php?load=elite&user=".$pid."'>".$pusername."</a>&nbsp;";
} else {
//print $rank;
}
    
$lpost = mysql_fetch_row(mysql_query("SELECT subject,date,tid,id FROM ".$pre."posts WHERE type = 'post' ORDER BY `lpostdate` DESC"));
$ltopic = mysql_fetch_row(mysql_query("SELECT subject,date,id FROM ".$pre."posts WHERE type= 'topic' OR type = 'Announcement' OR type = 'Sticky' ORDER BY `lpostdate` DESC"));

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{sitename}";
$cdata[] = "{posts}";
$cdata[] = "{topics}";
$cdata[] = "{staff}";
$cdata[] = "{members}";
$cdata[] = "{users-online}";
$cdata[] = "{online}";
$cdata[] = "{ranks}";
$cdata[] = "{ltopic}";
$cdata[] = "{lpost}";
$cdata[] = "{lmember}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $setting[sitename];
$ddata[] = $posts;
$ddata[] = $topics;
$ddata[] = $staff;
$ddata[] = $members;
$ddata[] = $sonline;
$ddata[] = $rank;
$ddata[] = $rank2;
if ($ltopic[0]) {
$ddata[] = "<a href='".$f2part1.$ltopic[2].$f2part2."'>".stripslashes($ltopic[0])."</a> (".date($fdformat3, $ltopic[1]).")";
} else {
$ddata[] = "None";
}
if ($lpost[0]) {
$ddata[] = "<a href='".$f2part1.$lpost[2].$f2part2."#".$lpost[3]."'>".stripslashes($lpost[0])."</a> (".date($fdformat3, $lpost[1]).")";
} else {
$ddata[] = "None";
}
$ddata[] = "<a href='index.php?load=elite&user=".$lmember2[0]."'>".$lmember[0]."</a>";
echo str_replace($cdata, $ddata, stripslashes($tempfetch5));
unset($cdata, $ddata);
}

if ((is_numeric($_GET['f'])) && ($_GET['t'] == "")) { // forum - topic listing
if(!isset($_GET['page'])){
    $page = 1;
} else {
    $page = $_GET['page'];
}

$e2 = $setting[topics_per_page];
$from = (($page * $e2) - $e2);

echo "<form action='index.php?view=forums&f=".$_GET['f']."' method='post'>";

$fname = mysql_fetch_row(mysql_query("SELECT name,type,cat FROM ".$pre."forums WHERE id = '".$_GET['f']."'"));
$explode2 = explode("||", $fname[0]);

if ($explode2[0] == "") {
$forumname = $fname[0];
} else {
$forumname == $explode2[0];
}
$fa = $fname[1];
$cat = $fname[2];

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{forumname}";
$cdata[] = "{sitename}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $fname[0];
$ddata[] = $setting[sitename];
echo str_replace($cdata, $ddata, stripslashes($tempfetch8));
unset($cdata, $ddata);

$ssql = mysql_query("SELECT * FROM ".$pre."forums WHERE type = 'sub'");
while($r = mysql_fetch_array($ssql)) {
$explode = explode("||", $r[name]);

if ($explode[1] == $_GET['f']) {

$numg3 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$r[id]."' AND type = 'topic' OR fid = '".$r[id]."' AND type = 'Sticky' OR fid = '".$r[id]."' AND type = 'Announcement'"));
$numg22 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$r[id]."' AND type = 'post'"));

$link .= "<a href='".$f1part1.$r[id].$f1part2."'>".$explode[0]."</a>";

if ($r[locked]) {
$link .= " <img src='a_images/locked.jpg' border='1'>";
}
$des = stripslashes($r[des]);

	$sql = mysql_query("SELECT * FROM ".$pre."boardcp WHERE level = 'mod' OR level = 'global' OR level = 'admin'");
	$fnum1 = mysql_num_rows($sql);

if ($fnum1 > "0") {
$mods .= "<small>Mods: ";
}
	for($i = 1; $ra = mysql_fetch_assoc($sql); $i++) {
	$sql2 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$ra[uid]."'"));
    if (($r[id] == $ra[place]) && ($ra[type] == "forum")) {
    $bla3 = "yes";
	} else {
	$bla3 = "";
	}
	if ((($ra[level] == "admin") or ($ra[level] == "global") or ($bla3))) {
	$mods .= "<a href='index.php?load=elite&user=".$ra[uid]."'>".$sql2[0]."</a>&nbsp;&nbsp;";
	}
	}

if ($fnum1 > "0") {
$mods .= "</small>";
}

	$see = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$r[id]."'"));
	if ($see > "0") {
	$query3 = mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$r[id]."' ORDER BY `id` DESC LIMIT 1") or die(mysql_error());
	while($row3 = mysql_fetch_array($query3)) {
        $tdata = $row3[date];
		$lpost .= "<a href='".$f2part1.$row3[id].$f2part2."#".$row3[id]."'>";

		if ($row3[subject] == "") {
			$lpost .= "Post";
		} else {
			$lpost .= stripslashes($row3[subject]);
		}
		$lpost .= "<a><br>".date($fdformat3, $row3[date]);
	}
	} else {
		$lpost .= "<div align='center'>No Posts Made</center>";
	}
if ($r[locked]) {
$icon .= "<img src='a_images/forum_locked.jpg' title='Locked Forum' alt='Locked Forum' style='border: 1px solid ".$tempfetch[14]."'>";
} else {
if ($logged < $tdate) {
$icon .= "<img src='a_images/forum_new.jpg' title='New Post(s)' alt='New Post(s)' style='border: 1px solid ".$tempfetch[14]."'>";
} else {
$icon .= "<img src='a_images/forum_nonew.jpg' title='No new Post(s)' alt='No new Post(s)' style='border: 1px solid ".$tempfetch[14]."'>";
}
}

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{name}";
$cdata[] = "{icon}";
$cdata[] = "{description}";
$cdata[] = "{mods}";
$cdata[] = "{topics}";
$cdata[] = "{replies}";
$cdata[] = "{lastpost}";
$cdata[] = "{forumname}";
$cdata[] = "{sitename}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $link;
$ddata[] = $icon;
$ddata[] = $des;
$ddata[] = $mods;
$ddata[] = $numg3;
$ddata[] = $numg22;
$ddata[] = $lpost;
$ddata[] = $fname[0];
$ddata[] = $setting[sitename];
echo str_replace($cdata, $ddata, stripslashes($tempfetch6));
unset($cdata, $ddata, $link, $icon, $des, $mods, $lpost, $fname[0]);
}
}
echo "</table><br>";

$sql = mysql_query("SELECT locked FROM ".$pre."forums WHERE id = '".$_GET['f']."'");
$fa = mysql_fetch_row($sql);

if ($fa[0] == "") {
if ((($_COOKIE[$pre."username"]) or ($b == "yes") && ($_COOKIE[$pre."username"] == ""))) {
$ntopic = "<a href='boards.php?t=new&f=".$_GET['f']."'><img src='a_images/newtopic.jpg' style='border:1px solid black'></a>";
}
}
$search = "<input type='text' name='search'>&nbsp;<input type='submit' value='Search'>";

	$rowba = mysql_fetch_row(mysql_query("SELECT id,name FROM ".$pre."forums WHERE type = 'sub' OR type = 'forum' AND cat = '".$f[cat]."'"));
	if ($rowba[0] == $explode2[1]) {
	$nav .= "<a href='".$f1part1.$rowba[0].$f1part2."'>".$rowba[1]."</a>";
	}
	
	$nav .= "<b><a href='".$forumsurl."'>Home</a> > <a href='".$f1part1.$_GET['f'].$f1part2."'>".$explode2[0]."</a></b>";

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{forumname}";
$cdata[] = "{sitename}";
$cdata[] = "{newtopic}";
$cdata[] = "{search}";
$cdata[] = "{nav}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $fname[0];
$ddata[] = $setting[sitename];
$ddata[] = $ntopic;
$ddata[] = $search;
$ddata[] = $nav;
echo str_replace($cdata, $ddata, stripslashes($tempfetch9));
unset($cdata, $ddata, $ntopic, $search, $nav);

	$topic1 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$_GET['f']."' AND type = 'Sticky'"));
	$topic2 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$_GET['f']."' AND type = 'Announcement'"));

	if ($topic2 > "0") {
	$query2at = mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$_GET['f']."' AND type = 'Announcement' ORDER BY `lpostdate` DESC");
	while($row2 = mysql_fetch_array($query2at)) {
	   $tid = "$row2[id]";
	   $views = "$row2[stats]";

       $icon = "<img src='a_images/".$row2[type].".jpg' style='border:1px solid ".$tempfetch[14]."'>";
	   if ($row2[type] == "topic") {
	   } else {
	   $subject .= "<b>".$row2[type].":</b> ";
	   }
	   $subject .= "<a href='".$f2part1.$row2[id].$f2part2."'>".stripslashes($row2[subject])."</a>";

	   if ($row2[locked] == "yes") {
	   $subject .= "&nbsp;&nbsp;<img src='a_images/locked.jpg' border='1'>";
	   }
	if ($row2[uid] == "") {
	$tuser .= "Guest";
	} else {
	$user = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$row2[uid]."' LIMIT 1"));
	$rf = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$user[0]."'"));
	$s = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$rf[0]."'"));
	$rank = "<a href='index.php?load=elite&user=".$row2[uid]."'><font color='".$s[0]."'>".$user[0]."</font></a>";

if ($rank == "") {
$tuser .= "<a href='index.php?load=elite&user=".$row2[uid]."'>".$user[0]."</a>";
} else {
$tuser .= $rank;
}
$tdate = date($fdformat3, $row2[date]);
}

	$replies = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."'"));
	$lcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."'"));

    if ($lcount > "0") {
	$user3 = mysql_fetch_row(mysql_query("SELECT uid FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$user4 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$user3[0]."'"));
	$user1 = $user3[0];
	$user2 = $user4[0];
	$query3w = mysql_fetch_row(mysql_query("SELECT date,id,tid FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$date9 = $query3w[0];
	$lpost = $query3w[2].$f2part2."#".$query3w[1];
	} else {
	$user1 = $row2[uid];
	$user3 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$row2[uid]."'"));
	$user2 = $user3[0];
    $query3w = mysql_fetch_row(mysql_query("SELECT date,id FROM ".$pre."posts WHERE id = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$date9 = $query3w[0];
	$lpost = $query3w[1].$f2part2;
	}

	$last = date($fdformat3, $date9)."<br>By: ";

	if ($user1 == "") {
	$last .= "Guest";
	} else {
	$rf = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$user2."'"));
	$s = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$rf[0]."'"));
	$rank = "<a href='index.php?load=elite&user=".$user1."'><font color='".$s[0]."'>".$user2."</font></a>";

if ($rank == "") {
$last .= "<a href='index.php?load=elite&user=".$user1."'>".$user2."</a>";
} else {
$last .= $rank;
}
}
$tlast = $last." <a href='".$f2part1.$lpost."'><img src='a_images/lpost.jpg' border='0' style='border:1px solid ".$tempfetch[14]."'></a>";

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{forumname}";
$cdata[] = "{sitename}";
$cdata[] = "{icon}";
$cdata[] = "{subject}";
$cdata[] = "{username}";
$cdata[] = "{date}";
$cdata[] = "{lastpost}";
$cdata[] = "{replies}";
$cdata[] = "{views}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $fname[0];
$ddata[] = $setting[sitename];
$ddata[] = $icon;
$ddata[] = $subject;
$ddata[] = $tuser;
$ddata[] = $tdate;
$ddata[] = $tlast;
$ddata[] = $replies;
$ddata[] = $views;
echo str_replace($cdata, $ddata, stripslashes($tempfetch12));
unset($cdata, $ddata, $icon, $subject, $tuser, $tdate, $tlast, $replies, $views);
}
}
    
	if ($topic1 > "0") {
	$query2at = mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$_GET['f']."' AND type = 'Sticky' ORDER BY `lpostdate` DESC");
	while($row2 = mysql_fetch_array($query2at)) {
	   $tid = "$row2[id]";
	   $views = "$row2[stats]";

       $icon = "<img src='a_images/".$row2[type].".jpg' style='border:1px solid ".$tempfetch[14]."'>";
	   if ($row2[type] == "topic") {
	   } else {
	   $subject .= "<b>".$row2[type].":</b> ";
	   }
	   $subject .= "<a href='".$f2part1.$row2[id].$f2part2."'>".stripslashes($row2[subject])."</a>";

	   if ($row2[locked] == "yes") {
	   $subject .= "&nbsp;&nbsp;<img src='a_images/locked.jpg' border='1'>";
	   }
	if ($row2[uid] == "") {
	$tuser .= "Guest";
	} else {
	$user = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$row2[uid]."' LIMIT 1"));
	$rf = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$user[0]."'"));
	$s = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$rf[0]."'"));
	$rank = "<a href='index.php?load=elite&user=".$row2[uid]."'><font color='".$s[0]."'>".$user[0]."</font></a>";

if ($rank == "") {
$tuser .= "<a href='index.php?load=elite&user=".$row2[uid]."'>".$user[0]."</a>";
} else {
$tuser .= $rank;
}
$tdate = date($fdformat3, $row2[date]);
}

	$replies = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."'"));
	$lcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."'"));

    if ($lcount > "0") {
	$user3 = mysql_fetch_row(mysql_query("SELECT uid FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$user4 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$user3[0]."'"));
	$user1 = $user3[0];
	$user2 = $user4[0];
	$query3w = mysql_fetch_row(mysql_query("SELECT date,id,tid FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$date9 = $query3w[0];
	$lpost = $query3w[2].$f2part2."#".$query3w[1];
	} else {
	$user1 = $row2[uid];
	$user3 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$row2[uid]."'"));
	$user2 = $user3[0];
    $query3w = mysql_fetch_row(mysql_query("SELECT date,id FROM ".$pre."posts WHERE id = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$date9 = $query3w[0];
	$lpost = $query3w[1].$f2part2;
	}

	$last = date($fdformat3, $date9)."<br>By: ";

	if ($user1 == "") {
	$last .= "Guest";
	} else {
	$rf = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$user2."'"));
	$s = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$rf[0]."'"));
	$rank = "<a href='index.php?load=elite&user=".$user1."'><font color='".$s[0]."'>".$user2."</font></a>";

if ($rank == "") {
$last .= "<a href='index.php?load=elite&user=".$user1."'>".$user2."</a>";
} else {
$last .= $rank;
}
}
$tlast = $last." <a href='".$f2part1.$lpost."'><img src='a_images/lpost.jpg' border='0' style='border:1px solid ".$tempfetch[14]."'></a>";

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{forumname}";
$cdata[] = "{sitename}";
$cdata[] = "{icon}";
$cdata[] = "{subject}";
$cdata[] = "{username}";
$cdata[] = "{date}";
$cdata[] = "{lastpost}";
$cdata[] = "{replies}";
$cdata[] = "{views}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $fname[0];
$ddata[] = $setting[sitename];
$ddata[] = $icon;
$ddata[] = $subject;
$ddata[] = $tuser;
$ddata[] = $tdate;
$ddata[] = $tlast;
$ddata[] = $replies;
$ddata[] = $views;
echo str_replace($cdata, $ddata, stripslashes($tempfetch12));
unset($cdata, $ddata, $icon, $subject, $tuser, $tdate, $tlast, $replies, $views);
}
}

$query2at = mysql_query("SELECT * FROM ".$pre."posts WHERE fid = '".$_GET['f']."' AND type = 'topic' ORDER BY `lpostdate` DESC");
	while($row2 = mysql_fetch_array($query2at)) {
	   $tid = "$row2[id]";
	   $views = "$row2[stats]";

       $icon = "<img src='a_images/".$row2[type].".jpg' style='border:1px solid ".$tempfetch[14]."'>";
	   if ($row2[type] == "topic") {
	   } else {
	   $subject .= "<b>".$row2[type].":</b> ";
	   }
	   $subject .= "<a href='".$f2part1.$row2[id].$f2part2."'>".stripslashes($row2[subject])."</a>";

	   if ($row2[locked] == "yes") {
	   $subject .= "&nbsp;&nbsp;<img src='a_images/locked.jpg' border='1'>";
	   }
	if ($row2[uid] == "") {
	$tuser .= "Guest";
	} else {
	$user = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$row2[uid]."' LIMIT 1"));
	$rf = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$user[0]."'"));
	$s = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$rf[0]."'"));
	$rank = "<a href='index.php?load=elite&user=".$row2[uid]."'><font color='".$s[0]."'>".$user[0]."</font></a>";

if ($rank == "") {
$tuser .= "<a href='index.php?load=elite&user=".$row2[uid]."'>".$user[0]."</a>";
} else {
$tuser .= $rank;
}
$tdate = date($fdformat3, $row2[date]);
}

	$replies = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."'"));
	$lcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."'"));

    if ($lcount > "0") {
	$user3 = mysql_fetch_row(mysql_query("SELECT uid FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$user4 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$user3[0]."'"));
	$user1 = $user3[0];
	$user2 = $user4[0];
	$query3w = mysql_fetch_row(mysql_query("SELECT date,id,tid FROM ".$pre."posts WHERE type = 'post' AND tid = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$date9 = $query3w[0];
	$lpost = $query3w[2].$f2part2."#".$query3w[1];
	} else {
	$user1 = $row2[uid];
	$user3 = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$row2[uid]."'"));
	$user2 = $user3[0];
    $query3w = mysql_fetch_row(mysql_query("SELECT date,id FROM ".$pre."posts WHERE id = '".$tid."' ORDER BY `date` DESC LIMIT 1"));
	$date9 = $query3w[0];
	$lpost = $query3w[1].$f2part2;
	}

	$last = date($fdformat3, $date9)."<br>By: ";

	if ($user1 == "") {
	$last .= "Guest";
	} else {
	$rf = mysql_fetch_row(mysql_query("SELECT rank FROM ".$pre."users WHERE username = '".$user2."'"));
	$s = mysql_fetch_row(mysql_query("SELECT color FROM ".$pre."ranks WHERE name = '".$rf[0]."'"));
	$rank = "<a href='index.php?load=elite&user=".$user1."'><font color='".$s[0]."'>".$user2."</font></a>";

if ($rank == "") {
$last .= "<a href='index.php?load=elite&user=".$user1."'>".$user2."</a>";
} else {
$last .= $rank;
}
}
$tlast = $last." <a href='".$f2part1.$lpost."'><img src='a_images/lpost.jpg' border='0' style='border:1px solid ".$tempfetch[14]."'></a>";

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{forumname}";
$cdata[] = "{sitename}";
$cdata[] = "{icon}";
$cdata[] = "{subject}";
$cdata[] = "{username}";
$cdata[] = "{date}";
$cdata[] = "{lastpost}";
$cdata[] = "{replies}";
$cdata[] = "{views}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = $fname[0];
$ddata[] = $setting[sitename];
$ddata[] = $icon;
$ddata[] = $subject;
$ddata[] = $tuser;
$ddata[] = $tdate;
$ddata[] = $tlast;
$ddata[] = $replies;
$ddata[] = $views;
echo str_replace($cdata, $ddata, stripslashes($tempfetch12));
unset($cdata, $ddata, $icon, $subject, $tuser, $tdate, $tlast, $replies, $views);
}

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
echo str_replace($cdata, $ddata, stripslashes($tempfetch10));
unset($cdata, $ddata);

$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM ".$pre."posts WHERE fid = '".$_GET['f']."' AND type = 'topic' OR fid = '".$_GET['f']."' AND type = 'Announcement' OR fid = '".$_GET['f']."' AND type = 'Sticky'"),0);

$total_pages = ceil($total_results / $e2);

if ($total_pages > "1") {
echo "<br><center>Select a Page<br>";

// Build Previous Link
if($page > 1){
	    $test = ($page - 1);
    echo "<a href=\"boards.php?f=".$_GET['f']."&page=$test\"><b>Previous</b></a>&nbsp;";
}

for($i = 1; $i <= $total_pages; $i++){
    if(($page) == $i){
        echo "$i&nbsp;";
        } else {
            echo "<a href=\"boards.php?f=".$_GET['f']."&page=$i\">$i</a>&nbsp;";
    }
}

// Build Next Link
if($page < $total_pages){
    $next = ($page + 1);
    echo "<a href=\"boards.php?f=".$_GET['f']."&page=$next\"><b>Next</b></a>";
}
echo "</center>";
}
}

if (($_GET['locked'] == "yes") && ($_GET['t'])) {
$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'global' OR uid = '".$useridn."' AND level = 'mod' AND place = '".$_GET['f']."' OR uid = '".$useridn."' AND level = 'admin'"));

if ($ou > "0") {
echo '<SCRIPT LANGUAGE="JavaScript">
var agree=confirm("Are you sure you want to lock this topic?");
if (agree)
document.write("");
else
history.go(-1);
</SCRIPT>';

$lock = mysql_query("UPDATE ".$pre."posts SET locked = 'yes' WHERE id = '".$_GET['t']."'") or die(mysql_error());

if ($lock == TRUE) {
echo "<center><b>You successfully locked this topic</b><br><a href='".$f2part1.$_GET['t'].$f2part2."'>View Topic</a><br><a href='boards.php?t=".$_GET['t']."&locked=no'>Unlock Topic</a></center>";
}
}
}

if (($_GET['locked'] == "no") && ($_GET['t'])) {
$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'global'"));
$ou2 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'mod' AND place = '".$_GET['f']."'"));
$ou3 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'admin'"));

if ((($ou > "0") or ($ou2 > "0") or ($ou3 > "0"))) {
echo '<SCRIPT LANGUAGE="JavaScript">
var agree=confirm("Are you sure you want to unlock this topic?");
if (agree)
document.write("");
else
history.go(-1);
</SCRIPT>';

$lock = mysql_query("UPDATE ".$pre."posts SET locked = 'no' WHERE id = '".$_GET['t']."'") or die(mysql_error());

if ($lock == TRUE) {
echo "<center><b>You successfully unlocked this topic</b><br><a href='".$f2part1.$_GET['t'].$f2part2."'>View Topic</a><br><a href='boards.php?t=".$_GET['t']."&locked=yes'>Lock Topic</a></center>";
}
}
}

//This lets the user choose a different theme not working yet!

/*if ($_GET['t'] == "options") {
echo "<form action='".$HTTP_SERVER_VARS['REQUEST_URI']."' method='post' name='skin2'><select name='skin2' onchange='this.form.submit()'><option value='1' selected>-----</option>";

$foptions = mysql_query("SELECT * FROM ".$pre."fskins");
while($row = mysql_fetch_array($foptions)) {
echo "<option value='".$row[id]."'>".$row[name]."</option>";
}

echo "</select></form>";
}*/

//To post a new topic
if (($_GET['t'] == "new") && (is_numeric($_GET['f']))) {
$sql = mysql_fetch_row(mysql_query("SELECT name,locked,vtopic FROM ".$pre."forums WHERE id = '".$_GET['f']."'"));

if ($sql[1] == "yes") {
echo re_direct("2500", $f1part1.$_GET['f'].$f1part2);
echo "Sorry but this forum is locked. Taking you back";
} else {

echo "<title>".$sitename." :: Posting New Topic - Forum: ".$sql[0]."</title>";

if ($_COOKIE[$pre."username"] == "") {
echo "Sorry, but you have to be logged in, in order to post a topic on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
} else {

if (($useridn == "") && ($sql[2] == "No")) {
echo "Sorry, but you have to be logged in, in order to post a topic on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
} else {

if (!$_POST['submit']) {
echo "<SCRIPT LANGUAGE='JavaScript'>
  function smiles(which) {
  document.form1.text1.value = document.form1.text1.value + which;
  }
</SCRIPT>
<script language='javascript'>
function awindow(towhere, newwinname, properties) {
window.open(towhere,newwinname,properties);
}
</script><SCRIPT LANGUAGE='JavaScript'>
function displayHTML(form) { // thanks to javascript.net
var subject = form.subject.value;
var message = form.text1.value;
win = window.open(', ', 'popup', 'toolbar = no, status = no, width=700, align=center');
win.document.write('<body bgcolor=".$tempfetch[15]."><link rel=stylesheet type=text/css href=style.css><link rel=stylesheet type=text/css href=forum.css><table cellpadding=3 cellspacing=0 border=0 width=98% style=border:1px solid ".$tempfetch[14]." align=center><tr bgcolor=".$tempfetch[17]."><td width=15% class=avatar>".profile($useridn, $_COOKIE[$pre."username"])."</td><td width=75%><table cellpadding=1 cellspacing=0 border=0 width=98%><tr><td><b>Posted:</b> ".date($fdformat3, time())."</td><td><b>Subject:</b></td><td>' + subject + '</td><td><b>IP:</b></td><td>".$_SERVER[REMOTE_ADDR]."</td></tr></table><hr color=".$tempfetch[14]."><p>' + message + '</p></td></tr></table>');
}
</script>";
echo "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" align=\"center\" width=\"98%\" style='border:1px solid ".$tempfetch[14]."'><form name='form1' method='post' action='".$HTTP_SERVER_VARS['REQUEST_URI']."'><tr bgcolor='".$tempfetch[17]."'><td><b>Username</b></td>";

if (($_COOKIE[$pre."username"] == "") && ($d == "no")) {
echo "<td><input type='hidden' name='username' value='Guest'>Guest</td>";
}

if (($_COOKIE[$pre."username"] == "") && ($d == "yes")) {
	echo "<td><input type='text' name='username' value=''></td>";
}

if ($_COOKIE[$pre."username"]) {
	echo "<td><input type='hidden' name='username' value='".$_COOKIE[$pre."username"]."'>".$_COOKIE[$pre."username"]."</td>";
}

echo "<td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[16]."'><td><b>Subject</b></td><td><input type='text' name='subject'></td><td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Message</b></td><td><textarea name=\"text1\" cols='50' rows='12'></textarea><input type='hidden' name='fid' value='".$_GET['f']."'></td>";

if ((($_COOKIE[$pre."username"] == "") && ($c == "yes") or ($_COOKIE[$pre."username"]))) {
if ($setting[wysiwyg] == "False") {
echo "<td width='65' align='center'><b>Smilies</b><br>";
$samount = "0";
if ($handle = opendir("smilies")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$samount = $samount + 1;
if (($samount == "9") or ($samount < "9")) {
$file2 = explode(".", $file);
echo "<a href=\"javascript:smiles(' :".strtolower($file2[0]).": ')\"><img src='smilies/".$file."' border='0'></a>&nbsp;";
}
}
}
}
echo "<br><br><a href='javascript:awindow(\"comments.php?view=smilies\", \"\", \"width=200,height=200,scroll=yes\")'>View All</a>";
echo "</td></tr>";
} else {
echo "<td>&nbsp;</td>";
}
}
if ($useridn) {
$result = mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'admin' OR level = 'mod' AND place = '".$_GET['f']."' OR level = 'global'");
$oj = mysql_num_rows($result);
if ($oj > "0") {

echo "<tr bgcolor='".$tempfetch[16]."'><td><b>Topic type:</b></td><td><input type='radio' name='type' value='' checked>Normal&nbsp;&nbsp;<input type='radio' name='type' value='Sticky'>Sticky&nbsp;&nbsp;<input type='radio' name='type' value='Announcement'>Announcement</td><td>&nbsp;</td></tr>";
}
}

echo "<tr bgcolor='".$tempfetch[15]."'><td><input type='submit' name='submit' value='Submit Topic'></td><td><input type='reset' name='reset' value='Reset'></td></tr></table></form><br>";
}

if ($_POST['submit']) {
if (($_COOKIE[$pre."username"] == "") && ($d == "yes")) {
$check = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."users WHERE username = '".$_POST['username']."'"));
if ($check > "0") {
echo "Sorry but this username is already in use, please go back and choose another username";
die;
}
}

$preq = mysql_fetch_row(mysql_query("SELECT prequire FROM ".$pre."forums WHERE id = '".$_POST['fid']."'"));
if ($useridn == "") {
$ptotal = "0";
} else {
$ptotal = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '".$useridn."'"));
$ptotal = $ptotal + 1;
}
if (($ptotal < $preq[0]) && ($preq[0])) {
echo "This forum of ".$sitename." requires ".$preq[0]." posts in order to make a post here and be a member. Sorry.";
} else {

if ($useridn) {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE uid = '".$useridn."' ORDER BY `date` DESC"));
} else {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE ip = '".$_SERVER['REMOTE_ADDR']."' ORDER BY `date` DESC"));
}

$date1 = time() - $pcheck[0];
$am = $setting[spam] - $date1;

if ($date1 < $setting[spam]) {
echo "Sorry but the spam feature is turned to <b>".$spam."</b> seconds and you have surpassed that. Go back and try again in another <b>".$am."</b> seconds.";
} else {

$autobr = preg_replace("/<br>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/<br \/>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/(\015\012)|(\015)|(\012)/","<br />\n",addslashes($_POST["text1"]));




if ($_COOKIE[$pre."username"]) {
$rank = mysql_fetch_row(mysql_query("SELECT points FROM ".$pre."ranks WHERE name = '".$myrank."'"));
$postcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '".$useridn."'"));

$ranks = mysql_query("SELECT * FROM ".$pre."ranks ORDER BY `points` ASC");
while($s = mysql_fetch_array($ranks)) {
if (($postcount > $s[points]) or ($postcount == $s[points])) {
if ($s[points] > $rank[0]) {
mysql_query("UPDATE ".$pre."users SET rank = '".$s[name]."' WHERE username = '".$_COOKIE[$pre."username"]."' AND password = '".$_COOKIE[$pre."password"]."'");
}
}
}
}

$topic2 = "INSERT INTO ".$pre."posts VALUES ('null', '".substr(addslashes($_POST["subject"]),0,30)."', '".$autobr."', '".$useridn."', '".time()."', '".$_POST["fid"]."', '', '0', '";
					
if ($_POST['type']) {
$topic2 .= $_POST['type'];
} else {
$topic2 .= "topic";
}

$topic2 .= "', 'no', '".$_SERVER['REMOTE_ADDR']."', '".time()."')";
$topic = mysql_query($topic2);
					
	$query = mysql_fetch_row(mysql_query("SELECT id FROM ".$pre."posts WHERE subject = '".substr(addslashes($_POST["subject"]),0,30)."' AND date = '".time()."'"));
	$topicid = $query[0];

	$topic2 = mysql_query("UPDATE ".$pre."posts SET tid = '".$topicid."' WHERE id = '".$topicid."'");

if ($topic == TRUE) {
echo re_direct("2500", $f2part1.$topicid.$f2part2);
echo "<center>Topic has been created.</center><br><center>Click <a href='".$f1part1.$_POST['fid'].$f1part2."'><b>here</b></a> to return to the forum<br>Click <a href='".$f2part1.$topicid.$subject.$f2part2."'><b>here</b></a> to view your topic</center>";
}
}
}
}
}
}
}
}
		
	if (is_numeric($_GET['t'])) {
	$fetch = mysql_fetch_row(mysql_query("SELECT fid,locked,subject FROM ".$pre."posts WHERE id = '".$_GET['t']."'"));

	$find = mysql_fetch_row(mysql_query("SELECT name,cat,locked,epost,dpost FROM ".$pre."forums WHERE id = '".$fetch[0]."'"));
	$forumname = $find[0];
	$cat = $find[1];
	$locked = $find[2];
	$epost = $find[3];
	$dpost = $find[4];

	echo "<form action='index.php?load=search&view=forums' method='post'>";
	$nav .= "<b><a href='".$forumsurl."'>Home</a> > <a href='".$f1part1.$fetch[0].$f1part2."'>".$forumname."</a>";
	$rowba = mysql_fetch_row(mysql_query("SELECT id,name FROM ".$pre."forums WHERE type = 'sub' AND cat = '".$cat."'"));
	if ($rowba[0] == $fetch[0]) {
	$nav .= " > <a href='".$f1part1.$rowba[0].$f1part2."'>".$rowba[1]."</a>";
	}
	$nav .= "</b>";
	$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'global' OR uid = '".$useridn."' AND level = 'admin' OR uid = '".$useridn."' AND level = 'mod' AND place = '".$fetch[0]."'"));
	if ((($ou > "0") && ($_COOKIE[$pre."username"]) && ($useridn))) {
	if ($fetch[1] == "yes") {
	$locked .= "<a href='boards.php?t=".$_GET['t']."&f=".$fetch[0]."&locked=no'>Unlock Topic?</a>";
	} else {
	$locked .= "<a href='boards.php?t=".$_GET['t']."&f=".$fetch[0]."&locked=yes'>Lock Topic?</a>";
	}
	}
	$search = "<input type='text' name='search'>&nbsp;&nbsp;<select name='type'><option value='forum|".$fetch[0]."'>Forum</option><option value='topic|".$_GET['t']."'>Topic</option></select>&nbsp;&nbsp;<input type='submit' value='Search'>";
	$tcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."elite WHERE type = 'topic' AND game = '".$_GET['t']."' AND pid = '".$useridn."'"));
	if ($useridn) {
	if ($tcount == "0") {
	$nreply .= "<a href='boards.php?t=track&id=".$_GET['t']."&type=add'><b>Track Topic</b></a></td><td>";
	} else {
	$nreply .= "<a href='boards.php?t=track&id=".$_GET['t']."&type=del'><b>Un-Track Topic</b></a></td><td>";
	}
	}
	$nreply .= "<a href='boards.php?t=reply&id=".$_GET['t']."&tid=".$_GET['t']."&fid=".$fetch[0]."'><img src='a_images/nreply.jpg' style='border:1px solid black'></a>";
	$move = "<a href='boards.php?t=move&id=".$_GET['t']."'><img src='a_images/move.jpg' style='border:1px solid black'></a>";

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{topicname}";
$cdata[] = "{sitename}";
$cdata[] = "{reply}";
$cdata[] = "{search}";
$cdata[] = "{nav}";
$cdata[] = "{locked}";
$cdata[] = "{move}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = stripslashes($fetch[2]);
$ddata[] = $setting[sitename];
$ddata[] = $nreply;
$ddata[] = $search;
$ddata[] = $nav;
$ddata[] = $locked;
$ddata[] = $move;
echo str_replace($cdata, $ddata, stripslashes($tempfetch11));
unset($cdata, $ddata, $nreply, $search, $nav, $locked, $move);

if(!isset($_GET['page'])){
    $page = 1;
} else {
    $page = $_GET['page'];
}

$from = (($page * $setting[posts_per_page]) - $setting[posts_per_page]);

$post = mysql_query("SELECT * FROM ".$pre."posts WHERE tid = '".$_GET['t']."' OR id = '".$_GET['t']."' ORDER BY `id` ASC LIMIT $from, $setting[posts_per_page]");
while($p = mysql_fetch_array($post)) {
$fet = mysql_fetch_row(mysql_query("SELECT username FROM ".$pre."profile WHERE id = '".$p[uid]."'"));
$pusername = $fet[0];

$profile = profile($p[uid], $pusername);
$sql = mysql_query("SELECT * FROM ".$pre."profile WHERE username = '".$pusername."'");
while($row = mysql_fetch_array($sql)){
	$av = "$row[avatar]";
	$signature2 = stripslashes($row[sig]);
	$signaturey = preg_replace("/<br>\n/","\n",$signature2);
	$signaturey = preg_replace("/<br\>\n/","\n",$signature2);
	$signaturey = preg_replace("/(\015\012)|(\015)|(\012)/","<br>\n",$signature2);
    $signature = str_replace($ty, $np, $signaturey);
}
	$val = $p[stats] + 1;
	mysql_query("UPDATE ".$pre."posts SET stats = '".$val."' WHERE tid = '".$p[tid]."'");
	
	$tdate = date($fdformat3, $p['date']);
	$subject .= "<a href='".$f2part1.$p[tid].$f2part2;
	if ($p[type] == "post") {
	$subject .= "#".$p[id];
	}
	$subject .= "'>".stripslashes($p[subject])."</a>";
	
	if (($ou > "0") && (is_numeric($useridn))) {	
	$ip = "<td><b>IP:</b> <a href='boards.php?t=ip&ip=".$p[ip]."'>".$p[ip]."</a></td>";
	} else {
	$ip = "";
	}

	$pr = mysql_fetch_row(mysql_query("SELECT aim,msn,yahoo,icq,gtalk FROM ".$pre."profile WHERE username = '".$pusername."'"));
	$email = mysql_fetch_row(mysql_query("SELECT email FROM ".$pre."users WHERE username = '".$pusername."'"));

	if ($pr[0]) {
	$pinfo .= "<td><a href='aim:goim?screenname=".$pr[0]."&message=Hello+Are+you+there?'><img src='a_images/aim_icon.gif' border='0'></a></td>";
	}
	if ($pr[1]) {
	$pinfo .= "<td><a href='index.php?load=elite&user=".$p[uid]."'><img src='a_images/msn_icon.gif' border='0'></a></td>";
	}
	if ($pr[2]) {
	$pinfo .= "<td><a href='http://edit.yahoo.com/config/send_webmesg?.target=".$pr[2]."&.src=pg'><img src='a_images/yahoo_icon.gif' border='0'></a></td>";
	}
	if ($pr[3]) {
	$pinfo .= "<td><a href='http://wwp.icq.com/scripts/search.dll?to=".$pr[3]."'><img src='a_images/icq_icon.gif' border='0'></a></td>";
	}
	if ($pr[4]) {
	$pinfo .= "<td><a href='index.php?load=elite&user=".$p[uid]."'><img src='a_images/gtalk_icon.gif' border='0'></a></td>";
	}
	
	$postid = $p[id];

if ($handle = opendir("includes/smilies")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$file2 = explode(".", $file);
$s[] = ":".$file2[0].":";
$r[] = "[img]smilies/".$file."[/img]";
}
}
}

	$hehe2 = mysql_query("SELECT * FROM ".$pre."smwords WHERE type = 'badword'");
    while ($row = mysql_fetch_array($hehe2)) {
		$s[] = $row[name];
		$r[] = $row[field];
	}

		$s[] = "{quote}";
		$s[] = "{endquote}";
		$r[] = "<table cellspacing='0' cellpadding='3' border='0' align='center' width='90%'><tr><td class='quote1'><b>Quote:</b></td></tr><tr><td class='quote'>";
		$r[] = "</td></tr></table>";
        $message = str_replace($s, $r, stripslashes($p[message]));
		$message = alinks($message);
        $message = bbcode($message);
		if ($p[uid]) {
		$tsig = alinks($signature);
		$tsig = bbcode($tsig);
		}
		if (($p[uid]) && ($email[0])) {
		$temail = "<a href='mailto:".$email[0]."'><img src='a_images/email_icon.png' border='0'></a><br>";
		}
		$backtotop = "<a href='#top'>Back to Top</a>";
		$flock = mysql_fetch_row(mysql_query("SELECT locked FROM ".$pre."forums WHERE id = '".$p[fid]."'"));

if ($p[uid]) {
$lpm = "<a href='index.php?load=new=msg&user=".$pusername."'><img src='a_images/pm.jpg' style='border:1px solid black'></a>&nbsp;&nbsp;&nbsp;";
}

if ((($p[locked] == "no") && ($locked == "") && ($flock[0] == ""))) {
if ((($_COOKIE[$pre."username"] == "") && ($a == "yes") or ($_COOKIE[$pre."username"]))) {
$linfo .= "<a href='boards.php?t=reply&id=".$p[id]."&tid=".$p[tid]."&fid=".$p[fid]."'><img src='a_images/reply.jpg' style='border:1px solid black'></a>&nbsp;&nbsp;&nbsp;<a href='boards.php?t=quote&id=".$p[id]."&tid=".$p[tid]."&fid=".$p[fid]."'><img src='a_images/quote.jpg' style='border:1px solid black'></a>&nbsp;&nbsp;&nbsp;";
}
}

    if ($useridn) {
    if ((($ou > "0") or ($useridn == $p[uid]) && ($epost == "Yes"))) {
	$linfo .= "<a href='boards.php?t=edit&id=".$p[id]."'><img src='a_images/edit.jpg' style='border:1px solid black'></a>&nbsp;&nbsp;&nbsp;";
	}
	if ((($ou > "0") or ($useridn == $p[uid]) && ($dpost == "Yes"))) {
	$linfo .= "<a href='boards.php?t=delete&id=".$p[id]."'><img src='a_images/delete.jpg' style='border:1px solid black'></a>&nbsp;&nbsp;&nbsp;";
    }
	}
	$report = "</td><td align='right'><a href='boards.php?t=report&id=".$p[id]."'><img src='a_images/report.jpg' style='border:1px solid black'></a></td></tr></table></td></tr>";

$cdata[] = "{bordercolor}";
$cdata[] = "{bgcolor1}";
$cdata[] = "{bgcolor2}";
$cdata[] = "{bgcolor3}";
$cdata[] = "{forumurl}";
$cdata[] = "{topicname}";
$cdata[] = "{sitename}";
$cdata[] = "{profile}";
$cdata[] = "{date}";
$cdata[] = "{subject}";
$cdata[] = "{ip}";
$cdata[] = "{messengers}";
$cdata[] = "{id}";
$cdata[] = "{post}";
$cdata[] = "{signature}";
$cdata[] = "{email}";
$cdata[] = "{backtotop}";
$cdata[] = "{pm}";
$cdata[] = "{info}";
$cdata[] = "{report}";

$ddata[] = $tempfetch[14];
$ddata[] = $tempfetch[15];
$ddata[] = $tempfetch[16];
$ddata[] = $tempfetch[17];
$ddata[] = $forumsurl;
$ddata[] = stripslashes($fetch[2]);
$ddata[] = $setting[sitename];
$ddata[] = $profile;
$ddata[] = $tdate;
$ddata[] = $subject;
$ddata[] = $ip;
$ddata[] = $pinfo;
$ddata[] = $postid;
$ddata[] = $message;
$ddata[] = $tsig;
$ddata[] = $temail;
$ddata[] = $backtotop;
$ddata[] = $lpm;
$ddata[] = $linfo;
$ddata[] = $report;
echo str_replace($cdata, $ddata, stripslashes($tempfetch13));
unset($cdata, $ddata, $profile, $tdate, $subject, $ip, $pinfo, $postid, $ipost, $tsig, $temail, $backtotop, $lpm, $linfo, $report);
}
echo "</table></form>";
$total_results = mysql_result(mysql_query("SELECT COUNT(*) as Num FROM ".$pre."posts WHERE tid = '".$_GET['t']."' OR id = '".$_GET['t']."'"),0);

$total_pages = ceil($total_results / $setting[posts_per_page]);

if ($total_pages > "1") {
echo "<center>Select a Page<br>";

// Build Previous Link
if($page > 1){
    $prev = ($page - 1);
    echo "<a href=\"boards.php?t=".$_GET['t']."&page=$prev\"><<Previous</a>&nbsp;";
}

for($i = 1; $i <= $total_pages; $i++){
    if(($page) == $i){
        echo "$i&nbsp;";
        } else {
            echo "<a href=\"boards.php?t=".$_GET['t']."&page=$i\">$i</a>&nbsp;";if (($i/25) == (int)($i/25)) {echo "<br>";}
    }
}

// Build Next Link
if($page < $total_pages){
    $next = ($page + 1);
    echo "<a href=\"boards.php?t=".$_GET['t']."&page=$next\">Next>></a>";
}
echo "</center><br>";
}
}

//To move a topic
if ($_GET['t'] == "move") {
$sql = mysql_fetch_row(mysql_query("SELECT subject,locked,fid,message FROM ".$pre."posts WHERE id = '".$_GET['id']."'"));

if ((($_COOKIE[$pre."username"] == "") && ($a == "no") && (is_numeric($useridn)))) {
echo "Sorry, but you have to be logged in, in order to post on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
} else {

$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'global'"));
$ou2 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'admin'"));
$ou3 = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'mod' AND place = '".$sql[3]."'"));
if ((($ou > "0") or ($ou2 > "0") or ($ou3 > "0"))) {

if (!$_POST['submit']) {

echo "<title>".$sitename." :: Moving Topic - ".$sql[0]."</title>";

echo "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" align=\"center\" width=\"98%\" style=\"border:1px solid ".$tempfetch[14]."\"><form name='form1' method='post' action='".$HTTP_SERVER_VARS['REQUEST_URI']."'><tr bgcolor='".$tempfetch[17]."'><input type='hidden' name='id' value='".$_GET['id']."'><tr bgcolor='".$tempfetch[16]."'><td><b>Subject</b></td><td>".stripslashes($sql[0])."</td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Move to Forum</b></td><td><select name='moveto'>";

$sql = mysql_query("SELECT * FROM ".$pre."forums WHERE type = 'sub' OR type = 'forum' ORDER BY `name` ASC");
while($r = mysql_fetch_array($sql)) {
if ($r[type] == "sub") {
$n = explode("||", $r[name]);
echo "<option value='".$r[id]."'>".$n[0]."</option>";
} else {
echo "<option value='".$r[id]."'>".$r[name]."</option>";
}
}

echo "</select></td></tr><tr bgcolor='".$tempfetch[15]."'><td><input type='submit' name='submit' value='Move Topic'></td><td>&nbsp;</td></tr></table></form>";
}

if ($_POST['submit']) {
$post = mysql_query("UPDATE ".$pre."posts SET fid = '".$_POST['moveto']."' WHERE id = '".$_POST['id']."' OR tid = '".$_POST['id']."'") or die(mysql_error());

if ($post == TRUE) {
echo re_direct("2500", $f2part1.$_POST['id'].$f2part2);
echo "<center>Topic has been moved.</center><br><center>Click <a href='".$f1part1.$_POST['moveto'].$f1part2."'><b>here</b></a> to return to the forum<br>Click <a href='".$f2part1.$_POST['id'].$f2part2."'><b>here</b></a> to view the topic</center>";
}
}
}
}
}

//Editing a post
if ($_GET['t'] == "edit") {
$sql = mysql_fetch_row(mysql_query("SELECT subject,locked,tid,fid,message FROM ".$pre."posts WHERE id = '".$_GET['id']."'"));
$sqq = mysql_fetch_row(mysql_query("SELECT subject,locked,uid FROM ".$pre."posts WHERE id = '".$sql[2]."'"));
$sq2 = mysql_fetch_row(mysql_query("SELECT locked,epost FROM ".$pre."forums WHERE id = '".$sql[3]."'"));

if ((($sql[1] == "yes") or ($sqq[1] == "yes") or ($sq2[0] == "yes"))) {
echo re_direct("2500", $f2part1.$sqq[0].$f2part2);
echo "Sorry but this topic/forum is locked. Taking you back to the topic";
} else {

if ($useridn == "") {
echo "Sorry, but you have to be logged in, in order to edit your post on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
} else {

$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'global' OR uid = '".$useridn."' AND level = 'admin' OR uid = '".$useridn."' AND level = 'mod' AND place = '".$sql[3]."'"));
if ((($ou > "0") or ($useridn == $sqq[2]) && ($sq2[1] == "Yes"))) {

if (!$_POST['submit']) {	
echo "<title>".$sitename." :: Editing Post - ".$sql[0]."</title>";
echo "<SCRIPT LANGUAGE='JavaScript'>
  function smiles(which) {
  document.form1.text1.value = document.form1.text1.value + which;
  }
</SCRIPT>
<script language='javascript'>
function awindow(towhere, newwinname, properties) {
window.open(towhere,newwinname,properties);
}
</script><SCRIPT LANGUAGE='JavaScript'>
function displayHTML(form) { // thanks to javascript.net
var subject = form.subject.value;
var message = form.text1.value;
win = window.open(', ', 'popup', 'toolbar = no, status = no, width=700, align=center');
win.document.write('<body bgcolor=".$tempfetch[15]."><link rel=stylesheet type=text/css href=style.css><link rel=stylesheet type=text/css href=forum.css><table cellpadding=3 cellspacing=0 border=0 width=98% style=border:1px solid ".$tempfetch[14]." align=center><tr bgcolor=".$tempfetch[17]."><td width=15% class=avatar>".profile($useridn, $_COOKIE[$pre."username"])."</td><td width=75%><table cellpadding=1 cellspacing=0 border=0 width=98%><tr><td><b>Posted:</b> ".date($fdformat3, time())."</td><td><b>Subject:</b></td><td>' + subject + '</td><td><b>IP:</b></td><td>".$_SERVER[REMOTE_ADDR]."</td></tr></table><hr color=".$tempfetch[14]."><p>' + message + '</p></td></tr></table>');
}
</script>";
echo "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" align=\"center\" width=\"98%\" style=\"border:1px solid ".$tempfetch[14]."\"><form name='form1' method='post' action='".$HTTP_SERVER_VARS['REQUEST_URI']."'><tr bgcolor='".$tempfetch[17]."'><input type='hidden' name='id' value='".$_GET['id']."'><input type='hidden' name='tid' value='".$sql[2]."'><tr bgcolor='".$tempfetch[16]."'><td><b>Subject</b></td><td><input type='text' name='subject' value=\"".stripslashes($sql[0])."\"></td><td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Message</b></td><td><textarea name=\"text1\" cols='50' rows='12'>".stripslashes($sql[4])."</textarea></td><input type='hidden' name='fid' value='".$sql[3]."'>";

if ((($_COOKIE[$pre."username"] == "") && ($c == "yes") or ($_COOKIE[$pre."username"]))) {
if ($setting[wysiwyg] == "False") {
echo "<td width='65' align='center'><b>Smilies</b><br>";
$samount = "0";
if ($handle = opendir("smilies")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$samount = $samount + 1;
if (($samount == "9") or ($samount < "9")) {
$file2 = explode(".", $file);
echo "<a href=\"javascript:smiles(' :".strtolower($file2[0]).": ')\"><img src='smilies/".$file."' border='0'></a>&nbsp;";
}
}
}
}
echo "<br><br><a href='javascript:awindow(\"comments.php?view=smilies\", \"\", \"width=200,height=200,scroll=yes\")'>View All</a>";
echo "</td></tr>";
} else {
echo "<td>&nbsp;</td>";
}
}
echo "<tr bgcolor='".$tempfetch[15]."'><td><input type='submit' name='submit' value='Update Post'></td><td><input type='reset' name='reset' value='Reset'></td></tr></table></form>";
}

if ($_POST['submit']) {
$autobr = preg_replace("/<br>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/<br \/>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/(\015\012)|(\015)|(\012)/","<br />\n",addslashes($_POST["text1"]));

if ($useridn) {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE uid = '".$useridn."' ORDER BY `date` DESC"));
} else {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE ip = '".$_SERVER['REMOTE_ADDR']."' ORDER BY `date` DESC"));
}

$date1 = time() - $pcheck[0];
$am = $setting[spam] - $date1;

if ($date1 < $setting[spam]) {
echo "Sorry but the spam feature is turned to <b>".$spam."</b> seconds and you have surpassed that. Go back and try again in another <b>".$am."</b> seconds.";
} else {

$post = mysql_query("UPDATE ".$pre."posts SET subject = '".addslashes($_POST["subject"])."', message = '".$autobr."' WHERE id = '".$_POST['id']."'") or die(mysql_error());

if ($post == TRUE) {
echo re_direct("2500", $f2part1.$_POST['tid'].$f2part2."#".$_POST['id']);
echo "<center>Post has been edited.</center><br><center>Click <a href='".$f1part1.$_POST['fid'].$f1part2."'><b>here</b></a> to return to the forum<br>Click <a href='".$f2part1.$_POST['tid'].$f2part2."#".$_POST['id']."'><b>here</b></a> to view the post</center>";
}
}
}
}
}
}
}

//Deleting a post from the forum
if ($_GET['t'] == "delete") {
$sqq = mysql_fetch_row(mysql_query("SELECT uid FROM ".$pre."posts WHERE id = '".$sql[2]."'"));
$sq2 = mysql_fetch_row(mysql_query("SELECT dpost FROM ".$pre."forums WHERE id = '".$sql[3]."'"));
$sql = mysql_fetch_row(mysql_query("SELECT subject,tid,fid,type FROM ".$pre."posts WHERE id = '".$_GET['id']."'"));

if ($useridn == "") {
echo "Sorry, but you have to be logged in, in order to delete your post on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
} else {

$ou = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."boardcp WHERE uid = '".$useridn."' AND level = 'global' OR uid = '".$useridn."' AND level = 'admin' OR uid = '".$useridn."' AND level = 'mod' AND place = '".$sql[3]."'"));
if ((($ou > "0") or ($useridn == $sqq[0]) && ($sq2[0] == "Yes"))) {

if (!$_POST['submit']) {	

echo "<title>".$sitename." :: Deleting Post - ".$sql[0]."</title>";

echo "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" align=\"center\" width=\"98%\" style=\"border:1px solid ".$tempfetch[14]."\"><form name='form1' method='post' action='".$HTTP_SERVER_VARS['REQUEST_URI']."'><tr bgcolor='".$tempfetch[17]."'><input type='hidden' name='fid' value='".$sql[2]."'><input type='hidden' name='id' value='".$_GET['id']."'><input type='hidden' name='tid' value='".$sql[1]."'><input type='hidden' name='type' value='".$sql[3]."'><tr bgcolor='".$tempfetch[16]."'><td>&nbsp;</td><td><b>Confirmation</b></td><td>&nbsp;</td><td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Delete Post?</b></td><td></td><td><input type='submit' name='submit' value='Delete Post'></td><td>&nbsp;</td></tr></table></form>";
}

if ($_POST['submit']) {
if ($_POST['type'] == "post") {
$post = mysql_query("DELETE FROM ".$pre."posts WHERE id = '".$_POST['id']."'") or die(mysql_error());
} else {
$post = mysql_query("DELETE FROM ".$pre."posts WHERE tid = '".$_POST['id']."' OR id = '".$_POST['id']."'") or die(mysql_error());
}

if ($post == TRUE) {
if ($_POST['type'] == "post") {
echo re_direct("2500", $f2part1.$_POST['tid'].$f2part2);
echo "<center>Post has been deleted.</center><br><center>Click <a href='".$f1part1.$_POST['fid'].$f1part2."'><b>here</b></a> to return to the forum<br>Click <a href='".$f2part1.$_POST['tid'].$f2part2."'><b>here</b></a> to view the post</center>";
} else {
echo re_direct("2500", $f2part1.$_POST['fid'].$f2part2);
echo "<center>Topic has been deleted.</center><br><center>Click <a href='".$f1part1.$_POST['fid'].$f1part2."'><b>here</b></a> to return to the forum</center>";
}
}
}
}
}
}
//To Quote a post
if ($_GET['t'] == "quote") {

$sql = mysql_fetch_row(mysql_query("SELECT subject,locked FROM ".$pre."posts WHERE id = '".$_GET['id']."'"));
$sqq = mysql_fetch_row(mysql_query("SELECT subject,locked FROM ".$pre."posts WHERE id = '".$_GET['tid']."'"));
$sq2 = mysql_fetch_row(mysql_query("SELECT locked,vpost FROM ".$pre."forums WHERE id = '".$_GET['fid']."'"));

if ((($sql[1] == "yes") or ($sqq[1] == "yes") or ($sq2[0] == "yes"))) {
echo re_direct("2500", $f2part1.$_GET['tid'].$f2part2);
echo "Sorry but this topic/forum is locked. Taking you back to the topic";
} else {

if (($useridn == "") && ($sq2[1] == "No")) {
echo "Sorry, but you have to be logged in, in order to post on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
} else {

if (!$_POST['submit']) {

echo "<title>".$sitename." :: Quoting Post - ".$sql[0]."</title>";
echo "<SCRIPT LANGUAGE='JavaScript'>
  function smiles(which) {
  document.form1.text1.value = document.form1.text1.value + which;
  }
</SCRIPT>
<script language='javascript'>
function awindow(towhere, newwinname, properties) {
window.open(towhere,newwinname,properties);
}
</script><SCRIPT LANGUAGE='JavaScript'>
function displayHTML(form) { // thanks to javascript.net
var subject = form.subject.value;
var message = form.text1.value;
win = window.open(', ', 'popup', 'toolbar = no, status = no, width=700, align=center');
win.document.write('<body bgcolor=".$tempfetch[15]."><link rel=stylesheet type=text/css href=style.css><link rel=stylesheet type=text/css href=forum.css><table cellpadding=3 cellspacing=0 border=0 width=98% style=border:1px solid ".$tempfetch[14]." align=center><tr bgcolor=".$tempfetch[17]."><td width=15% class=avatar>".profile($useridn, $_COOKIE[$pre."username"])."</td><td width=75%><table cellpadding=1 cellspacing=0 border=0 width=98%><tr><td><b>Posted:</b> ".date($fdformat3, time())."</td><td><b>Subject:</b></td><td>' + subject + '</td><td><b>IP:</b></td><td>".$_SERVER[REMOTE_ADDR]."</td></tr></table><hr color=".$tempfetch[14]."><p>' + message + '</p></td></tr></table>');
}
</script>";

echo "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" align=\"center\" width=\"98%\" style=\"border:1px solid ".$tempfetch[14]."\"><form name='form1' method='post' action='".$HTTP_SERVER_VARS['REQUEST_URI']."'><tr bgcolor='".$tempfetch[17]."'><td><b>Username</b></td>";
if (($useridn == "") && ($d == "no")) {
	echo "<td><input type='hidden' name='username' value='Guest'>Guest</td>";
}

if (($useridn == "") && ($d == "yes")) {
	echo "<td><input type='text' name='username' value=''></td>";
}

if ($useridn) {
	echo "<td><input type='hidden' name='username' value='".$_COOKIE[$pre."username"]."'>".$_COOKIE[$pre."username"]."</td>";
}

$smilies = mysql_fetch_row(mysql_query("SELECT subject,message FROM ".$pre."posts WHERE id = '".$_GET['id']."'"));
$msg = stripslashes($smilies[1]);

echo "<input type='hidden' name='id' value='".$_GET['id']."'><input type='hidden' name='tid' value='".$_GET['tid']."'><td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[16]."'><td><b>Subject</b></td><td><input type='text' name='subject' value=\"Re: ".stripslashes($sqq[0])."\"></td><td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Message</b></td><td><textarea name=\"text1\" cols='50' rows='12'>[quote]".$msg."[/quote]

</textarea></td><input type='hidden' name='fid' value='".$_GET['fid']."'>";

if ((($_COOKIE[$pre."username"] == "") && ($c == "yes") or ($_COOKIE[$pre."username"]))) {
if ($setting[wysiwyg] == "False") {
echo "<td width='65' align='center'><b>Smilies</b><br>";
$samount = "0";
if ($handle = opendir("smilies")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$samount = $samount + 1;
if (($samount == "9") or ($samount < "9")) {
$file2 = explode(".", $file);
echo "<a href=\"javascript:smiles(' :".strtolower($file2[0]).": ')\"><img src='includes/smilies/".$file."' border='0'></a>&nbsp;";
}
}
}
}
echo "<br><br><a href='javascript:awindow(\"comments.php?view=smilies\", \"\", \"width=200,height=200,scroll=yes\")'>View All</a>";
echo "</td></tr>";
} else {
echo "<td>&nbsp;</td>";
}
}
//CAPTCHA
if (($_COOKIE[$pre."username"] == "") && ($setting[captcha] == "Yes")) {
$ts = time();
?>
<script language="JavaScript"><!--
ts = <?= $ts ?>;
--></script>
<?php

echo "<tr><td><img id='captcha' src='includes/captcha.php?img=".$ts."'></td></tr><tr><td>* Displayed Code?</td><td><input type='text' name='captcha'><a href=\"no_matter\" onclick=\"document.getElementById('captcha').src = 'includes/captcha.php?img=' + ++ts; return false\">click for new code</a></td></tr>";
} else {
}
echo "</tr><tr bgcolor='".$tempfetch[15]."'><td><input type='submit' name='submit' value='Submit Post'></td><td><input type='submit' name='preview' value='Preview'></td></tr></table></form>";
}

//To preview a post
if ($_POST['preview']) {
print($_POST["text1"]);
}

if ($_POST['submit']) {
//CAPTCHA Check
if (($_COOKIE[$pre."username"] == "") && ($setting[captcha] == "yes")) {
session_start();
$salted = $_POST['captcha'];
global $captcha_salt;
if (md5($captcha_salt.$salted) != $_SESSION['captcha']) {
eval (" ?>" . headera() . " <?php ");
echo "Wrong code entered, go back and try again";
echo $captcha_salt;
eval (" ?>" . footera() . " <?php ");
die;
}
}

//Auto break
if ($autobron == "yes") {
$autobr = preg_replace("/<br>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/<br \/>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/(\015\012)|(\015)|(\012)/","<br />\n",addslashes($_POST["text1"]));
} else {
$autobr = addslashes($_POST["text1"]);
}

$preq = mysql_fetch_row(mysql_query("SELECT prequire FROM ".$pre."forums WHERE id = '".$_POST['fid']."'"));
if ($useridn == "") {
$ptotal = "0";
} else {
$ptotal = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '".$useridn."'"));
$ptotal = $ptotal + 1;
}
if (($ptotal < $preq[0]) && ($preq[0])) {
echo "This forum of ".$sitename." requires ".$preq[0]." posts in order to make a post here and be a member. Sorry.";
} else {

if ($useridn) {
$tcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."elite WHERE type = 'topic' AND game = '".$_POST['tid']."' AND pid = '".$useridn."'"));
if ($tcount > "0") {
mysql_query("INSERT INTO ".$pre."pm VALUES ('null', '1', 'Tracked: New post in topic <b>".substr(addslashes($_POST["subject"]),0,30)."</b>', 'Hello,<br><br>There has been a new message posted in the topic <b>".substr(addslashes($_POST["subject"]),0,30)."</b>. You can view the topic below:<br><br><a href=\'".$f2part1.$_POST['tid'].$f2part2."\'>View topic - <b>".substr(addslashes($_POST["subject"]),0,30)."</b></a><br><br>Thank you.', 'admin', '".$_COOKIE[$pre."username"]."', '".time()."', 'tracked')");
}
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE uid = '".$useridn."' ORDER BY `date` DESC"));
} else {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE ip = '".$_SERVER['REMOTE_ADDR']."' ORDER BY `date` DESC"));
}

$date1 = time() - $pcheck[0];
$am = $setting[spam] - $date1;

if ($date1 < $setting[spam]) {
echo "Sorry but the spam feature is turned to <b>".$spam."</b> seconds and you have surpassed that. Go back and try again in another <b>".$am."</b> seconds.";
} else {

if ($_COOKIE[$pre."username"]) {
$rank = mysql_fetch_row(mysql_query("SELECT points FROM ".$pre."ranks WHERE name = '".$myrank."'"));
$postcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '".$useridn."'"));

$ranks = mysql_query("SELECT * FROM ".$pre."ranks ORDER BY `points` ASC");
while($s = mysql_fetch_array($ranks)) {
if (($postcount > $s[points]) or ($postcount == $s[points])) {
if ($s[points] > $rank[0]) {
mysql_query("UPDATE ".$pre."users SET rank = '".$s[name]."' WHERE username = '".$_COOKIE[$pre."username"]."' AND password = '".$_COOKIE[$pre."password"]."'");
}
}
}
}

$post = mysql_query("INSERT INTO ".$pre."posts VALUES ('null', '".substr(addslashes($_POST["subject"]),0,30)."', '".$autobr."', '".$useridn."', '".time()."', '".$_POST["fid"]."', '".$_POST["tid"]."', '0', 'post', 'no', '".$_SERVER['REMOTE_ADDR']."', '".time()."')") or die(mysql_error());

mysql_query("UPDATE ".$pre."posts SET lpostdate = '".time()."' WHERE id = '".$_POST['tid']."'");
					
$queryp = mysql_fetch_row(mysql_query("SELECT id FROM ".$pre."posts WHERE date = '".time()."' AND type = 'post' AND message = '".$autobr."'"));
$postid = $queryp[0];

if ($post == TRUE) {
echo re_direct("2500", $f2part1.$_GET['tid'].$f2part2."#".$postid);
echo "<center>Post has been created.</center><br><center>Click <a href='".$f1part1.$_GET['fid'].$f1part2."'><b>here</b></a> to return to the forum<br>Click <a href='".$f2part1.$_GET['tid'].$f2part2."#".$postid."'><b>here</b></a> to view your post</center>";
}
}
}
}
}
}
}

//Reply to a post
if ($_GET['t'] == "reply") {
$sql = mysql_fetch_row(mysql_query("SELECT subject,locked FROM ".$pre."posts WHERE id = '".$_GET['id']."'"));
$sqq = mysql_fetch_row(mysql_query("SELECT subject,locked FROM ".$pre."posts WHERE id = '".$_GET['tid']."'"));
$sq2 = mysql_fetch_row(mysql_query("SELECT locked,vpost FROM ".$pre."forums WHERE id = '".$_GET['fid']."'"));

if ((($sql[1] == "yes") or ($sqq[1] == "yes") or ($sq2[0] == "yes"))) {
echo re_direct("2500", $f2part1.$_GET['tid'].$f2part2);
echo "Sorry but this topic/forum is locked. Taking you back to the topic";
} else {

if ((($_COOKIE[$pre."username"] == "") && ($a == "no"))) {
echo "Sorry, but you have to be logged in, in order to post on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
} else {

echo "<title>".$sitename." :: Replying to Post - ".$sql[0]."</title>";
//if (($useridn == "") && ($sq2[1] == "No")) {
//echo "Sorry, but you have to be logged in, in order to post on the ".$sitename." forums. Please <a href='login.html'><b>Login</b></a> or <a href='register.html'><b>Register</b></a>";
//} else {

if (!$_POST['submit']) {
echo "<SCRIPT LANGUAGE='JavaScript'>
  function smiles(which) {
  document.form1.text1.value = document.form1.text1.value + which;
  }
</SCRIPT>
<script language='javascript'>
function awindow(towhere, newwinname, properties) {
window.open(towhere,newwinname,properties);
}
</script><SCRIPT LANGUAGE='JavaScript'>
function displayHTML(form) { // thanks to javascript.net
var subject = form.subject.value;
var message = form.text1.value;
win = window.open(', ', 'popup', 'toolbar = no, status = no, width=700, align=center');
win.document.write('<body bgcolor=".$tempfetch[15]."><link rel=stylesheet type=text/css href=style.css><link rel=stylesheet type=text/css href=forum.css><table cellpadding=3 cellspacing=0 border=0 width=98% style=border:1px solid ".$tempfetch[14]." align=center><tr bgcolor=".$tempfetch[17]."><td width=15% class=avatar>".profile($useridn, $_COOKIE[$pre."username"])."</td><td width=75%><table cellpadding=1 cellspacing=0 border=0 width=98%><tr><td><b>Posted:</b> ".date($fdformat3, time())."</td><td><b>Subject:</b></td><td>' + subject + '</td><td><b>IP:</b></td><td>".$_SERVER[REMOTE_ADDR]."</td></tr></table><hr color=".$tempfetch[14]."><p>' + message + '</p></td></tr></table>');
}
</script>";

echo "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" align=\"center\" width=\"98%\" style=\"border:1px solid ".$tempfetch[14]."\"><form name='form1' method='post' action='".$HTTP_SERVER_VARS['REQUEST_URI']."'><tr bgcolor='".$tempfetch[17]."'><td><b>Username</b></td>";
if (($useridn == "") && ($d == "no")) {
	echo "<td><input type='hidden' name='username' value='Guest'>Guest</td>";
}

if (($useridn == "") && ($d == "yes")) {
	echo "<td><input type='text' name='username' value=''></td>";
}

if ($useridn) {
	echo "<td><input type='hidden' name='username' value='".$_COOKIE[$pre."username"]."'>".$_COOKIE[$pre."username"]."</td>";
}

echo "<input type='hidden' name='id' value='".$_GET['id']."'><input type='hidden' name='tid' value='".$_GET['tid']."'><td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[16]."'><td><b>Subject</b></td><td><input type='text' name='subject' value=\"Re: ".stripslashes($sqq[0])."\"></td><td>&nbsp;</td></tr><tr bgcolor='".$tempfetch[17]."'><td><b>Message</b></td><td><textarea name=\"text1\" cols='50' rows='12'></textarea></td><input type='hidden' name='fid' value='".$_GET['fid']."'>";

if ((($_COOKIE[$pre."username"] == "") && ($c == "yes") or ($_COOKIE[$pre."username"]))) {
if ($setting[wysiwyg] == "False") {
echo "<td width='65' align='center'><b>Smilies</b><br>";
$samount = "0";
if ($handle = opendir("smilies")) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$samount = $samount + 1;
if (($samount == "9") or ($samount < "9")) {
$file2 = explode(".", $file);
echo "<a href=\"javascript:smiles(' :".strtolower($file2[0]).": ')\"><img src='smilies/".$file."' border='0'></a>&nbsp;";
}
}
}
}
echo "<br><br><a href='javascript:awindow(\"comments.php?view=smilies\", \"\", \"width=200,height=200,scroll=yes\")'>View All</a>";
echo "</td></tr>";
} else {
echo "<td>&nbsp;</td>";
}
}
//CAPTCHA
if (($_COOKIE[$pre."username"] == "") && ($setting[captcha] == "Yes")) {
$ts = time();
?>
<script language="JavaScript"><!--
ts = <?= $ts ?>;
--></script>
<?php

echo "<tr><td><img id='captcha' src='includes/captcha.php?img=".$ts."'></td></tr><tr><td>* Displayed Code?</td><td><input type='text' name='captcha'><a href=\"no_matter\" onclick=\"document.getElementById('captcha').src = 'includes/captcha.php?img=' + ++ts; return false\">click for new code</a></td></tr>";
} else {
}
echo "<tr bgcolor='".$tempfetch[15]."'><td><input type='submit' name='submit' value='Submit Post'></td><td><input type='submit' name='preview' value='Preview'></td></tr></table></form>";
}
//To preview a post
if ($_POST['preview']) {
print($_POST["text1"]);
}
if ($_POST['submit']) {
//CAPTCHA Check
if (($_COOKIE[$pre."username"] == "") && ($captcha == "yes")) {
session_start();
$salted = $_POST['captcha'];
global $captcha_salt;
if (md5($captcha_salt.$salted) != $_SESSION['captcha']) {
eval (" ?>" . headera() . " <?php ");
echo "Wrong code entered, go back and try again";
echo $captcha_salt;
eval (" ?>" . footera() . " <?php ");
die;
}
} else {

if ($autobron == "yes") {
$autobr = preg_replace("/<br>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/<br \/>\n/","\n",addslashes($_POST["text1"]));
$autobr = preg_replace("/(\015\012)|(\015)|(\012)/","<br />\n",addslashes($_POST["text1"]));
} else {
$autobr = addslashes($_POST["text1"]);
}

$preq = mysql_fetch_row(mysql_query("SELECT prequire FROM ".$pre."forums WHERE id = '".$_POST['fid']."'"));
if ($useridn == "") {
$ptotal = "0";
} else {
$ptotal = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '".$useridn."'"));
$ptotal = $ptotal + 1;
}
if (($ptotal < $preq[0]) && ($preq[0])) {
echo "This forum of ".$sitename." requires ".$preq[0]." posts in order to make a post here and be a member. Sorry.";
} else {

if ($useridn) {
$tcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."elite WHERE type = 'topic' AND game = '".$_POST['tid']."' AND pid = '".$useridn."'"));
if ($tcount > "0") {
mysql_query("INSERT INTO ".$pre."pm VALUES ('null', '1', 'Tracked: New post in topic <b>".substr(addslashes($_POST["subject"]),0,30)."</b>', 'Hello,<br><br>There has been a new message posted in the topic <b>".substr(addslashes($_POST["subject"]),0,30)."</b>. You can view the topic below:<br><br><a href=\'".$f2part1.$_POST['tid'].$f2part2."\'>View topic <b>".substr(addslashes($_POST["subject"]),0,30)."</b></a><br><br>Thank you.', '', '".$_COOKIE[$pre."username"]."', '".time()."', 'tracked')");
}
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE uid = '".$useridn."' ORDER BY `date` DESC"));
} else {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE ip = '".$_SERVER['REMOTE_ADDR']."' ORDER BY `date` DESC"));
}

$date1 = time() - $pcheck[0];
$am = $setting[spam] - $date1;

if ($date1 < $setting[spam]) {
echo "Sorry but the spam feature is turned to <b>".$spam."</b> seconds and you have surpassed that. Go back and try again in another <b>".$am."</b> seconds.";
} else {

if ($_COOKIE[$pre."username"]) {
$rank = mysql_fetch_row(mysql_query("SELECT points FROM ".$pre."ranks WHERE name = '".$myrank."'"));
$postcount = mysql_num_rows(mysql_query("SELECT * FROM ".$pre."posts WHERE uid = '".$useridn."'"));

$ranks = mysql_query("SELECT * FROM ".$pre."ranks ORDER BY `points` ASC");
while($s = mysql_fetch_array($ranks)) {
if (($postcount > $s[points]) or ($postcount == $s[points])) {
if ($s[points] > $rank[0]) {
mysql_query("UPDATE ".$pre."users SET rank = '".$s[name]."' WHERE username = '".$_COOKIE[$pre."username"]."' AND password = '".$_COOKIE[$pre."password"]."'");
}
}
}
}
$post = mysql_query("INSERT INTO ".$pre."posts VALUES ('null', '".substr(addslashes($_POST["subject"]),0,30)."', '".$autobr."', '".$useridn."', '".time()."', '".$_POST["fid"]."', '".$_POST["tid"]."', '0', 'post', 'no', '".$_SERVER['REMOTE_ADDR']."', '".time()."')") or die(mysql_error());

mysql_query("UPDATE ".$pre."posts SET lpostdate = '".time()."' WHERE id = '".$_POST['tid']."'");
					
$queryp = mysql_fetch_row(mysql_query("SELECT id FROM ".$pre."posts WHERE date = '".time()."' AND type = 'post' AND message = '".$autobr."'"));
$postid = $queryp[0];

if ($post == TRUE) {
echo re_direct("2500", $f2part1.$_GET['tid'].$f2part2."#".$postid);
echo "<center>Post has been created.</center><br><center>Click <a href='".$f1part1.$_GET['fid'].$f1part2."'><b>here</b></a> to return to the forum<br>Click <a href='".$f2part1.$_GET['tid'].$f2part2."#".$postid."'><b>here</b></a> to view your post</center>";
}
}
}
}
}
}
//}
}
}

}

if ((!$_GET['f']) && (!is_numeric($_GET['t']))) {
echo "<br>";
}

if (($_GET['f'] == "") && ($_GET['t'] == "")) {
$bgc = $tempfetch[15];
}

if (($_GET['f'] == "") && ($_GET['t'])) {
$bgc = $tempfetch[16];
}

if (($_GET['f']) && ($_GET['t'] == "")) {
$bgc = $tempfetch[16];
}

$time_amount = time() - $_COOKIE[$pre."login_date"];

if ($time_amount < "3600") {
if ($time_amount > "120") {
$time_type = "minutes";
} else {
$time_type = "minute";
}
$time_amount = $time_amount / 60;
$time_amount = substr($time_amount,0,2);
$time_amount = str_replace(".", "", $time_amount);
}

if (($time_amount < "86400") or ($time_amount == "3600")) {
if ($time_amount > "7199") {
$time_type = "hours";
} else {
$time_type = "hour";
}
$time_amount = $time_amount / 3600;
$time_amount = substr($time_amount,0,2);
$time_amount = str_replace(".", "", $time_amount);
}

if (($time_amount > "86400") or ($time_amount == "86400")) {
if ($time_amount > "172800") {
$time_type = "days";
} else {
$time_type = "day";
}
$time_amount = $time_amount / 86400;
$time_amount = substr($time_amount,0,2);
$time_amount = str_replace(".", "", $time_amount);
}

if (($_COOKIE[$pre."username"]) && ($_COOKIE[$pre."password"])) {
$ldate = date($fdformat3, $_COOKIE[$pre."login_date"]);
$ldate2 = $time_amount." ".$time_type;
}

if ($useridn) {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE uid = '".$useridn."' ORDER BY `date` DESC"));
} else {
$pcheck = mysql_fetch_row(mysql_query("SELECT date FROM ".$pre."posts WHERE ip = '".$_SERVER['REMOTE_ADDR']."' ORDER BY `date` DESC"));
}

$date1 = time() - $pcheck[0];
$am = $setting[spam] - $date1;

$forumj .= "<select name='fieldname' size='1' onChange='openDir(this.form)'>";

$sql = mysql_query("SELECT * FROM ".$pre."forums ORDER BY `name` ASC");
while($r = mysql_fetch_array($sql)) {
if ($r[type] == "cat") {
} else {
if ($r[type] == "sub") {
$ex = explode("||", $r[name]);
$forumj .= "<option value='".$f1part1.$r[id].$f1part2."'>&nbsp;&nbsp;&nbsp;&nbsp;".$ex[0]."</option>";
} else {
$forumj .= "<option value='".$f1part1.$r[id].$f1part2."'>".$r[name]."</option>";
}
}
}
$forumj .= "</select>";

$tdata[] = "{bordercolor}";
$tdata[] = "{bgcolor1}";
$tdata[] = "{bgcolor2}";
$tdata[] = "{bgcolor3}";
$tdata[] = "{forumurl}";
$tdata[] = "{chooseskin}";
$tdata[] = "{bgcolor}";
$tdata[] = "{logindate}";
$tdata[] = "{loggedin}";
$tdata[] = "{forumjump}";
$tdata[] = "{post}";

$odata[] = $tempfetch[14];
$odata[] = $tempfetch[15];
$odata[] = $tempfetch[16];
$odata[] = $tempfetch[17];
$odata[] = $forumsurl;
$odata[] = fskin();
$odata[] = $bgc;
$odata[] = $ldate;
$odata[] = $ldate2;
$odata[] = $forumj;
if ($am > "0") {
$odata[] = "<small>".$am." seconds until you can post again</small>";
} else {
$odata[] = "";
}
eval (" ?>" . str_replace($tdata, $odata, stripslashes($tempfetch3)) . " <?php ");


	$skin1[] = "/{version}/";
	$skin1[] = "/{sitename}/";
	$skin1[] = "/{users}/"; // amount of users online
	$skin1[] = "/{online}/"; // the users that are online
	$skin1[] = "/{pms}/"; // amount of private messages
	$skin1[] = "/{new}/"; // amount of new private messages
	$skin1[] = "/{pm}/"; // display new private messages
	$skin1[] = "/{welcome}/"; // Displays "Welcome username" if person is logged in, other wise "Welcome Guest" and a link to login
	$skin1[] = "/{chooseskin}/";
	$skin1[] = "/{skinname}/"; // the name of the current skin being used
	$skin2[] = $version;
	$skin2[] = $setting[sitename];
	$skin2[] = online();
	$skin2[] = usersonline();
	$skin2[] = totalpms();
	$skin2[] = newpms();
	$skin2[] = pms();
	$skin2[] = welcome();
	$skin2[] = fskin();
	$skin2[] = skinname();
eval (" ?>" . str_replace($skin1, $skin2, stripslashes($tempfetch1)) . " <?php ");
?>