Topic: pun spam bot

I installed pun spam bot it worked upon user's registration BUT when submitting post, it ask a question which was entere correctly, rather than allowing the post to proceed, it keeps asking again and again. 
My version is .3.3 on punbb1.4.1

If there is any update to it, or to get ride off the sent posting question is highly advisable



Re: pun spam bot

This is a flaw of the extension

You need to manually delete the code in manifest.xml that is releated to posting (i.e. hook  ".... post ")

        <hook id="po_form_submitted"><![CDATA[

Everything in the hook mentioned above...

Then reinstall....

Re: pun spam bot

To be sure, other problem does not arise, could u pls copy past what I need to remove? am sure other people will learn from this as well.
When you say reinstall, u mean from the Admin or via ftp?


Re: pun spam bot


1. Uninstall via admin panel (your questions will be lost)
2. Open manifest.xml
3. Delete  (from line 173)

        <hook id="po_form_submitted"><![CDATA[
            if (!$forum_page['is_admmod'] && !isset($_POST['preview']))
                include $ext_info['path'].'/functions.php';
                if (file_exists(FORUM_CACHE_DIR.'cache_pun_stop_bots.php'))
                    include FORUM_CACHE_DIR.'cache_pun_stop_bots.php';
                if (!defined('PUN_STOP_BOTS_CACHE_LOADED') || $pun_stop_bots_questions['cached'] < (time() - 43200))
                    require FORUM_CACHE_DIR.'cache_pun_stop_bots.php';
                if (file_exists($ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php'))
                    include $ext_info['path'].'/lang/'.$forum_user['language'].'/'.$ext_info['id'].'.php';
                    include $ext_info['path'].'/lang/English/'.$ext_info['id'].'.php';

                $pun_stop_bots_true_answer = FALSE;

                //Check up the cookie.
                if (isset($_COOKIE[PUN_STOP_BOTS_COOKIE_NAME]))
                    $pun_stop_bots_true_answer = pun_stop_bots_check_cookie();
                //Check up the entered question.
                else if (isset($_POST['pun_stop_bots_submit']))
                    $query = array(
                        'SELECT'    => 'pun_stop_bots_question_id',
                        'FROM'        => $forum_user['is_guest'] ? 'online' : 'users',
                        'WHERE'        => $forum_user['is_guest'] ? 'ident = \''.$forum_user['ident'].'\'' : 'id = '.$forum_user['id']
                    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
                    $row = $forum_db->fetch_assoc($result);

                    if ($row)
                        $question_id = $row['pun_stop_bots_question_id'];
                        message($lang_common['Bad request']);

                    $answer = isset($_POST['pun_stop_bots_answer']) ? forum_trim(strtolower($_POST['pun_stop_bots_answer'])) : null;
                    if (!empty($answer))
                        $pun_stop_bots_true_answer = pun_stop_bots_compare_answers($answer, $question_id);
                        $pun_stop_bots_true_answer = FALSE;
                    //Generate new question in case of incorrect answer.
                    if (!$pun_stop_bots_true_answer)
                        $new_question_id = $forum_user['is_guest'] ? pun_stop_bots_generate_guest_question_id() : pun_stop_bots_generate_user_question_id();

                // If it is a user and answer is correct set new cookie.
                if (!$forum_user['is_guest'] && !isset($_COOKIE[PUN_STOP_BOTS_COOKIE_NAME]) && $pun_stop_bots_true_answer)
                    $new_question_id = $forum_user['is_guest'] ? pun_stop_bots_generate_guest_question_id() : pun_stop_bots_generate_user_question_id();
                else if ($forum_user['is_guest'] && $pun_stop_bots_true_answer)
                    $query = array(
                        'UPDATE'    =>    'online',
                        'SET'        =>    'pun_stop_bots_question_id = NULL',
                        'WHERE'        =>    'ident = \''.$forum_user['ident'].'\''
                    $forum_db->query_build($query) or error(__FILE__, __LINE__);
                else if (!$pun_stop_bots_true_answer)
                    //If it is first request of the page, we need to generate new question.
                    if (!isset($new_question_id))
                        $new_question_id =  $forum_user['is_guest'] ? pun_stop_bots_generate_guest_question_id() : pun_stop_bots_generate_user_question_id();

                    $forum_page['crumbs'] = array(
                        array($forum_config['o_board_title'], forum_link($forum_url['index'])),
                        $lang_pun_stop_bots['Stop bots question legend']

                    $forum_page['form_handler'] = $_SERVER['REQUEST_URI'];
                    $forum_page['question'] = $pun_stop_bots_questions['questions'][$new_question_id]['question'];
                    $forum_page['hidden_fields'] = $_POST;

                    define('FORUM_PAGE', 'pun_stop_bots_page');
                    require FORUM_ROOT.'header.php';

                    // START SUBST - <!-- forum_main -->

                    include $ext_info['path'].'/views/question_page.php';

                    $tpl_temp = forum_trim(ob_get_contents());
                    $tpl_main = str_replace('<!-- forum_main -->', $tpl_temp, $tpl_main);
                    // END SUBST - <!-- forum_main -->

                    require FORUM_ROOT.'footer.php';

4. Save
5. Upload
6. Reinstall
7. Add your questions

(That's how I did it on a forum...)

Best would be if authors change extension to make it optional for posts to be questioned and release a new version of course.
But the quick fix is the one above, imho.

Re: pun spam bot

3. Delete  (from line 173)

Delete from where until where is not clear to me

I opened using a notepad, and could nt find  line 173
Please copy on the lines that need to be saved here and leave the rest out

Help again

Re: pun spam bot

voiceone wrote:

could u pls copy past what I need to remove?

see above.


Re: pun spam bot

Thanks it worked!
But i couldnt enter questions from the Admin
Had to do it on the manifext.xml and upload the questions as well cos when i clicked from Admin to change or add questions it does not open and i can see URL:
And the page was black

Re: pun spam bot

You probably deleted further hooks below the one I copy pasted above. Sounds like code related to hook below is missing:

<hook id="aop_new_section"><![CDATA[

Instead of using notepad I would recommend you download the free programme PSPad and use that (if you're on windows). It shows the row numbers and has syntax highlighter.

Re: pun spam bot

I have the same problem.

Will try to use the solution given above.