pw wrote:
I have a phtml file that contains a reference to
a java archive (jar) file.
I only want the archive used in the context of
a specific html page. I don't want the archive
to be downloaded directly.
I can think of two easy ways to do this. If you're using Apache, you
could fiddle with the config a little to deny non-local downloads:
SetEnvIfNoCase Referer "^http://www.myweb.com/" local_ref=1
<FilesMatch "\.jar">
Order Allow, Deny
Allow From env=local_ref
</FilesMatch>
(Stolen from: http://apache-server.com/tutorials/ATimage-theft.html.
Have used something similar, but don't want to dig through my own configs.)
Alternately, you can do something like this - similar to your idea, but
in this case, the download actually happens from the PHP script:
if (strpos($_SERVER['HTTP_REFERER'],'http://www.myweb.com/') === 0) {
header('Content-Type: application/java-archive');
readfile('/path/to/real/jarfile.jar');
exit(0);
}
There are probably lots of other ways to do that kind of thing.
jon
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php