diff options
author | David M <davidmj@users.sourceforge.net> | 2006-10-06 21:37:17 +0000 |
---|---|---|
committer | David M <davidmj@users.sourceforge.net> | 2006-10-06 21:37:17 +0000 |
commit | 7777bd5f502241e6e15e1732d3dacb3ad1e2026d (patch) | |
tree | 80daceca69b2268d8e90cbd0ca361d2393361243 /phpBB/posting.php | |
parent | 0f0d160ded7fd129d40a4ec0372cab11d7ce7a88 (diff) | |
download | forums-7777bd5f502241e6e15e1732d3dacb3ad1e2026d.tar forums-7777bd5f502241e6e15e1732d3dacb3ad1e2026d.tar.gz forums-7777bd5f502241e6e15e1732d3dacb3ad1e2026d.tar.bz2 forums-7777bd5f502241e6e15e1732d3dacb3ad1e2026d.tar.xz forums-7777bd5f502241e6e15e1732d3dacb3ad1e2026d.zip |
#3794
git-svn-id: file:///svn/phpbb/trunk@6448 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/posting.php')
-rw-r--r-- | phpBB/posting.php | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/phpBB/posting.php b/phpBB/posting.php index bcd6f0f7bb..a1c8f4088d 100644 --- a/phpBB/posting.php +++ b/phpBB/posting.php @@ -523,6 +523,8 @@ if ($load && $post_data['drafts']) load_drafts($topic_id, $forum_id); } +$solved_captcha = false; + if ($submit || $preview || $refresh) { $post_data['topic_cur_post_id'] = request_var('topic_cur_post_id', 0); @@ -718,6 +720,10 @@ if ($submit || $preview || $refresh) { $error[] = $user->lang['CONFIRM_CODE_WRONG']; } + else + { + $solved_captcha = true; + } } // Parse subject @@ -1125,23 +1131,26 @@ if ($config['enable_post_confirm'] && !$user->data['is_registered'] && ($mode == $db->sql_query($sql); // Generate code - $code = gen_rand_string(mt_rand(5, 8)); - $confirm_id = md5(unique_id($user->ip)); - - $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( - 'confirm_id' => (string) $confirm_id, - 'session_id' => (string) $user->session_id, - 'confirm_type' => (int) CONFIRM_POST, - 'code' => (string) $code) - ); - $db->sql_query($sql); + if ($solved_captcha === false) + { + $code = gen_rand_string(mt_rand(5, 8)); + $confirm_id = md5(unique_id($user->ip)); + + $sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array( + 'confirm_id' => (string) $confirm_id, + 'session_id' => (string) $user->session_id, + 'confirm_type' => (int) CONFIRM_POST, + 'code' => (string) $code) + ); + $db->sql_query($sql); - $template->assign_vars(array( - 'S_CONFIRM_CODE' => true, - 'CONFIRM_ID' => $confirm_id, - 'CONFIRM_IMAGE' => '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_POST) . '" alt="" title="" />', - 'L_POST_CONFIRM_EXPLAIN' => sprintf($user->lang['POST_CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlentities($config['board_contact']) . '">', '</a>'), - )); + $template->assign_vars(array( + 'S_CONFIRM_CODE' => true, + 'CONFIRM_ID' => $confirm_id, + 'CONFIRM_IMAGE' => '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_POST) . '" alt="" title="" />', + 'L_POST_CONFIRM_EXPLAIN' => sprintf($user->lang['POST_CONFIRM_EXPLAIN'], '<a href="mailto:' . htmlentities($config['board_contact']) . '">', '</a>'), + )); + } } $s_hidden_fields = ($mode == 'reply' || $mode == 'quote') ? '<input type="hidden" name="topic_cur_post_id" value="' . $post_data['topic_last_post_id'] . '" />' : ''; |