note 59745 deleted from reserved.variables by philip
| From: | philip@php.net | Date: | Wed, 21 Feb 2007 16:03:11 +0000 |
| Subject: | note 59745 deleted from reserved.variables by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-123647@lists.php.net to get a copy of this message | ||
Note Submitter: Mr. Obvious
----
HTTP_REFERER Replacement
Being that REFERER is not a reliable resource to determine if a user is visiting a link from your
domain, try using apache_request_headers() instead (formerly getallheaders). I found this to work
very well with both IE and Netscape/FireFox when determining if a user is downloading a file from
outside of my domain.
<?php
$host=apache_request_headers();
if(!eregi('domain.com',$host[Referer])){
//[...code to download file here...]
}else{
//[...code to download alternate file here...]
}
?>