Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
  #1  
Old 11-16-2008, 04:12 PM
asandhanam asandhanam is offline
 
Join Date: Oct 2007
Posts: 57
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How to use vbulletin's built-in captcha in custom forms

I used 'form hack' to build a custom form for my forum. Its been working great except that recently i started getting a lot of spam. So i want to add a image verification system to it to block spam. The two add-ons (for image verification) on form hack's main post aren't being supported anymore. I tried 'no spam'. No luck with that either. I'd like to use vb's default captcha system with this custom form. How do i do it? Can someone help please?

--------------- Added [DATE]1226885487[/DATE] at [TIME]1226885487[/TIME] ---------------

I came half way through with this. Still not working fully.
I added $imagereg to my custom form template
Next, in the validation section i added the following:
require_once(DIR . '/includes/functions_regimage.php');
if (!verify_regimage_hash($vbulletin->GPC['imagehash'], $vbulletin->GPC['imagestamp']))
{
$errors[] = "some err msg";
}
Although doesn't throw any errors, the validation doesn't get passed even if i enter the correct numbers from the image because the hidden 'imagehash' value in the form is empty. What am i missing here? Please help someone.

--------------- Added [DATE]1226889098[/DATE] at [TIME]1226889098[/TIME] ---------------

I'm disappointed i received no help from VB community on this. After hours of breaking my head, i figured it out myself. Would like to share it so it might help somebody else save some time.
I had use it with my 'form hack' custom form.
Here is what you'll have to do.
1) open imagereg template (styles -> style manager -> edit templates -> imagereg
2) Copy everything.
3) paste to your 'form' template at the desired place (where you want the image verification to appear on your custom form. Actually you should be able to just paste $imagereg in the desired place but for some reason it didn't work for me.)
4) Next edit your form hack plugin
5) Look for $vbulletin->input->clean_array_gpc('p', array(
6) Add these two in there:
'imagestamp' => TYPE_STR,
'imagehash' => TYPE_STR
7) Add this
require_once(DIR . '/includes/functions_regimage.php');
$imagehash = fetch_regimage_hash();
Somewhere before the form validation part starts
8) Add this in the validation part
///check image hash
require_once(DIR . '/includes/functions_regimage.php');
if (!verify_regimage_hash($vbulletin->GPC['imagehash'], $vbulletin->GPC['imagestamp']))
{
$errors[] = "Security Image Verification is incorrect";
}
9) Save the plugin

It should be good to go. I hope this helps someone.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 08:13 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03337 seconds
  • Memory Usage 2,149KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (1)post_thanks_box
  • (1)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (1)post_thanks_postbit_info
  • (1)postbit
  • (1)postbit_onlinestatus
  • (1)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete