allow html anchor tag href, but not link in browser?
Posted 18 July 2012 - 01:49 PM
Hello, I do not know if this is possible as it sounds impossible. I have a php program that open files via <a> tag ( so it is a list of files on the page and when clicked downloads them). I am wondering if it is possible so that the programs anchor tag is allowed to download when on the page, but when someone types the files path in the URL of a browser it gets blocked. I am hoping Apache can distinguish the difference somehow?
This post has been edited by polska03: 18 July 2012 - 01:54 PM
Re: allow html anchor tag href, but not link in browser?
Posted 18 July 2012 - 02:03 PM
No, the web server only knows that a web client (typically a browser) is issuing a GET request. This could be because they clicked a link or they typed in a URL. The browser sends the request the same in either case. That is, a GET header followed by any number of optional header fields.
None of which tell the server how the request was initiated.
Having said that, you could potentially check if they were referred to the page (like via a link) vs direct (typed in the URL) using something like PHP's HTTP_REFERER. But this is terribly unreliable in that some browsers can manipulate this or even not provide a referrer at all.