Blocking the direct download of a file
| From: | pw | Date: | Mon, 07 May 2007 15:36:36 +0000 |
| Subject: | Blocking the direct download of a file | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-254499@lists.php.net to get a copy of this message | ||
Hello,
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 thought, at first, I could just use a php page as my jar reference:
<html>
<body>
<applet code="my.class" archive="./jar.php" width="100" height="100">
</applet>
</body>
</html>
I would then use the following in jar.php:
<?php
$referrer=$_SERVER['HTTP_REFERRER'];
if(strcmp($referrer,"http://www.myweb.com/index.phtml")==0)
{
header("Location: ./primary.jar");
}
else
{
header("Location: ./secondary.jar");
}
?>
The problem is I get a java.lang.ClassNotFoundException.
Is there a way to change a reference like this
'on-the-fly' so to speak?
Is my code wrong and this method can be modified
to work?
Thanks for any info,
Peter