02-24-2016, 10:10 PM
To extend on what I'm trying to do: I'm trying to make use of the Token class in the following way.
I have a function which generates the submission form. In that form I use the Token::generate() function to generate the token, and that is inserted in the form (the Token::generate function call is immediately before the form function call with the token as an argument.
The form is submitted through a jQuery call and the form data is $_POST'd including the token. Then in the form handler php script, I run the Token::check function and it always returns that the tokens don't match.
I'm trying to figure out what I'm doing wrong. What I don't understand is how the generation and the check are synchronized.
I have a function which generates the submission form. In that form I use the Token::generate() function to generate the token, and that is inserted in the form (the Token::generate function call is immediately before the form function call with the token as an argument.
The form is submitted through a jQuery call and the form data is $_POST'd including the token. Then in the form handler php script, I run the Token::check function and it always returns that the tokens don't match.
I'm trying to figure out what I'm doing wrong. What I don't understand is how the generation and the check are synchronized.