ToonMariner Posted November 28, 2006 Share Posted November 28, 2006 OK I am sure this is straight forward but I am struggling to find a solution.I have a php script that is called from an ajax request. I want to make sure that this script can only be called by that ajax request and NOT by someone reading the url and either putting it in the address bar or worse using some kind of bot to call this script automatically.So basically the php script HAS to check that the call for it to run was from the ajax request and NOWHERE else. Quote Link to comment https://forums.phpfreaks.com/topic/28677-calling-a-script-from-ajax/ Share on other sites More sharing options...
ober Posted November 28, 2006 Share Posted November 28, 2006 Well... the only way to do that is to pass something in the JS... but we all know that anyone can read the JS file, so you're best off including that file within your "backend.php" file or whatever the JS calls. And you'd be better off grabbing something from a session that you put there and then verifying that in the backend call before running your special little script. Quote Link to comment https://forums.phpfreaks.com/topic/28677-calling-a-script-from-ajax/#findComment-131270 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.