PHP Classes

Secure Media: Protect Flash files from hotlinking by other sites

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in Bookmark in
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2004-10-14 (10 years ago) RSS 2.0 feedStarStarStarStar 60%Total: 2,086 All time: 1,781 This week: 1,360Up
Version License Categories  
securemedia 1.0GNU General Publi...Files and Folders, User Management, S..., F...
Description Author  

The Apache mod_rewrite is often used to protect images and other types of media files from hotlinking from other sites, that make them appear in their pages although they are served from the original sites.

However, mod_rewrite can be used to protect the service of Flash files against hotlinking because these are embedded in pages using the <object> tag and in this case the browsers do not send a referer when requesting the Flash file from the origin server.

This class provides an alternative solution that works by generating a access key that is used to compose the URL used in the object tag but it is only valid only during a limited period of time.

The class takes as options the location of server directory where is the file to be protected, a password and the limit of time during which the access key is valid.

When the class validates the access key, it serves the real Flash file if the key is valid, or serves an error Flash file otherwise.

Innovation Award  
PHP Programming Innovation award nominee
October 2004
Number 4

Prize: One copy of the Maguma Workbench
The unauthorized use of content of one site in another site is an activity that concerns many site owners.

Hotlinking is one type of unauthorized content use that consists in making pages, images and animations appear in one site despite they are being served by the site that really is publishing that type of content.

Hotlinking is problematic not only because it lets unauthorized sites obtain illicit merit for showing unauthorized content, but also because it may cause financial losses by making the owner site pay for the bandwidth to serve content for other sites.

There are solutions to prevent simple hotlinking by rejecting accesses made from unauthorized referring sites. However, these solutions do not work well for blocking hotlinking of Flash animation objects.

This class provides an alternative solution that works well enough for Flash animations embedded in Web pages dynamically generated with PHP.

Manuel Lemos
Picture of Florian Metzger
Name: Florian Metzger <contact>
Classes: 1 package by
Country: Germany Germany
Age: 36
All time rank: 133887 in Germany Germany
Week rank: 1707 Down98 in Germany Germany Down
Innovation award
Innovation award
Nominee: 1x

  Files folder image Files  
File Role Description
Plain text file CSecureMedia.php Class the main class
Accessible without login Plain text file README Doc. documentation
Accessible without login Plain text file securemedia.php Example sample script

 Version Control Unique User Downloads Download Rankings  
 0%Total:2,086All time:1,781
 This week:0This week:1,360Up
 User Ratings  
 All time