The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Using securitytoken to protect ajax requests
I wanted to use the security token to protect an ajax request.
So I submitted the token with the ajax post request from a vbulletin page to my custom page. HTML Code:
<script type="text/javascript"><!-- $(document).ready(function(){ $("#nudge_icon").click(function(){ $.ajax({ url: '/nudge.php', type: 'POST', async: true, dataType: 'text', data: ({'from' : '$bbuserinfo[userid]', 'to' : '$userinfo[userid]', 'securitytoken':'$bbuserinfo[securitytoken]'}), success: function(data) { alert(data); }, error: function(data) { alert(data); } }); }); });//--> </script> And I defined CSRF_PROTECTION as true (don't know if that is even necessary). I then make a comparison like this: PHP Code:
I assume a new token is generated when the global.php is called? How can I use a securitytoken check on an ajax request? |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|