query("DELETE FROM " . TABLE_PREFIX . "session WHERE sessionhash = '" . addslashes($session['dbsessionhash']) . "'");
$session['sessionhash'] = fetch_sessionhash();
$session['dbsessionhash'] = $session['sessionhash'];
$DB_site->query("
INSERT INTO " . TABLE_PREFIX . "session
(sessionhash, userid, host, idhash, lastactivity, styleid, loggedin, bypass, useragent)
VALUES
('" . addslashes($session['sessionhash']) . "', " . intval($bbuserinfo['userid']) . ", '" . addslashes(SESSION_HOST) . "', '" . addslashes(SESSION_IDHASH) . "', " . TIMENOW . ", $session[styleid], 1, " . iif ($logintype === 'cplogin', 1, 0) . ", '" . addslashes(USER_AGENT) . "')
");
vbsetcookie('sessionhash', $session['sessionhash'], 0);
exec_header_redirect($querystring);
}
else
{ // wrong username / password
exec_strike_user($bbuserinfo['username']);
eval('$error_message = "' . fetch_phrase('error_badlogin', PHRASETYPEID_ERROR, 'error_') . '";');
$do = 'error';
}
}
}
if ($do == 'error')
{
}
else if ($t)
{
$do = 'thread';
$threadinfo = fetch_threadinfo($t);
$foruminfo = fetch_foruminfo($threadinfo['forumid']);
$forumperms = $bbuserinfo['forumpermissions'][$foruminfo['forumid']];
if (!($forumperms & CANVIEW) OR !($forumperms & CANVIEWOTHERS) OR in_coventry($threadinfo['postuserid']) OR $threadinfo['isdeleted'] OR !$threadinfo['visible'])
{
exit;
}
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
if (trim($foruminfo['link'] != ''))
{
exec_header_redirect($foruminfo['link']);
}
$title .= ' - ' . $threadinfo['title'];
}
else if ($f)
{
$do = 'forum';
$forumperms = $bbuserinfo['forumpermissions'][$f];
if (!($forumperms & CANVIEW) OR !($forumperms & CANVIEWOTHERS))
{
exit;
}
$foruminfo = fetch_foruminfo($f, false);
verify_forum_password($foruminfo['forumid'], $foruminfo['password']);
if (trim($foruminfo['link'] != ''))
{
exec_header_redirect($foruminfo['link']);
}
$title .= ' - ' . $foruminfo['title'];
}
else
{
$do = 'index';
}
if ($pda AND $bbuserinfo['userid'] == 0 AND $_GET['login'] AND $do != 'error')
{
$do = 'login';
}
if ($pda AND $bbuserinfo['userid'] > 0 AND $_GET['message'] AND false)
{
$do = 'message';
}
?>
$vbphrase[view_full_version]:
$vboptions[bbtitle]\n";
echo "
\n";
print_archive_forum_list();
echo "
\n";
}
if ($Coventry = fetch_coventry('string'))
{
$globalignore = "AND " . iif($do == 'forum', 'thread.post', 'post.') . "userid NOT IN ($Coventry) ";
}
else
{
$globalignore = '';
}
// ********************************************************************************************
// display forum
if ($do == 'forum')
{
// list threads
echo print_archive_navigation($foruminfo);
echo "
$vbphrase[view_full_version] : $foruminfo[title]
\n
\n";
if ($foruminfo['cancontainthreads'])
{
if (!$p)
{
$p = 1;
}
print_archive_page_navigation($foruminfo['threadcount'], $vboptions['archive_threadsperpage'], "f-$foruminfo[forumid]-p-");
$threads = $DB_site->query("
SELECT threadid , title, lastpost, replycount
FROM " . TABLE_PREFIX . "thread AS thread
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (deletionlog.primaryid = thread.threadid AND deletionlog.type = 'thread')
WHERE forumid = $foruminfo[forumid]
AND visible = 1
AND open <> 10
AND deletionlog.primaryid IS NULL
$globalignore
ORDER BY dateline " . iif($pda, 'DESC', 'ASC') . "
LIMIT " . ($p - 1) * $vboptions['archive_threadsperpage'] . ',' . $vboptions['archive_threadsperpage']
);
$start = ($p - 1) * $vboptions['archive_threadsperpage'] + 1;
if ($pda AND false)
{
echo "
New Thread";
}
echo "
\n
\n";
while ($thread = $DB_site->fetch_array($threads))
{
echo "\t- $thread[title]" . iif($pda, " (" . construct_phrase($vbphrase['x_replies'], $thread['replycount']) . ")") . "
\n";
}
echo "
\n
\n";
}
else
{
echo "
\n";
print_archive_forum_list($f);
echo "
\n";
}
}
// ********************************************************************************************
// display thread
if ($do == 'thread')
{
echo print_archive_navigation($foruminfo, $threadinfo);
echo "
$vbphrase[view_full_version] : $threadinfo[title]
\n
\n";
if ($p == 0)
{
$p = 1;
}
print_archive_page_navigation($threadinfo['replycount']+1, $vboptions['archive_postsperpage'], "t-$threadinfo[threadid]-p-");
$posts = $DB_site->query("
SELECT post.postid, post.pagetext, IFNULL( user.username , post.username ) AS username, dateline
FROM " . TABLE_PREFIX . "post AS post
LEFT JOIN " . TABLE_PREFIX . "user AS user ON (user.userid = post.userid)
LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (deletionlog.primaryid = post.postid AND deletionlog.type = 'post')
WHERE threadid = $threadinfo[threadid]
AND visible = 1
AND deletionlog.primaryid IS NULL
$globalignore
ORDER BY dateline ASC
LIMIT " . (($p - 1) * $vboptions['archive_postsperpage']) . ", $vboptions[archive_postsperpage]
");
if ($pda AND false)
{
echo "
New Reply";
}
$i = 0;
while ($post = $DB_site->fetch_array($posts))
{
$i++;
$post['pagetext'] = strip_bbcode($post['pagetext']);
$post['postdate'] = vbdate($vboptions['dateformat'], $post['dateline']);
$post['posttime'] = vbdate($vboptions['timeformat'], $post['dateline']);
echo "\n
$post[username]
$post[postdate], $post[posttime]
";
echo "
" . nl2br(htmlspecialchars_uni($post['pagetext'])) . "
\n\n";
}
}
// ********************************************************************************************
// display login
if ($do == 'login')
{
echo print_archive_navigation(array());
echo "
$vbphrase[view_full_version]: $vboptions[bbtitle]
\n";
if (SLASH_METHOD)
{
$loginlink = "index.php/$querystring?login=1";
}
else
{
$loginlink = "index.php?login=1" . (!empty($querystring) ? "&$querystring" : '');
}
echo "
\n";
echo "$vbphrase[log_in]\n";
echo "\n";
echo "
\n";
}
// ********************************************************************************************
// display error
if ($do == 'error')
{
echo print_archive_navigation(array());
echo "
$vbphrase[view_full_version]: $vboptions[bbtitle]
\n";
echo "
\n";
echo $error_message;
echo "
\n";
}
echo "
$vbphrase[vbulletin_copyright]
\n";
/*======================================================================*\
|| ####################################################################
|| # Downloaded: 12:31, Wed Jun 22nd 2005
|| # CVS: $RCSfile: index.php,v $ - $Revision: 1.58.2.4 $
|| ####################################################################
\*======================================================================*/
?>