Welcome Guest, Not a member yet? Register   Sign In
Get the URL of a HotLinked image
#1

[eluser]tank6b[/eluser]
Hi All,

Thanks to the great community here I have managed to solve one issue, now I have other one:
How I can know the url that is hotlinking a image I'm serving inside CI.

So the image I'm serving like this
http://ellislab.com/forums/viewthread/73281/

Now I want to know what pages are displaying the image.

Thanks in advanced
#2

[eluser]webthink[/eluser]
You want to know the referring url is for the image? You can use $_SERVER['HTTP_REFERER'] Have I understood?
#3

[eluser]tank6b[/eluser]
$_SERVER[’HTTP_REFERER’] will only work if the page was visited via a click but not if it is a direct visit.
#4

[eluser]webthink[/eluser]
so if it is set you record the referrer and if it isn't you know there is no referrer so there is nothing to record. I guess I'm not really sure what the issue is.
#5

[eluser]tank6b[/eluser]
The images will be hotlinked from my site, that's why I have to keep track of where they are been displayed.

Referer will only be set if the page was visited via other page, when you jup to a link from the address bar directly no referer will be set as far as I know.
#6

[eluser]webthink[/eluser]
You have a controller which is responsible for file-reading the images and then serves the image data via the header correct? and presumably you have links on other pages which point to that page. If I understand you correctly you're interested in knowing which links are being clicked to access you image serving script. So in the image serving controller you check HTTP_REFERER and if it's set you have the referring page to do what you want with. If it isn't you know that an attempt was made to access the page directly.

Perhaps a better description of your requirements would help.




Theme © iAndrew 2016 - Forum software by © MyBB