https://www.icyphoenix.com/viewtopic.php?f=33&t=6976
-----------------------------------
KugeLSichA
Sat 20 Feb, 2010 14:49

Test Prevent Image Hotlinking
-----------------------------------
icyphoenix.com is in the whitelist... so the image should be displayed...


[img]http://www.caromonline.de/images/birthdaycake.gif[/img]

ok it works...  8)  great  :lol:


-----------------------------------
TheSteffen
Sun 21 Feb, 2010 13:59

Re: Test Prevent Image Hotlinking
-----------------------------------
Is it your own whitelist? A special mod or is it already in IP


-----------------------------------
KugeLSichA
Sun 21 Feb, 2010 15:39

Re: Test Prevent Image Hotlinking
-----------------------------------
[quote user="TheSteffen" post="48006"]Is it your own whitelist? A special mod or is it already in IP[/quote]

its configured in .htaccess (i´ll provite the code later here)

there are 2 ways to prevent hotlinking

1. block all domain who hotlink images, except yours
2. set only the domain which ist not auth to hotlink... <- i prefer this way

f.e. if someone (which domain ist blocked) link to a smilie or pic... it would not show the original pic... the pic which is showed f.e. this one

 [img]http://www.icyphoenix.com/files/images/6/nohotlinking.jpg[/img]


-----------------------------------
TheSteffen
Sun 21 Feb, 2010 16:18

Re: Test Prevent Image Hotlinking
-----------------------------------
Ah, OK... thanks for the information


-----------------------------------
KasLimon
Sun 21 Feb, 2010 16:24

Re: Test Prevent Image Hotlinking
-----------------------------------
In any case that person is stealing you bandwith, since that image also consumes resources :P


-----------------------------------
KugeLSichA
Sun 21 Feb, 2010 16:27

Re: Test Prevent Image Hotlinking
-----------------------------------
[quote user="KasLimon" post="48015"]In any case that person is stealing you bandwith, since that image also consumes resources :P[/quote]

yes your right...

but for example... if you have a stealing site which includes many other single pictures from your server.. so it loads only that one image... and then its in the browser cache...

and the second thing is... i have no problem if some ask me if he can include a image... but without ausking, i dont tolerate it...


-----------------------------------
spydie
Tue 30 Mar, 2010 20:53

Re: Test Prevent Image Hotlinking
-----------------------------------
could you please post the code here, Kugel


-----------------------------------
KugeLSichA
Wed 31 Mar, 2010 00:16

Re: Test Prevent Image Hotlinking
-----------------------------------
[quote user="spydie" post="48547"]could you please post the code here, Kugel[/quote]

Thanks for remind me...  :wink: 

OPEN [b].htaccess[/b]
ADD
[codeblock]
### S T O P   H O T L I N K I N G    BEGIN
# Stop Hotlinking Images ONLY for a specific site
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?example.de\.tl/ [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(.+\.)?example\.com/ [NC]
RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlinking.jpe [L]

# Blocks hotlinking for all other page, except your own page
#RewriteCond %{HTTP_REFERER} !^http://(.+\.)?caromonline\.de/ [NC]
#RewriteCond %{HTTP_REFERER} !^$
#RewriteRule .*\.(jpe?g|gif|bmp|png)$ /images/nohotlinking.jpe [L]
### S T O P   H O T L I N K I N G    END
[/codeblock]

You need to create an Image something like this:
 [img]http://www.icyphoenix.com/files/images/6/nohotlinking_1269987246_233368.jpg[/img] 

Name it to nohotlinking.[b]jpe[/b] an upload to folder images... or something else (change the path in htaccess)

greetings


-----------------------------------
My_PeSePe
Wed 31 Mar, 2010 00:33

Re: Test Prevent Image Hotlinking
-----------------------------------
My question is this, only with the images uploaded to my FTP or by example with which I have to serve imageshack.us


-----------------------------------
Informpro
Wed 31 Mar, 2010 13:04

Re: Test Prevent Image Hotlinking
-----------------------------------
KasLimon, it use the server because off the request ^^".


-----------------------------------
spydie
Wed 31 Mar, 2010 13:29

Re: Test Prevent Image Hotlinking
-----------------------------------
How would you do a whitelist for this ???

got my problems, with ht.access. Php/html is fine, but access is a bit more dificult for me

Does´nt work for me . Any chance to do this via php.ini file ??

my server does´nt read the access files.


-----------------------------------
Mighty Gorgon
Thu 01 Apr, 2010 13:57

Re: Test Prevent Image Hotlinking
-----------------------------------
I think you can do that only via htaccess.

Otherwise you should create a php file which read images and then black and white list host using PHP code. Like the album does for example.


-----------------------------------
spydie
Mon 16 Aug, 2010 12:42

Re: Test Prevent Image Hotlinking
-----------------------------------
anyway there´s one inconvenience.

if you put that in ht.access, it also blocks your forum link image.

that means , you can´t do interchange of link´s with this, since you´ve got to put all pages with links to you´re site in the whitelist, so they´re able to hotlink any image of you´re site


-----------------------------------
iorio
Tue 04 Jan, 2011 17:41

Re: Test Prevent Image Hotlinking
-----------------------------------
Holaa


-----------------------------------
Ghostsearcher
Wed 09 Feb, 2011 16:04

Re: Test Prevent Image Hotlinking
-----------------------------------
Hi there!

Just a question. I have already edited my htaccess and it works for now.
But now i have a little problem. It's about the dynamic images. They are all "not" hotlink protected.
Like this example: (this is the avatar!) [code]http://example.org/download/file.php?avatar=2_1296526796.png[/code]

So i googled for it and snap up this code:
[code]RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.org/download/(.+)php/?avatar/=(.+)?$ [NC]
[/code]
But this code deosn't work....

Can you help me further?
Thank you very much!

Greetings, testi ;)


-----------------------------------
Mighty Gorgon
Fri 11 Feb, 2011 10:56

Re: Test Prevent Image Hotlinking
-----------------------------------
You should act directly on the PHP files using the REFERRERS value...

This is an old piece of code I used to use:

[codeblock]
	$check_referer = explode('?', $_SERVER['HTTP_REFERER']);
	$check_referer = trim($check_referer[0]);

	$good_referers = array();

	if (!empty($config['hotlink_allowed'])
	{
		$good_referers = explode(',', $config['hotlink_allowed']);
	}

	$good_referers[] = $config['server_name'] . $config['script_path'];

	$errored = true;

	for ($i = 0; $i < sizeof($good_referers); $i++)
	{
		$good_referers[$i] = trim($good_referers[$i]);

		if ((strstr($check_referer, $good_referers[$i])) && ($good_referers[$i] != ''))
		{
			$errored = false;
		}
	}

	if ($errored)
	{
		die('NO HOTLINK');
		/*
		header('Content-type: image/jpeg');
		header('Content-Disposition: filename=' . $pic_info['title_reg'] . '.' . $pic_info['filetype']);
		readfile($images['no_thumbnail']);
		exit;
		*/
	}
[/codeblock]


-----------------------------------
Ghostsearcher
Fri 11 Feb, 2011 11:33

Re: Test Prevent Image Hotlinking
-----------------------------------
Hi there!

Thank you for helping me. It seems to be a hot piece of code you're given me, but i have unfortunely no clue where i have to put it in there.
Can you give me a little hint for that?

Thank you very much!

Greetings, testi


-----------------------------------
Mighty Gorgon
Fri 11 Feb, 2011 12:47

Re: Test Prevent Image Hotlinking
-----------------------------------
Hey [b]testi[/b] (I omit the last part to avoid Joshua jumping in and laugh :mri: )!

Just to understand the way I can explain further... How can you rate your PHP knowledge on a scale from 1 to 10?

You mentioned before that you couldn't block your "file.php" to be hotlinked, right? This code should be added almost on top of that file, but of course a bit of edit is needed to configure things properly...


-----------------------------------
spydie
Fri 11 Feb, 2011 13:23

Re: Test Prevent Image Hotlinking
-----------------------------------
BTW MG

Testi is using PhpBB3


-----------------------------------
Mighty Gorgon
Fri 11 Feb, 2011 15:48

Re: Test Prevent Image Hotlinking
-----------------------------------
Thanks [b]spydie[/b] for clarifying, but I already knew that. :mri:

The code I provided is just standard PHP plus a var which has to be defined... but before defining that I wanted to know how detailed I need to explain what he has to do.


-----------------------------------
Ghostsearcher
Sat 12 Feb, 2011 14:47

Re: Test Prevent Image Hotlinking
-----------------------------------
Hi there!

Yes, i've updated now my signature for what i use atm. I just forget the main things to say which software i'm using. ;)

And thank you very much Mighty, for answering me. It seems for me the right way.
Well, of course i don't know where i have to setting in the code in the file.php. :D
I've tried it with just copy and paste in the first line before "<?php" or below of it - But just the avatars will not shown. lol

So i'm curious how it will really work.
And still one question: Why i have to do this with php and why i can't handle this in the htaccess?
Just asking so i can understanding that.
Thank you! ;)

Best Greetings, Testi ^^


-----------------------------------
spydie
Sat 12 Feb, 2011 20:41

Re: Test Prevent Image Hotlinking
-----------------------------------
it´s probably, because if you use .htaccess, you´ll block all referers to hotlink, or you need to put the ones you allow , into your whitelist.

with this piece of code, it´s handelt by the script itself, with the ability to allow or disallow them in the ACP i think.

so you don´t need to edit the .htaccess all the times. 

BTW htaccess would block all images from hotlinking


-----------------------------------
Ghostsearcher
Sun 13 Feb, 2011 15:25

Re: Test Prevent Image Hotlinking
-----------------------------------
[quote user="spydie" post="51511"]it´s probably, because if you use .htaccess, you´ll block all referers to hotlink, or you need to put the ones you allow , into your whitelist.
[...]
BTW htaccess would block all images from hotlinking[/quote]

Hi there.

I already knew this, what you say and i want this. So if you read my first post in this thread, you will see that just this line doesn't work:
[code]RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.org/download/(.+)php/?avatar/=(.+)?$ [NC] [/code]
And i ask me why, because all the other rules are working good for me! :( 
I think, i have to wait for mighty.


-----------------------------------
Mighty Gorgon
Sat 19 Feb, 2011 10:17

Re: Test Prevent Image Hotlinking
-----------------------------------
Unfortunately it is not so easy to include all possible combinations just using regular expressions in HTACCESS because phpBB 3 just use a single php file for serving any file to users (being images or zip files...).

It's tough for me to explain the whole thing, but when you use PHP to serve files, then the content could be easier controlled using PHP code instead of going through HTACCESS, because only PHP code at that stage really knows which kind of file are you serving and which kind of limitations you would like to be in place.

Anyway, back to the point... now that I know what you would like to achieve and that you need to be guided through the process... I just need some time to adjust the right code to suit your needs.

Please be patient until I find the time for doing that... I'll be back with the code sooner or later. :mri:


-----------------------------------
Ghostsearcher
Sat 19 Feb, 2011 15:39

Re: Test Prevent Image Hotlinking
-----------------------------------
Hello Gorgon!

You are really helpful! Thank you for that!!! ;)
And of course you have so much time you need, because now i understand what you mean "its not so easy". I ever thought, htaccess is the ultimate weapon for this. Seems not to be. ^^
It's much fun to learn with you.
Thank you!

Best wishes, the testi of the testis. ^^


-----------------------------------
Mighty Gorgon
Sun 20 Feb, 2011 10:13

Re: Test Prevent Image Hotlinking
-----------------------------------
[quote user="testikel" post="51665"]I ever thought, htaccess is the ultimate weapon for this. Seems not to be. ^^[/quote]
HTACCESS is actually the best weapon for that, because you just check things on access, avoid charging CPU with other processes. The only point is that HTACCESS is a strange and tough beast, and if you don't know how to code that properly, you can create much more problems than those you will solve.

Can I just ask why are you so worried about avatars hotlinking?


-----------------------------------
Ghostsearcher
Sun 20 Feb, 2011 18:26

Re: Test Prevent Image Hotlinking
-----------------------------------
Hi Mighty!

Well, that htaccess is a beast is no wonder for me. If i remind me right, i needed round'bout 4 weeks to solve my general hotlink problem in the past. Because many things didn't worked right for me and the internet - pheeeww - it is sometimes really confusing about this hotlink things. I think, you can follow me. ;) That one wrote it works but not at me and the other one told me, that cant working, but he told me also not how i could fix that.
But thats not the point today, because my hotlink protection is working so far so good. (except the avatar thingy)

So, it is just a challenge for me to find out, why my htaccess can protect hotlinking, but not by avatars.
Again i found out, i have to put another line to my htaccess:
[code]RewriteCond %{HTTP_REFERER} !^http://(www\.)?example.org/download/(.+)php/?avatar/=(.+)?$ [NC] [/code]
But if i do that: nothing happens. (i told it a couple of posts before ^^)
And as i said, it was found by me in the internet and just guess: well, the user told me it works for him. haha. -.-"
Not for me. :D
In the other forums of phpbb, mod_rewrite, php and so on, noone can tell me anything about that.
But you, Mighty. ^_^

So and the thing to me is just the fact, why i "just" cant fix to prevent hotlinking of avatars except an eventuelly modified file.php. Because the line of code for the htacess should working - i guess.
And if i modified the line by "experimenting with letters and copy and paste it", the avatars doesnt appears. lol? lol... ^^
As you can see, it is for me more than fun to fix my "problem". I want to find out why it doesnt works and i want to know how it could be works. I have no spammery or hotlinker in my forum.
But, well, i think if i want to prevent hotlink, i have to make it right.
I hope you can understand/follow me.

I have time for that and i'll dont push this thread of course because i heard much about you that you dont have so much time. So i really appreciate it if you help me in any way for my very little problem.
I'm just glad about that, that just anyone want to help me. So i can wait. ;)

Thank you very much!

Best Greetings...


-----------------------------------
Mighty Gorgon
Wed 23 Feb, 2011 18:27

Re: Test Prevent Image Hotlinking
-----------------------------------
Ok... so if I understand correctly I just need to play with HTACCESS and see if I can come with an HTACCESS protection.

I will have a try with HTACCESS and get back to you when I have some free time.


-----------------------------------
Ghostsearcher
Sat 28 May, 2011 18:14

Re: Test Prevent Image Hotlinking
-----------------------------------
Hi there!

I want to let you know that i'm switching right now to "icy phoenix - board", instead of my old normal phpbb3.0.8!
So it's not sooo important anymore i guess.
If you wish, you don't need anymore make your head broken about the htaccess problem. If yes, so im still curious about that. ^^ ;)
Thank you very much! (and to joshua203 to his advise for using icy ^_~)

Best Greetings, testi* ^^


P.s.: I-P looks really cool..!!!! Better than the normal phpbb 3.0.8!


-----------------------------------
Mighty Gorgon
Sat 04 Jun, 2011 10:31

Re: Test Prevent Image Hotlinking
-----------------------------------
Hey Testi*, I'm glad to see that you are trying to move to Icy Phoenix, I hope you won't be disappointed.

Did you manage to convert from phpBB 3 yet?

Regarding HTACCESS, I didn't have the time to play with that yet unfortunately... :roll:


