Jump to content

Stop a script running unless it was called by my ajax request.


ToonMariner

Recommended Posts

OK I have posted this in the ajax forum but its pretty quite so I'd liek to see if anyone in here has any ideas.

I have a php script called via an ajax request.  I want the script to ensure it has been called by this request and NOWHERE else; i.e. nobody could type the url in or even script a bot that would send a request to this script automatically.

I really need to restrict script running JUST from the ajax request on my site.

ANY ideas will be much appreciated.
Link to comment
Share on other sites

$_SERVER['HTTP_REFERER'] may not nessesscarily be sent by the client or can be set (depending on client).

The session thing could work but i'd have to unset it each time just in case they tried to leave a window open and use that as a gateway.

Gonna have to make sure I get the old logic right on this - it is critical
Link to comment
Share on other sites

Hmm yeah didnt think about that...  Idea... make the session value random things then store the session value in a DB by sessid that way if they go to another page and come back itll reset it and their old one would be incorrect making them unable to go to another page with still the right session thing set...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.