This class display an image with a Security Code and demand the user to enter a Security Code manually before allowing posting.
You can download this class
here and the module manager
hereYou can see the different backgound image
hereto use this class you must add in the XOOPS forms of this code before the submit buttons
if (defined('SECURITYIMAGE_INCLUDED')) {
$security_image = new SecurityImage( _SECURITYIMAGE_GETCODE );
if ($security_image->render()) {
$form->addElement($security_image, true);
}
}
and you must add this code after the submission for testing the code
include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
if ( defined('SECURITYIMAGE_INCLUDED') && !SecurityImage::CheckSecurityImage() ) {
redirect_header('javascript:history.go(-1)' , 2, _SECURITYIMAGE_ERROR ) ;
exit();
}
here an example with the wordbook modulein the file include/storyform.inc.php to add the lines in red
....
....
if ( is_object( $xoopsUser ) )
{
$uid = $xoopsUser->getVar('uid');
$sform -> addElement( new XoopsFormHidden( 'uid', $uid ) );
$notify_checkbox = new XoopsFormCheckBox( '', 'notifypub', $notifypub );
$notify_checkbox -> addOption( 1, _MD_WB_NOTIFY );
$sform -> addElement( $notify_checkbox );
}
[b][color=CC0000]if (defined('SECURITYIMAGE_INCLUDED')) {
$security_image = new SecurityImage( _SECURITYIMAGE_GETCODE );
if ($security_image->render()) {
$sform->addElement($security_image, true);
}
}[/color][/b]
$button_tray = new XoopsFormElementTray( '', '' );
$hidden = new XoopsFormHidden( 'op', 'post' );
$button_tray -> addElement( $hidden );
$button_tray -> addElement( new XoopsFormButton( '', 'post', _MD_WB_CREATE, 'submit' ) );
in the file submit.php to add the lines in red
switch ( $op )
{
case 'post':
[b][color=CC0000] include_once(XOOPS_ROOT_PATH . "/class/xoopsformloader.php");
if ( defined('SECURITYIMAGE_INCLUDED') && !SecurityImage::CheckSecurityImage() ) {
redirect_header('javascript:history.go(-1)' , 2, _SECURITYIMAGE_ERROR ) ;
exit();
}[/color][/b]
...
....