Suppose I would have a PHP file on my server. Now in my HTML I have a piece of Javascript code which refers to the path/url of the PHP file. Is it possible to restrict the PHP code to function only for a specifed website?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Short answer: yes.
My assumption is that you have the same PHP script on many different domains, and you want it to behave differently for some domains
First off you need to make sure your PHP script has a reliable way of detecting which domain it’s running on. This should be in your configuration somewhere. I wouldn’t trust
HTTP_REFERERand$_SERVERmay not have what you need.If you have this it should be easy enough to decide what the script should do.