1
boumbo
DuGris's SecurityImage Class and Module Issue
  • 2008/9/24 14:51

  • boumbo

  • Just popping in

  • Posts: 37

  • Since: 2006/9/25


I am trying to make a custom form system work with DuGris' SecurityImage class ver.1.6 and module ver.1.0beta4

Im using XOOPS ver. 2.2.2 with php5 installed.

I followed the instructions on DuGris' site on Installing and inserting the code in my forms:
http://www.dugris.info/modules/news/article.php?storyid=1&page=2
http://www.dugris.info/documentations/article.php?storyid=1&page=3

He says to insert the following code before and after the submit button. I tried doing that and every time i go on any form page that i created, it refreshes immediately to tell me Security Token Invalid and redirects me to my redirect link.

minaform.php
include_once XOOPS_ROOT_PATH."/class/xoopsobject.php";
include_once 
XOOPS_ROOT_PATH."/modules/accedian/class/IdgObjectHandler.php";
include_once 
XOOPS_ROOT_PATH."/class/xoopsformloader.php";

abstract class 
MinaForm extends XoopsObject

    
    function 
MinaForm (){}
    
    function 
getForm(){
    
$form = new XoopsThemeForm($this->getFormTitle(), 'new_product''index.php''POST');

       if(
$this->hasComment()){
      
$this->addCommentField($form);    
        }
        
//DuGris Code*****************
if (defined('SECURITYIMAGE_INCLUDED')) {
     
$security_image = new SecurityImage_SECURITYIMAGE_GETCODE );
    if (
$security_image->render()) {
      
$form->addElement($security_imagetrue);
     }
}
//DuGris Code*****************
        
    
$operationTray = new XoopsFormElementTray('');
    
$operationTray->addElement(new XoopsFormButton('''submit_product''Submit''submit'));
        
    
$form->addElement($operationTray);

//DuGris Code*****************        
include_once(XOOPS_ROOT_PATH "/class/xoopsformloader.php");
if ( 
defined('SECURITYIMAGE_INCLUDED') && !SecurityImage::CheckSecurityImage() ) {
     
redirect_header(XOOPS_URL."/modules/accedian/"2_SECURITYIMAGE_ERROR);
     exit();
//DuGris Code*****************

return $form;
}


Anyone would know what would be the cause of the security token being invalid if i didn't even submit the form yet?


Any help would be appreciated, i've been struggling with this issue for a long time.

Thanks.
Patrick S.

2
ghia
Re: DuGris's SecurityImage Class and Module Issue
  • 2008/9/24 17:16

  • ghia

  • Community Support Member

  • Posts: 4953

  • Since: 2008/7/3 1


There are two parts that have to be inserted.
At your place only the first part has to be inserted. This will generate the input line in the form.

The second part verifies the filled in security code and has to be inserted where you process the values received from the form eg. after the checking of GET and POST vars and before the action (eg insert to the database).

Login

Who's Online

193 user(s) are online (49 user(s) are browsing Support Forums)


Members: 0


Guests: 193


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits