[size=0]<?php
/***************************************************************************
* dice.php
* -------------------
* copyright : (C) 2003 Saerdnaer
* email :
saernaer@web.de
*
***************************************************************************/
// BEGIN Configuration
$self = ''; // Name of these file
$subject = '';
$message = '';
$html_on = 0;
$bbcode_on = 1;
$smilies_on = 1;
// END Configuration
define('IN_PHPBB', true);
$phpbb_root_path = './';
$self = ''; // Name of these file
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
if ( !empty($HTTP_POST_VARS[POST_TOPIC_URL]) || !empty($HTTP_GET_VARS[POST_TOPIC_URL]) )
{
$topic_id = ( !empty($HTTP_POST_VARS[POST_TOPIC_URL]) ) ? intval($HTTP_POST_VARS[POST_TOPIC_URL]) : intval($HTTP_GET_VARS[POST_TOPIC_URL]);
}
else
{
message_die(GENERAL_ERROR, $lang['No_topic_id']);
}
$max = intval( empty($HTTP_POST_VARS['max']) ? $HTTP_GET_VARS['max'] : $HTTP_POST_VARS['max'] ) == 20 ? 20 : 6;
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_POSTING);
init_userprefs($userdata);
//
// End session management
//
$is_auth = array();
'auth_reply'
//
// Here we do various lookups to find topic_id, forum_id, post_id etc.
// Doing it here prevents spoofing (eg. faking forum_id, topic_id or post_id
//
$error_msg = '';
$post_data = array();
$sql = "SELECT f.*, t.topic_status
FROM " . FORUMS_TABLE . " f, " . TOPICS_TABLE . " t
WHERE t.topic_id = $topic_id
AND f.forum_id = t.forum_id";
if ( $result = $db->sql_query($sql) )
{
$post_info = $db->sql_fetchrow($result);
$forum_id = $post_info['forum_id'];
$forum_name = $post_info['forum_name'];
$is_auth = auth(AUTH_ALL, $forum_id, $userdata, $post_info);
if ( $post_info['forum_status'] == FORUM_LOCKED && !$is_auth['auth_mod'])
{
message_die(GENERAL_MESSAGE, $lang['Forum_locked']);
}
else if ( $post_info['topic_status'] == TOPIC_LOCKED && !$is_auth['auth_mod'])
{
message_die(GENERAL_MESSAGE, $lang['Topic_locked']);
}
}
else
{
message_die(GENERAL_MESSAGE, $lang['No_such_post']);
}
//
// The user is not authed, if they're not logged in then redirect
// them, else show them an error message
//
if ( !$is_auth['auth_reply'] )
{
if ( $userdata['session_logged_in'] )
{
message_die(GENERAL_MESSAGE, sprintf($lang['Sorry_auth_reply'], $is_auth['auth_reply_type']));
}
/* // For phpBB Version <= 2.0.3
$header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: ';
header($header_location . append_sid("login.$phpEx?redirect=$self.$phpEx&mode=$mode&" . POST_TOPIC_URL . "=" . $topic_id, true));
exit;
*/
// For phpBB Version >= 2.0.4
redirect(append_sid("login.$phpEx?redirect=$self.$phpEx&mode=$mode&" . POST_TOPIC_URL . "=" . $topic_id, true));
}
mt_srand( (double) microtime() * 1000000 );
$random_result = mt_rand(1, $max);
str_replace('{MAX}', $max, $message);
str_replace('{RESULT}', $random_result, $message);
str_replace('{USERNAME}', $userdata['username'], $message);
$mode = 'reply';
$attach_sig = 0;
$post_data['first_post'] = 0;
$post_data['last_post'] = false;
$post_data['has_poll'] = false;
$post_data['edit_poll'] = false;
$return_message = '';
$return_meta = '';
$username = '';
$poll_title = '';
$poll_options = '';
$poll_length = '';
$bbcode_uid = '';
$topic_type = POST_NORMAL;
prepare_post($mode, $post_data, $bbcode_on, $html_on, $smilies_on, $error_msg, $username, $bbcode_uid, $subject, $message, $poll_title, $poll_options, $poll_length);
if ( $error_msg != '' )
{
message_die(GENERAL_MESSAGE, $error_msg);;
}
submit_post($mode, $post_data, $return_message, $return_meta, $forum_id, $topic_id, $post_id, $poll_id, $topic_type, $bbcode_on, $html_on, $smilies_on, $attach_sig, $bbcode_uid, str_replace("\'", "''", $username), str_replace("\'", "''", $subject), str_replace("\'", "''", $message), str_replace("\'", "''", $poll_title), $poll_options, $poll_length);
if ( $error_msg != '' )
{
message_die(GENERAL_MESSAGE, $error_msg);;
}
update_post_stats($mode, $post_data, $forum_id, $topic_id, $post_id, $userdata['user_id']);
$template->assign_vars( array(
'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">')
);
message_die(GENERAL_MESSAGE, $lang[''] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');
?>[/size]