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

Winapi c++: DialogBox hangs when breaking a loop -

vb.net - Font adding using PDFsharp -

javascript - jQuery iScroll clickable list elements while retaining scroll? -