PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Steptoe
Involved
Involved


Joined: Oct 09, 2004
Posts: 288

PostPosted: Sun Jun 08, 2008 3:50 pm Reply with quote Back to top

Hey guys, see u are all still kicking around, keeping well I hope.
I have been playing with
1/ .htaccess and
2/ .htaccess/showpic.php
They both work but cant figure out how to make them work as I would like.

the simple .htaccess method described in older posts and below just replaces the hotlinked file with a gif

What I would like to do is have that hotlink pic
Image
(or preferible site link banner )
Image
With a hyper link to kakariki.net home page
And words below like "hotlink bandwidth theft is not permiited, if you wish to visit us clk the banner above" A alt tag with site description
Sort of the same as the code in the link to us block raven has on the home page

The codes I have been playing with are
1/
Code:
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)$ /hotlink.jpg [R,L]


2/ in .htaccess
Code:
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


And a new file showpic.php
Code:
<?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.kakariki.net">
 
Only registered users can see links on this board!
Get registered or login to the forums!

</p>
</body>
</html>


I have googled for a few days to find something, but the above seems to be they only choices...
I think dong a link banner concept would be a cool idea. Idea

Once again many thanks for the help in the past.
Cheers
Steps

PS was looking for a Simple access log veiwer prog and found this...
Over the last few weeks the guy has upgraded several times with cool added functions..so its work in progress. I have only used thru LAN
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message
Steptoe
Involved
Involved


Joined: Oct 09, 2004
Posts: 288

PostPosted: Mon Jun 09, 2008 3:16 am Reply with quote Back to top

Had another go with 2/
Changed showpic.php to
Code:
<?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>

If I go to
Only registered users can see links on this board!
Get registered or login to the forums!

I get what I want to present instead of the hotlinked file

But doesnt work where the hot link is??
I suspect it is the last line in the ,htaccess
Code:
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


O as usual Im trying to do something with something I have no idea ...
Again Rolling Eyes

Help please?
View user's profile Send private message
Steptoe
Involved
Involved


Joined: Oct 09, 2004
Posts: 288

PostPosted: Mon Jun 09, 2008 8:03 pm Reply with quote Back to top

Bump?
Is it actually possible to do what I would like?
View user's profile Send private message
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7327
Location: Arizona

PostPosted: Tue Jun 10, 2008 5:09 am Reply with quote Back to top

Steptoe, bump? Shocked

I think you are on the right track. Unfortunately, I am not sure about the second line within your .htaccess. That may very well be correct as far as I know, but my first glance at it made me unsure of it. Maybe try this:

RewriteCond %{REQUEST_FILENAME} ^.*\.(jpg|gif|png)$ [NC]

In addition, depending upon where these image path names are coming from, you may want to consider doing some input cleansing on the $pic variable as you could be opening yourself up for all sorts of exploitation.
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum