1
kaotik
xoopsSecurity through POST
  • 2005/11/5 16:55

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


I've been tring to use xoopsSecurity through a hidden field in a POST form.
Hidden field:
<input name="t" type="hidden" value="<?php $GLOBALS['xoopsSecurity']->createToken(); ?>">


on the receiving end:
$token_valid $GLOBALS['xoopsSecurity']->check(true$_REQUEST['t']);
if (!
$token_valid){
redirect_header(XOOPS_URL."/"3implode("<br/>",$GLOBALS['xoopsSecurity']->getErrors() ) );
}


This always returns $token_valid as false. What am I doing wrong?

Thanks
www.kaotik.biz

2
Dave_L
Re: xoopsSecurity through POST
  • 2005/11/5 18:45

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


I think you have to use the name XOOPS_TOKEN_REQUEST:

<input name='XOOPS_TOKEN_REQUEST' type='hidden' value='<?php $GLOBALS['xoopsSecurity']->createToken() ?>'>


Then the check would be:

if (!$GLOBALS['xoopsSecurity']->check()) {
   
redirect_header(XOOPS_URL3implode('<br />'$GLOBALS['xoopsSecurity']->getErrors()));
}


If that doesn't work, view the source for the generated HTML page, and verify that it contains something like:

<input type='hidden' name='XOOPS_TOKEN_REQUEST' id='XOOPS_TOKEN_REQUEST' value='db08170597299ee18a2b1267a93e25a2' />

3
kaotik
Re: xoopsSecurity through POST
  • 2005/11/22 14:41

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


It's always the simple things that get me.....
I forgot to insert echo in the code. Here's how it should look:
<input name='t' type='hidden' value='<?php echo $GLOBALS['xoopsSecurity']->createToken(); ?>'>
www.kaotik.biz

Login

Who's Online

112 user(s) are online (59 user(s) are browsing Support Forums)


Members: 0


Guests: 112


more...

Donat-O-Meter

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

Latest GitHub Commits