How can I detect if my php script is being called from another domain and the other domain is making illegal use of my script? Is there a way to prevent this too?
A bit like user3491125 proposed, you could set a $_SESSION in the page where the call is made and check it on the page Ajax called if there is for instance $_SESSION['user'] set.