Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
How to create a one time splash page
I’m looking for a way to create a “one time splash page”. I explain:
when someone go a TXP website frontpage, if it’s his first time and if he is a “real user” (not a spider bot for example) he got a special page, like /welcome. If he is a returning visitor, he won’t see it. So :
- First time and real visitor : www.site.tld -> www.site.tld/welcome/
- Returning visitor or not “real” : www.site.tld -> www.site.tld
I’ve googled it, can’t find anything on it. But I’ve seen it on some websites.
The only way I can imagine this to work, would be a javascript code. If a visitor has javascript enabled, we check for a cookie. If he hasn’t got that cookie and we could set one, we redirect him to /welcome. If not (no javascript, can’t se a cookie, already got one) we let him stay on the regular frontpage.
Or maybe this could be done with PHP.
Anyone has any clue about this ? Some code I code use ? (it’s for an Apache setup, mod rewrite enabled, PHP, Perl if needed).
Last edited by Jeremie (2006-03-18 06:44:03)
Offline
Re: How to create a one time splash page
Ok, I got the keywords right this time. I found some things based on javascript, but it’s client side (so it can be delayed), and it will break the back/forward flow.
I’ve been looking for a server side (mainly PHP) solution, but can’t find one. It shouldn’t be difficult:
- if user accept cookie
- if user don’t have the welcome cookie
- then http redirect him to /welcome
- else, die
But my PHP is quite rusty.
Offline
Re: How to create a one time splash page
How about mod rewrite by USER_AGENT to www.site.tld/welcome/?
On /welcome you can have a fallback to check for or set $_COOKIE,
that will keep the www.site.tld clean.
Offline
Re: How to create a one time splash page
That might work. If I can find the appropriate rewrite rules, and the PHP checking on /welcome. I’m still a little stuck on the coding part.
Offline
#5 2006-03-18 23:14:48
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: How to create a one time splash page
It’s actually quite difficult to do cleanly, perhaps impossible, even with cookies.
The problem is, you need to detect users that don’t support cookies, and mark them as such. But how do you flag a non-cookie browser? You need to find a way to distingish between a browser that is visiting for the first time, and a browser that is not a new visitor, but doesn’t support cookies. A test cookie doesn’t help distingish between these two states.
There are ways to do it (check for the IP in the logs, use javascript, use a PHPSESSID flag in URLs), but all can fail; and when they do, you’ll wind up redirecting some poor schmuck around in circles.
Alex
Offline
Re: How to create a one time splash page
An UA doesn’t acknowledge it accept cookies ?
Ok… then what about a test cookie ? Why don’t it work ?
- Check the splash cookie
- If it’s not found then
- Try to set a test cookie
- Check that test cookie
- If that check cookie is found, redirect the UA and set the splash cookie
- If that check cookie is not found, die
No ? What am I missing ?
Last edited by Jeremie (2006-03-18 23:29:49)
Offline
Pages: 1