Re: Cookie Redirect Script
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.javascript archive

Re: Cookie Redirect Script

From: Alan Little <alan@n-o-s-p-a-m-phorm.com>
Date: Wed Aug 17 2005 - 20:18:52 CEST

Carved in mystic runes upon the very living rock, the last words of
<no@spam.com> of comp.lang.javascript make plain:

> On my website, I get quite a bit of 404 traffic. What I was looking
> for is the first time a surfer goes to the 404 page, it will redirect
> the user to http://www.page1.htm. At the same time, it would place a
> cookie on his pc.
>
> Should the user come back and get a 404 page within X hours (A number
> I'd configure), the second time, he would be redirected to
> http://www.page2.htm. If he came back a third time, he would go to
> http://www.page3.htm.

Something like:

(1x) Sorry, that page isn't here.
(2x) Sorry, that page *still* isn't here, and won't be any time soon.
(3x) WHAT, ARE YOU %##$^&$# STUPID!? THE PAGE ISN'T HERE!!!!

:)

Make your 404 page a page which just checks the cookie, sets or updates
it as needed, and then sets window.location accordingly.

Although you're probably better off doing this with server-side
scripting, or with mod_rewrite if you're using Apache.

-- 
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/
Received on Tue Oct 18 03:10:01 2005