0

I have a ajax request to https://foo.bar.example.com/lib/foo/bar/ajax.php?

/var/www/html/lib/ is a symbolic link to /var/www/application/lib/.

Within /var/www/application/lib/foo/bar/ajax.php, I need to determine whether the original page where the ajax request originated from had one of the following three directory paths:

  1. /lib/someSpecificFile.php (i.e. https://foo.bar.example.com/lib/someSpecificFile.php?a=b)
  2. /someSpecificDirectory/index.php (i.e. https://foo.bar.example.com/someSpecificDirectory/index.php?a=b or https://foo.bar.example.com/someSpecificDirectory/)
  3. Any other path.

How can this be accomplished?

user1032531
  • 24,767
  • 68
  • 217
  • 387
  • @Barbar. I was contemplating using `$_SERVER['HTTP_REFERER']`. So just manipulate it by removing the protocol based on `$_SERVER['HTTPS']` and the host based on `$_SERVER['HOST']`, and any trailing GET data, and then use a `switch` statement or if/else? – user1032531 May 06 '15 at 15:24
  • Looks like `parse_url($_SERVER['HTTP_REFERER'])` might be a better choice. – user1032531 May 06 '15 at 15:35

0 Answers0