SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with some Server Side Scripting

    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 !

    wendell42

  2. #2
    SitePoint Wizard bronze trophy cydewaze's Avatar
    Join Date
    Jan 2006
    Location
    Merry Land, USA
    Posts
    1,096
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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
    <cfset myblog = "http://cydewaze.org/">

  3. #3
    Team SitePoint Bentheax's Avatar
    Join Date
    Feb 2013
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  4. #4
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,269
    Mentioned
    197 Post(s)
    Tagged
    3 Thread(s)
    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.

  5. #5
    SitePoint Wizard bronze trophy cydewaze's Avatar
    Join Date
    Jan 2006
    Location
    Merry Land, USA
    Posts
    1,096
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    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.
    <cfset myblog = "http://cydewaze.org/">

  6. #6
    SitePoint Member
    Join Date
    Mar 2013
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •