PDA

View Full Version : Forcing redirect leads to token error


joshtrav
04-10-2012, 05:13 AM
I am currently trying to redirect from page A to page B based if post data sent to page B is incorrect.

Using the method

header('Location: http://www.website.com/pageA.php');


Brings me to the following error:

Your submission could not be processed because a security token was missing.

If this occurred unexpectedly, please inform the administrator and describe the action you performed before you received this error.


I am also sending post data back to the page A to identify the mistakes.

Does anyone have any idea how I can achieve this as the above method seems invalid?

LifesGreatestGift
04-10-2012, 05:21 AM
wrap it in ob_start(); ob_end_flush(); ?

joshtrav
04-10-2012, 05:45 AM
Tried that as well.

I found that it has to do with the CSRF protection being defined to true on PAGE B. I tried sending the hash and security token in the form as hidden with:


<input type="hidden" name="s" value="$session[sessionhash]" />
<input type="hidden" name="securitytoken" value="$bbuserinfo[securitytoken]" />


And that did not help. I am at a loss.

--------------- Added 1334041500 at 1334041500 ---------------

Sigh, its getting late and I am just not thinking things through.

I forgot to alter the values for the change in how vb4 handles the variables.


<input type="hidden" name="s" value="{vb:raw session.sessionhash}" />
<input type="hidden" name="securitytoken" value="{vb:raw bbuserinfo.securitytoken}" />


Fixes the issue.

LifesGreatestGift
04-10-2012, 10:28 PM
lol, that will do it. :) glad you got it resolved. Next time post the code so we can save you the headache ;)