Forum Moderators: phranque

Message Too Old, No Replies

Simple SSI Problem

Probably simple I know

         

IanCP

1:58 am on Dec 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I think or hope this is the correct forum.

I have this SSI as an include file on my Rate a Page.

Essentially the idea is that if you didn't get there via one of the pages on the two sites you should then be referred to deny.htm

[SSI Code}

<!--#set var="AB" value="http://www.example[1].com/" -->
<!--#set var="CD" value="http://www.example[2].com/" -->

<!--#if expr="${HTTP_REFERER} =ET" -->
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=#start">
<!--#elif expr="${HTTP_REFERER} =VK" -->
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=#start">
<!--#else -->
<META HTTP-EQUIV="Refresh" CONTENT="1; URL=http://www.example.com/denied.htm">

<!--#endif -->

[/SSI Code]

The first two lines weren't strictly necessary but however. From within the sites you actually are sent to the anchor link #start.

If I simply paste the rate-page URL into my browser, you should be sent to denied.htm and this simply doesn't happen.

The idea is to stop spammers using my URL to post the usual links and, before anyone suggests any other remedy I've just about exhausted them all.

Thanks!

jdMorgan

3:20 am on Dec 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You won't get reliable results unless you flush your browser cache between tests. If the browser successfully fetches the page (because the referrer is valid), then the next time that page is requested, the browser will serve it from your local cache, and no request will be sent to your server. Therefore, your server-side code can/will have no effect on requests served from cache.

Jim

IanCP

3:35 am on Dec 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Very good points Jim, many thanks. A friend in a different forum just reported this:

Ian;

Using Firefox 2 I end up at

http://www.example.com/denied.htm

when I click on

http://www.example.com/rate-page.htm

But in IE6 & 7 I go nowhere!

Opera 9 goes into refresh mode but just keeps forever reloading the same URL while Netscape 7, as you would expect, does the right thing and behaves the same as FireFox and goes to the denied page.

So, somehow the code is not liked by IE or Opera, interesting!

I'll do a search and see what I can find out.

jdMorgan

3:43 am on Dec 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just be aware that the referrer for a meta-refreshed page will be the same as the original request. Therefore, your 'checking' page and your 'not-denied' or 'actual-content' page should be different, otherwise, you'll get a loop.

You might consider using a modified version of the common anti-hotlinking .htaccess code (commonly used for image protection, but easily-adaptable to this situation) to avoid the SSI/meta-refresh method altogether...

Jim

IanCP

3:55 am on Dec 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Again good points

Thanks

IanCP

8:23 am on Dec 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not for the first time, nor the last time, am I most grateful for the forum WebmasterWorld.

Thanks so much