Skip to content
/ anticsrf Public

Add dynamic anti CSRF token(s) to HTML forms and Ajax requests.

License

Notifications You must be signed in to change notification settings

moh85/anticsrf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

antiCSRF JavaScript and JQuery Function

Add dynamic anti CSRF token(s) to HTML forms and Ajax requests.

Require: JQuery Library version + 2.0

• Default Setup:

antiCSRF({'token' : '123456'});

This will add a dynamic hidden input with PARAMETER: token and VALUE: 123456 to all current HTML Forms and dynamically-added forms.

• Advanced Forms Setup:

antiCSRF({'token' : '123456'}, { target: '#from_1'});

This will add a PARAMETER (token) = 123456 the target JQuery's selector (#from_1) HTML Form.


Note: by default, the plugin will add the token = value for all AJAX request in the request headers as KEY = VALUE, then you can deal with it on the server side. In PHP for example, you can get the list (array) of all request headers using: $headers = apache_request_headers();


Note: the addedd parameter METHOD type is the same for HTML Form / Ajax Request.

About

Add dynamic anti CSRF token(s) to HTML forms and Ajax requests.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published