Hello;
long while since I posted here..
I am using a validator.php file to validate some textfield via AJAX.
I want to prevent anyone from directly accessing the validate.php file. The path to which is in my JavaScript (AJAX) code.
I have used a simple if statement like this...
if ($_SERVER['HTTP_REFERER']) {
.
.
.
my code
.
.
.
}
So far i can still execute my code from within the page the contains the AJAX code, but when I try to access the file directly from my address bar I get an error. So it seems to do what I want.
I wanted your opinion on whether this is an efficient and/or reliable method of keeping unwanted views of the validate.php file.
I was also thinking about using the SCRIPT_NAME, so that the file will only allow access to its code if the script trying to access it is the page where my AJAX code is, but then I will have to take into account all the files I would be using to access this validator.php class.
Thank You