HotLinkShield - PHP5 Hotlinking Protection & Paywall filter, For free

» HotLink Shield - Example


To be honest, it's pretty straight forward - this is the prototype:
STRING shield(REAL-NAME,BEHAVIOUR,OUTPUT-NAME);

The parameters explained:
STRING is the encrypted value returned by shield()

REAL-NAME: the url of the file you want to show

BEHAVIOUR (optional): this is what you want to do when somebody gets anexpired link. This could be one of these:

  302: redirect - will redirect to $redirect as in your HLS-settings.php

  404 (default) : not found - will execute 404.php. As now it's just a custom error 404, but you can do whatever you want

  $file : will read any file you want, e.g. stolen.png or notfound.flv

OUTPUT-NAME (optional): this is the OUTPUT » NAME « of the file. It doesn't matter if it's a non-expired link or a substition image, this is the name that the server will output.

PHP usage example:
shield("realfile.png","stolen.png","oooops.png");

Means: if the link isn't expired, go for it and read realfile.png and output it as "ooops.png" Otherwise, show stolen.png but output it as "ooops.png"

Remember: you need to set up your .htaccess accordingly to your needs: you'll find a default .htaccess in the download package, however, you can find a much more extended example if you read the manual (click here to download it).
SourceForge.net
Support This Project
facebook share! Digg me! twitter share Valid XHTML
Valid CSS
HotLinkShield © 2010 Andrea Alessi - knukun ·AT· gmail.com - any comments and feedback are welcome!