You are viewing a plain text version of this content. The canonical link for it is here.
Posted to asp@perl.apache.org by Csongor Fagyal <co...@conceptonline.hu> on 2003/01/10 14:37:12 UTC

Image + Session

Hi,

I have a site where users can upload pictures. I would not like anyone 
to link to these pictures from other sites. I am thinking about writing 
an ASP script that checks the referrer and not serve the images if the 
referer is not that of the main site. This is OK but probably one of you 
could suggest a better solution... let me know if you have a good idea.

Thanx,
- Cs.


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Image + Session

Posted by Peter Galbavy <pe...@photasmagoria.com>.
I use something like:

<%
my $allowed = 'x.com|y.com';

...

unless (exists $ENV{HTTP_REFERER} && $ENV{HTTP_REFERER} =~
/^http:\/\/($allowed)\//) {
    $Response->{Status} = NOT_FOUND;
    $Response->End;
}

...

%>

This is from memory so *excuse* the syntax and regexp errors ...

Peter


----- Original Message -----
From: "Csongor Fagyal" <co...@conceptonline.hu>
To: <as...@perl.apache.org>
Sent: Friday, January 10, 2003 1:37 PM
Subject: Image + Session


> Hi,
>
> I have a site where users can upload pictures. I would not like anyone
> to link to these pictures from other sites. I am thinking about writing
> an ASP script that checks the referrer and not serve the images if the
> referer is not that of the main site. This is OK but probably one of you
> could suggest a better solution... let me know if you have a good idea.
>
> Thanx,
> - Cs.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
> For additional commands, e-mail: asp-help@perl.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org


Re: Image + Session

Posted by Philip Mak <pm...@aaanime.net>.
On Fri, Jan 10, 2003 at 02:37:12PM +0100, Csongor Fagyal wrote:
> I have a site where users can upload pictures. I would not like
> anyone to link to these pictures from other sites. I am thinking
> about writing an ASP script that checks the referrer and not serve
> the images if the referer is not that of the main site. This is OK
> but probably one of you could suggest a better solution... let me
> know if you have a good idea.

RewriteEngine On
RewriteCond %{HTTP_REFERER} !^$ [NC]
RewriteCond %{HTTP_REFERER} !^http://([a-z0-9-]+\.)*shoujoai.com/ [NC]
RewriteRule .*\.(gif|jpg|jpeg|bmp|png)$ - [F,NC]

The above is something you can stick into your Apache configuration to
do that. It'll affect all gif/jpg/jpeg/bmp/png files. You just have to
replace "shoujoai.com" with your domain name.

---------------------------------------------------------------------
To unsubscribe, e-mail: asp-unsubscribe@perl.apache.org
For additional commands, e-mail: asp-help@perl.apache.org