note 58840 deleted from reserved.variables by nlopess
| From: | nlopess@php.net | Date: | Mon, 23 Jan 2006 11:32:00 +0000 |
| Subject: | note 58840 deleted from reserved.variables by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-102286@lists.php.net to get a copy of this message | ||
Note Submitter: Richie
----
// Check referrer to see if it matches $domain or is blank. allow download it one or both are true
else redirect to the index of folder containing the script.
<?php
$domain = 'host.com';
if (!(stristr($ref, $domain) === FALSE) || $ref == ""){
// allow download
//add download code here.
} else {
//redirect to current folder eg if script is at http://www.host.com/laugh/dl.php
// it would redirect to http://www.host.com/laugh/
header("Location: http://" . $_SERVER['HTTP_HOST']
. rtrim(dirname($_SERVER['PHP_SELF']), '/\\')
. "/" . $relative_url);
}
?>
-Richie
http://phoenixonline.co.uk