Image Verification on Guest Posts? [solved]

Support for the IM Portal Project

Moderator: Integra Moderator

Image Verification on Guest Posts? [solved]

PostAuthor: jwernerny » Thu May 18, 2006 4:16 am

Hello,

[I posted this on the old IM site, just about the time of the great divide, so I think it may have fallen through the cracks.]

My IM 1.4.0 site has a couple of open forums where guests can post. Currently, it seems to have become a target of robot "spam" posts. Before I switched form phpBB to IM, I had put a mod in that required image verification (letters in an image that had to be entered) on all guest posts.

Has anyone done this with IM?

Thanks,
- John
Last edited by jwernerny on Mon Jun 12, 2006 4:24 pm, edited 1 time in total.
User avatar
jwernerny
Members
Members
 
Posts: 87
Likes: 0 post
Liked in: 0 post
Joined: Wed Apr 12, 2006 3:58 am
Cash on hand: 0.00
Location: Fairport, NY

PostAuthor: Michaelo » Thu May 18, 2006 5:51 am

No do you have some details of the code?
Last edited by Michaelo on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
Kiss Portal Engine phpbbireland (status: Released)
User avatar
Michaelo
Administrator
Administrator
 
Posts: 1646
Likes: 0 post
Liked in: 0 post
Joined: Sat Mar 11, 2006 5:14 pm
Cash on hand: 0.00
Location: Dublin, Ireland

Re: Image Verification on Guest Posts?

PostAuthor: jwernerny » Thu May 18, 2006 2:33 pm

Okay, I think I found the old code...

I was using a mod call image_verification (img_verify.php). I modified both the posting template file and posting.php. In Posting PHP, I inserted the following block
Code: Select all
else {       // Image verification mod (http]) && isset($_POST['username'])) {         if(empty($_POST['image_verify']) || $_POST['image_verify'] != $verify_string) {             message_die(GENERAL_MESSAGE, "Invalid verification code!");         } else {             unset($_SESSION['phpbb2_img_verify']);         }     }}


right before

Code: Select all
 //// Set toggles for various options//if ( !$board_config['allow_html'] ){     $html_on = 0;}else


The inserted block is an else condition for "if ( !$is_auth[$is_auth_type] )", thus if the user is not known, it should process the code.

Additionally, I added the second line in the {..} below.

Code: Select all
if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) ){     $template->assign_block_vars('switch_username_select', array());     $template->assign_block_vars('switch_image_verification', "");}



What I really want to do is something very similar, but this time using the image verification built into the user registration in IM.

- John
Last edited by jwernerny on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
User avatar
jwernerny
Members
Members
 
Posts: 87
Likes: 0 post
Liked in: 0 post
Joined: Wed Apr 12, 2006 3:58 am
Cash on hand: 0.00
Location: Fairport, NY

Re: Image Verification on Guest Posts?

PostAuthor: jwernerny » Mon Jun 12, 2006 1:18 pm

Okay, I've had it. My forum is a very slow forum in the summer (what do you expect from a site about snowtires?), and I am getting tired of having more posts advertising sex sites then real posts!

Hopefully, in the next couple of hours I will have something hacked together to add this feature.
Last edited by jwernerny on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
User avatar
jwernerny
Members
Members
 
Posts: 87
Likes: 0 post
Liked in: 0 post
Joined: Wed Apr 12, 2006 3:58 am
Cash on hand: 0.00
Location: Fairport, NY

Re: Image Verification on Guest Posts? [SOLVED]

PostAuthor: jwernerny » Mon Jun 12, 2006 4:24 pm

[This should probably move to the Mods forum.]

It's done. Posts from Guests no require the correct entering of the text in a control picture (or image verification). There were a couple of ways I could have implemented this. The first was using the existent code in the user control panel. That was a bit too hard for me. It is not a simple pull out. Instead, I decided to integrate in "Image verification mod." It did require a couple of fixes to make it work.

Please feel free to try it out at http://www.snowtire.info/forum

Here is the info on the original mod (which I had originally taken from phpbb-hacks.com)

Code: Select all
   ===========================     Image verification mod for phpBB   Released ]http://boastology.com[/url]     Developed by Kailash Nadh   Email   : [url=http://kailashnadh.name]http://kailashnadh.name[/url], [url=http://bnsoft.net]http://bnsoft.net[/url]   Blog    : [url=http://boastology.com/blog]http://boastology.com/blog[/url]     ===========================  


Here are the changes I made to the files. These changes are in lue of the changes in the Read Me file that came with the mod. I started with IM 1.4.0 with security 1.03 and phpBB 2.0.20 updates.

1. Add "img_verify.php" to root directory

2. In "img_verify.php" change every occurance of "$_SESSION[" to "$HTTP_SESSION_VARS["

3. In .../templates/fisubice/ find

Code: Select all
</tr>{ATTACHBOX}{POLLBOX}{DELAYEDPOST}  


After it add

Code: Select all
    <BEGIN>     <tr>         <td>Image verification</td>         <td><img><br>         <input></td>     </tr>     <END>


4. In "posting.php" find
Code: Select all
//// Set toggles for various options//if ( !$board_config['allow_html'] )


After it add (NOTE]else {      // Image verification mod (http://kailashnadh.name)    $get_code=true;    include "img_verify.php";      if(isset($HTTP_POST_VARS['mode']) && isset($HTTP_POST_VARS['username'])) {       if(empty($HTTP_POST_VARS['image_verify']) || $HTTP_POST_VARS['image_verify'] != $verify_string) {           message_die(GENERAL_MESSAGE, "Invalid verification code!");       } else {          unset($HTTP_SESSION_VARS['phpbb2_img_verify']);       }    }}[/code]

5. still in "posting.php" find
Code: Select all
if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) ){     $template->assign_block_vars('switch_username_select', array());}


change it to
Code: Select all
if( !$userdata['session_logged_in'] || ( $mode == 'editpost' && $post_info['poster_id'] == ANONYMOUS ) ){     $template->assign_block_vars('switch_username_select', array());     $template->assign_block_vars('switch_image_verification', "");}


Enjoy,
- John
Last edited by jwernerny on Wed Dec 31, 1969 4:00 pm, edited 1 time in total.
User avatar
jwernerny
Members
Members
 
Posts: 87
Likes: 0 post
Liked in: 0 post
Joined: Wed Apr 12, 2006 3:58 am
Cash on hand: 0.00
Location: Fairport, NY


Return to IM Portal Support Forum

Who is online

Registered users: Vendethiel