Author |
Message |
multiverso
Junior WebHelper
Joined: 20 Sep 2004
Posts: 3
|
Posted:
Mon Sep 20, 2004 10:04 am (19 years, 7 months ago) |
|
Hi!
This is my first post, so hello to all and please excuse my english.
I hope I'm posting this on the right forum
I would like to know if there is a way to do this:
I have a link on my main page that points to the section
I would like to force my visitors be be able to enter the section only when they click on the link located on the main page. I don't want to allow them to go directly to http://www.mydomain.com/section. If they go directly I would like to display a message (html page or an alert or something) saying that they have to enter that section of my site throught the main page, clicking on the link that points to that section. Maybe also would redirect them to my main page after several seconds.
In short what I would like is to be sure that my visitors always see my main page before going to the sections of my site, and that they reach those sections from the main page, not entering directly .
I don't have any idea how to do this. I have some knowledge of XHTML/PHP/CSS, but I guess that you have use a CGI script or maybe tweak the .htaccess file for this job...
Thanks in advance for reading this post and for any help. |
________________________________ Thanks!
Multiverso |
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Mon Sep 20, 2004 4:06 pm (19 years, 7 months ago) |
|
PHP could do it by analysing the HTTP_REFERER variable, but the problem is that the HTTP_REFERER variable is sometimes blank, which would mean that some people accessing the subpages via the main page wouldn't be able to get in.
One solution, which isn't ideal but at least resolves part of the problem is to set a cookie the first time the user is redirected to the main page, and not to redirect them more than once. Still not perfect though I'm afraid |
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Mon Sep 20, 2004 9:48 pm (19 years, 7 months ago) |
|
When the main page is generated, a random number could be generated which is appended to each link in the query string. Match this number to something unique to the client (IP address combined with user agent or something), and if it's not valid don't let them see the page.
Just out of interest, why would you want to require people to visit your home page first? |
________________________________ It's turtles all the way down... |
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Tue Sep 21, 2004 6:11 am (19 years, 7 months ago) |
|
Ah, good idea Adam! Starts getting a little complicated though... |
________________________________
|
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Tue Sep 21, 2004 7:09 am (19 years, 7 months ago) |
|
It needs to be complicated, since what multiverso is asking isn't as simple as you might think |
________________________________ It's turtles all the way down... |
|
|
|
multiverso
Junior WebHelper
Joined: 20 Sep 2004
Posts: 3
|
Posted:
Tue Sep 21, 2004 7:54 am (19 years, 7 months ago) |
|
Hi, thanks Daniel & adam for your answers!
I think that maybe the easiest way to accomplish what I want is using cookies.
Daniel wrote: |
One solution, which isn't ideal but at least resolves part of the problem is to set a cookie the first time the user is redirected to the main page, and not to redirect them more than once. Still not perfect though I'm afraid |
I would like the user to be redirected to the main page EVERY time he tries to visits the section directly. So I could be something like setting a cookie when the visitor click the link on the main page (or visit the main page) and checking this cookie when the visitor enters the section. If the cookie is present that means the visitor has seen the main page first (or clicked the link), but if the visitor tries to enter the section directly the cookie would not be present, so he will be alerted and eventually redirected to the main page. If the cookie is present (because he has clicked the link on the main page or visited it) he will be allowed to continue looking to the section, but the cookie should be deleted, because next time he visits the section he would have also to do it by clicking link/visiting the main page.
Unfortunately I don't know how to program cookies. If anyone knows how to code what I explained, I would be extremely grateful
I hope I have explained myself (english is not my native language)
Thanks again for reding and for your help! |
________________________________ Thanks!
Multiverso |
|
|
|
adam
Forum Moderator & Developer
Joined: 26 Jul 2002
Posts: 704
Location: UK
|
Posted:
Tue Sep 21, 2004 8:00 am (19 years, 7 months ago) |
|
|
|
|
multiverso
Junior WebHelper
Joined: 20 Sep 2004
Posts: 3
|
Posted:
Tue Sep 21, 2004 9:47 am (19 years, 7 months ago) |
|
Thanks adam!
I think the best way is to to it myself, so let's study about cookies!
Thanks again to all |
________________________________ Thanks!
Multiverso |
|
|
|
|
Page generation time: 0.237501 seconds :: 18 queries executed :: All Times are GMT
Powered by
phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme