php - Preventing CSRF and XSRF Attacks for jQuery $.post -


i hit simple csrf attack , realized lot of ajax scripts open. these accessed on site $.post().

is there way automatically add php token of these or need go through , one-by-one?

using bwoebi's answer, found better solution. jquery has built in setup function ajax.

<script>var token ="<?= $_session['token'] ?>";</script> <script> jquery.ajaxsetup({     data: {         token: token     } }); </script> 

this add token every jquery request!


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -