Custom hotlinking

Fix it!!

Custom hotlinking

Postby Steptoe » Mon Jun 09, 2008 3:47 am

Im no coder, give me an avairy of endangers parrots or restore a vintage car yes...coding /languages I cant get my head around..
My coding is sort of try.. hit and miss ..google a lot and after a week or so start to ask, after seaching forums etc

I have got this far with basic htaccess code
Code: Select all
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?kakariki.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?kakariki.sytes.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?babelfish.altavista.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?translate.google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yahoo.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?yahoo.net/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?msn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?google.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?msn.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?windowslivetranslator.com/.*$ [NC]
RewriteRule \.(gif|jpg)$ http://www.kakariki.net/hotlink.jpg  [NC]


Which gives this web page hotlink
http://www.theparrotsocietyuk.org/foRum ... f=10&t=689

What I would like is this
http://www.kakariki.net/showpic.php

So messed around with creating a showpic.php code

Code: Select all
<?php
  header("Content-type: text/html");
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Cache-Control: no-store, no-cache,
          must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0",
          false);
  header("Pragma: no-cache");
//  $pic = strip_tags( $_GET['pic'] );

//  if ( ! $pic ) {
//    die("No picture specified.");
//  }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title><?php echo($pic); ?></title>
<meta
  http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1"
>
</head>
<body>
<p>
<a href="http://www.kakariki.net"><strong><big></big></strong><b>Due to Hotlinking Abuse the Practice is Blocked</b><br>
<img  src=/kikelogosm.gif alt="Kakariki, Care, Breeding, Diet, Health, Aviaries and Conservation" width=315 height=61><br>
  <strong><big></big></strong><b>You May Like to click Our Banner to Visit Us</b></a><br>
  Admin: Kakariki.net
</p>             
</body>
</html>


And this in .htaccess

Code: Select all
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} .*jpg$.*gif$.*png$ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !kakariki\.net [NC]
RewriteCond %{HTTP_REFERER} !kakariki\.sytes\.net [NC]
RewriteCond %{HTTP_REFERER} !google\. [NC]
RewriteCond %{HTTP_REFERER} !search\?q=cache [NC]
RewriteRule (.*) /showpic.php?pic=$1
RewriteRule (.*) /showpic.php$1


I have also played with the following in .htaccess
Code: Select all
href="http://www.kakariki.net"><strong><big></big></strong><b>Due to Hotlinking Abuse the Practice is Blocked</b><br>
<img  src=/kikelogosm.gif alt="Kakariki, Care, Breeding, Diet, Health, Aviaries and Conservation" width=315 height=61><br>
  <strong><big></big></strong><b>You May Like to click Our Banner to Visit Us</b></a><br>
  Admin: Kakariki.net


Basically I dont even know if it is possible to do or even if Im anywhere the right track...
I have hit a brick wall
I do know, the concept is no where to be found in google, and think it is right or wrong, quite cool and others may also like it

help appreciated
Cheers
Steps.
Steptoe
 
Posts: 3
Joined: Mon Jun 09, 2008 3:27 am
Location: NZ

Postby richardk » Mon Jun 09, 2008 12:53 pm

If they are using an image tag to hotlink the image what you send has to be an image, you can't use HTML.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Steptoe » Mon Jun 09, 2008 12:59 pm

Wrong answer lol
So if I understand you correctly...
So there is no way at all I can send our website link banner plus linking the banner to our home page?

Cheers
Steps
Steptoe
 
Posts: 3
Joined: Mon Jun 09, 2008 3:27 am
Location: NZ

Postby richardk » Mon Jun 09, 2008 1:57 pm

No, you can't make the banner into a link. I suggest you use a different image, one that highlights your site URL and the fact that it has been hotlinked.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby Steptoe » Mon Jun 09, 2008 3:50 pm

Thank you
For prompt replys ...
And letting me know as a novice that it is not my coding that is wrong but rather Im doing something that cant be done...
I was thing that maybe it could by refering htaccess to something like the orginal showpic.php code I found here http://www.alistapart.com/articles/hotlinking/
Code: Select all
<?php
  header("Content-type: text/html");
  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
  header("Cache-Control: no-store, no-cache,
          must-revalidate");
  header("Cache-Control: post-check=0, pre-check=0",
          false);
  header("Pragma: no-cache");
  $pic = strip_tags( $_GET['pic'] );
  if ( ! $pic ) {
    die("No picture specified.");
  }
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title><?php echo($pic); ?></title>
<meta
  http-equiv="Content-Type"
  content="text/html; charset=iso-8859-1"
>
</head>
<body>
<p>
  <img src="/<?php echo($pic); ?>" alt="Image">
</p>
<p>
  Image from
  <a href="http://www.yourwebsite.com/">
  your web site</a>.
</p>
</body>
</html>


Oh well back to the drawing board..make a new banner instead of this and do as you suggest.
Steptoe
 
Posts: 3
Joined: Mon Jun 09, 2008 3:27 am
Location: NZ


Return to Security with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 3 guests

cron