Copyright Message

Rewrite copyrighted images to first display the copyright note: (see also SettingCookies for Version 2.0 ;-)) in the .htaccess file:

 RewriteEngine On

 ## comes not from the copyright page
 RewriteCond %{HTTP_REFERER} !(^.*/public/copyright\.html$)
 ## comes not from itself, so has been redirected already, optional query string
 RewriteCond %{HTTP_REFERER} !(^.*(jpg|tif|tiff|jpeg|mov|mp4|mpg|ram)(\?.*)?$)
 ## is a request for a hires or fullres image
 RewriteCond %{REQUEST_URI} ^.*(fullres|highres|hires|\/video\/).*$
 ## then do the trick...
 RewriteRule   ^(.*)$  /public/copyright.html

und copyright.html:

 if (!$target = $_REQUEST["target"]) {
  # we are coming via the rewrite rule, so the image to be shown is in the URI!
  $target = $_SERVER["REQUEST_URI"];
 }
 $source = $_SERVER["HTTP_REFERER"];

 # SAFARI HACK (caching), we have been here before... prevent caching
 if (stristr($_SERVER["HTTP_USER_AGENT"],'Safari')) {
  if (!$querystring = stristr($target,'?')) {
	$target = $target."?img=show";
  } else {
	$target = $target."&img=show";
  }
 }

 [...]
 <a href="<?=$target?>" class="button_yes">I accept the conditions</a>
 <a href="<?=$source?>" class="button_no">I do not accept the conditions</a>

Leave a Reply