Reputation: 516
I have a PHP script located on mysite.org
and I use it to display images on sub sites of example.com
(like example.com/foo/bar
, example.com/foo/another-bar
). I can only post links to that script there.
Tried $_SERVER['REQUEST_URI']
, and $_SERVER['REMOTE_ADDR']
but there's no go.
So what i need is some way to know if its used on e.g. example.com/foo/bar.
Upvotes: 1
Views: 60
Reputation: 64
You may use $_SERVER['SERVER_NAME'], you can check other variables from the php documentation: http://php.net/manual/en/reserved.variables.server.php
Upvotes: 0
Reputation: 887767
It sounds like you're looking for the Referer
header, which tells you the page that the request for an image came from.
Note that some browsers do not send this header.
Upvotes: 1
Reputation: 270677
You need a combination of $_SERVER['SERVER_NAME']
and $_SERVER['REQUEST_URI']
. Or maybe I'm misinterpreting the question. $_SERVER['SERVER_NAME']
returns the domain name a script is running on.
Upvotes: 0
Reputation: 734
just create a test php script containing:
<?php
phpinfo();
?>
It will give you very detailed list of php settings and global variables, the setting that you are looking for is bound to be there.
Upvotes: 0