PHP Form, ajax and token question

ساخت وبلاگ
Hello,

I am, for the first time adding a token to my php form(using also https), but I have a problem.

Here is my workflow and where the problem happens:

1)Form shows up in html and a token is generated via php and placed into an hidden field.

2)The form data is sent via ajax and processed via an external php script that sends back a success or error.
While this is happening the token is also kept in a session.

3)When an error happens in the form, the ajax sends the error back to the form but here is the problem...my token is not being regenerated and therefore the next time I resend the form, the hidden field is empty.


What would you do to stop this from happening please as I can only generate the token server side...also repassing the token via ajax would be a security problem too and make no sense......

Would you have any solution for this please(no code...just the flow I need to understand).

Thank you!
CodingForums...
ما را در سایت CodingForums دنبال می کنید

برچسب : نویسنده : codingforums بازدید : 138 تاريخ : چهارشنبه 28 تير 1396 ساعت: 12:53