Answer the question
In order to leave comments, you need to log in
How to ensure security when working with Ajax?
There is a switch on the page, for example this:
When it is changed in the database, the value should change. Total chain goes:
Page with switch -> Page handler -> DB
Question: How to prevent a direct request to the handler page by third parties?
After all, the page with the switch has access to the session, for example, and can check its existence and the user id. The session handler page does not have access. Pass CSRF tag to handler? What will he compare it to? Nothing sensible comes to mind.
Answer the question
In order to leave comments, you need to log in
Page handler - what is it?
Your request should be sent to the server, which should have the current user in the session, and he should check the access rights.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question