
Originally Posted by
dollar
I thought about it for a moment. For it too work you would have to place a Setcookie in the area function of the script thats only invoked generating the homepage. the anti-hotlink code would have to placed somewhere in the function thats only involved and invoked with dealing with grabbing the content or sending it to the user. This would effectively seperate the two functions from collsions and cuasing conflicts. Else you would have the antilink function running on the homepage before they even get a chance of getting a cookie to send. (Thus the infinte redirect loop). I hope you understand. Perl is not my area of expertise I do have a little bit knowledge of cgiproxy source. It may take ALOT of tinkering of cgiproxy to get it right and bit of reading on perl for you. Have fun.

Actually, the solution you proposed is exactly in what Glype and other scripts base their anti-hotlinking solutions.
An alternate solution (since no one appears to know Perl) would be to create a PHP file that would be called into a <script> tag which would check for the cookie to exist. Else, break out of frames (if any) and redirect to homepage, where another script would be called which add the cookie or start the session.
Will, can you add a custom code to the footer or the header of the proxified pages and modify the appearance of the homepage at the CGI proxy? If you can, this is doable.
Please note, this code has not yet been tested! I wrote it here as-is!
It might fail, so if you're not a PHP developer please do not use this code!
Code for antileech.php:
PHP Code:
<?
error_reporting(0);
session_start();
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache"); // HTTP/1.0
if ($_GET['install']){
$_SESSION['secret3'] = 'ok';
exit;
}
if ($_SESSION['secret3'] !== "ok"){
echo 'top.location="/";';
}
?>
Code to add to homepage:
HTML Code:
<script src="/antileech.php?install=true"></script>
Code to add to proxified pages' header:
HTML Code:
<script src="/antileech.php"></script>
Bookmarks