wendell42 — 2013-03-05T13:56:49-05:00 — #1
I am VERY new to website design.
I would like to prevent someone from bookmarking our property records search pages, so that they HAVE to go through our disclaimer page in order to perform a search.
Here is what I would like to do (found this on another thread). I would like to use a server side languange like PHP to create a cookie or authenticate a user so that the server detects whether or not a persona has accessed the disclaimer page before trying to get into the search page.
For example, I would like to code a cookie on the search page . This cookie would detect whether a user went to the disclaimer page before accessing the search page. If not, the cookie will send the user back to the disclaimer page. if the user DOES go to the disclaimer page first, then the cookie lets the user use the search page.
I hope someone can help me with this in SIMPLE terms, remember I am new to website design, so PLEASE be gentle with me !
cydewaze — 2013-03-05T21:30:01-05:00 — #2
Hmmm, I think I would use a session variable for this rather than a cookie. When the user visits your disclaimers page, the session variable is set, else it's null. On your record page, check the session variable for null, and if it's null, redirect them to the disclaimer page.
See if this is any help: http://php.about.com/od/advancedphp/ss/php_sessions.htm
bentheax — 2013-03-06T20:40:58-05:00 — #3
Your choice of session vs cookie will depend on the exact behaviour you want. Roughly speaking - A session is private, short-lived server-side information. On the other hand, a cookie will send a flag in the background to the user's browser, and their browser will send it back to you on each page of the site that they visit.
If you really want the user to be redirected to the disclaimer every single time, then setting a session variable in the way cydewaze described is absolutely the way to go. However, making your users accept a disclaimer every time is probably not going to achieve much, and it adds an extra click to their flow through your site, so give consideration to whether this is really necessary. If you just want to make sure the user has seen the disclaimer at least once in the past, then just set and check a cookie.
mittineague — 2013-03-07T00:09:16-05:00 — #4
Yes, but cookies can be deleted. That is. if a visitor has their browser set to delete cookies upon browser close, they'll get the "disclaimer" every visit.
I think what @cydewaze; had in mind was a database field like disclaimer_seen = true
But this would require registered accounts and not be for anonymous visitors.
cydewaze — 2013-03-07T08:26:34-05:00 — #5
The OP said that he wanted to keep people from bookmarking pages within his site and force them to see the disclaimer each time, so that's why I suggested a session variable.
wendell42 — 2013-03-07T09:06:31-05:00 — #6
Thanks for the info folks. Not sure which way I am going to try to go with this yet. I am just in the early stages with this, but it is something that I definately want to incorporate into our pages. Hopefully I can learn enough about PHP and scripting to be able to get everything done the way I would like it.