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
Post a Comment