';
if(isset($_COOKIE['rpgtoplist']))
{
$active = $info['active'];
}
else
{
if(isset($_COOKIE['active']))
{
$active = clean($_COOKIE['active']);
}
elseif(isset($_SESSION['active']))
{
$active = clean($_SESSION['active']);
}
else
{
$active = $time;
}
}
if(isset($_COOKIE['rpgtoplist']))
{
@mysql_query("UPDATE `accounts` SET `active` = '$time' WHERE `email` = '$_GET[email]' AND `passcheck` = '$pass'")or die (mysql_error());
}
elseif(isset($_COOKIE['active']))
{
$_COOKIE['active'] = $time;
}
elseif(!isset($_COOKIE['active']))
{
setcookie('active', $time, '0', '/', '', '0');
if(!isset($_COOKIE['active']))
{
$_SESSION['active'] = $time;
}
}
if($_GET['step'])
{
$step = clean($_GET['step']);
}
else
{
$step = clean($_POST['step']);
}
switch($step)
{
case 'view':
switch($_GET['view'])
{
case 'post':
if($_GET['post'])
{
$postid = clean($_GET['post']);
}
else
{
$postid = clean($_POST['post']);
}
if(!$postid)
{
header('location: http://www.rpgtoplist.com');
}
else
{
$posts = @mysql_query("SELECT * FROM `posts` WHERE `id` = '$postid'") or die(mysql_error());
$post = @mysql_fetch_array($posts);
$fora = @mysql_query("SELECT * FROM `fora` WHERE `id` = '$post[forum]'") or die(mysql_error());
$forum = @mysql_fetch_array($fora);
$posters = @mysql_query("SELECT * FROM `accounts` WHERE `id` = '$post[poster]'") or die(mysql_error());
$poster = @mysql_fetch_array($posters);
$replies = @mysql_query("SELECT * FROM `posts` WHERE `parent` = '$post[id]' ORDER BY `posted` DESC") or die(mysql_error());
$main = $main . '| Main => ' . $forum['name'] . ' => ' . $post['subject'] . ' |
' . $post['body'] . ' by ' . ucfirst($poster['type']) . ' ' . $poster['user'] . ' |
| Replies: |
| Subject | Poster | Replies | ';
while($reply = @mysql_fetch_array($replies))
{
$repposters = @mysql_query("SELECT * FROM `accounts` WHERE `id` = '$reply[poster]'") or die(mysql_error());
$repposter = @mysql_fetch_array($repposters);
$reps = mysql_num_rows(mysql_query("SELECT * FROM `posts` WHERE `parent` = '{$reply['id']}'"));
$main = $main . '| ' . $reply['subject'] . ' | by ' . ucfirst($repposter['type']) . ' ' . $repposter['user'] . ' | ' . $reps . ' | ';
}
$main = $main . ' | ';
}
break;
case 'forum':
if(!$_GET['forum'])
{
header('location: http://www.rpgtoplist.com');
}
else
{
$for = clean($_GET['forum']);
$fora = @mysql_query("SELECT `id`, `name`,`description` FROM `fora` WHERE `id` = '$for'");
$forum = @mysql_fetch_array($fora);
$posts = @mysql_query("SELECT * FROM `posts` WHERE `forum` = '$for' AND `parent` = 0 ORDER BY `posted` DESC");
$main = $main . '| Main => ' . $forum['name'] . ' |
| ' . $forum['description'] . ' |
| Topic | Poster | Replies | New Replies | ';
while($post = @mysql_fetch_array($posts))
{
$posters = @mysql_query("SELECT * FROM `accounts` WHERE `id` = '{$post['poster']}'");
$poster = @mysql_fetch_array($posters);
$newposts = @mysql_num_rows(mysql_query("SELECT * FROM `posts` WHERE `posted` > '$active' AND `parent` = '$post[id]'"));
$numposts = @mysql_num_rows(mysql_query("SELECT * FROM `posts` WHERE `parent` = '$post[id]'"));
if($newposts > 0)
{
$subject = '' . $post['subject'] . '';
}
else
{
$subject = $post['subject'];
}
if($poster['user'])
{
$posters = '' . $poster['user'] . '';
}
else
{
$posters = 'guest';
}
$main = $main . '| ' . $subject . ' | by ' . ucfirst($poster['type']) . ' ' . $posters . ' | ' . $numposts . ' | ' . $newposts . ' | ';
}
$main = $main . ' | ';
}
$main = $main . ' ';
break;
default:
header('location: http://www.rpgtoplist.com');
break;
}
break;
case 'post':
if($_POST['action'] == 'submit')
{
if(($_POST['subject']) && ($_POST['subject'] != 'subject'))
{
if(!$info['id']){$info['id'] = 0;}
$subject = clean($_POST['subject']);
$body = clean($_POST['body']);
$parent = clean($_POST['parent']);
$forum = clean($_POST['forum']);
@mysql_query("INSERT INTO `posts` (`poster`, `subject`, `body`, `posted`, `parent`, `forum`) VALUES ('$info[id]', '$subject', '$body', '$time', '$parent', '$forum') ") or die('System Failure');
if($_POST['parent'])
{
$url = $_SERVER['PHP_SELF'] . '?step=view&view=post&post=' . $_POST['parent'] . '&email=' . $email;
}
else
{
$url = $_SERVER['PHP_SELF'] . '?step=view&view=forum&forum=' . $_POST['forum'] . '&email=' . $email;
}
$main = $main . '| Your post has been submitted. Click here to go back. | ';
}
else
{
$main = $main . ' |