SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Zealot
    Join Date
    Apr 2001
    Location
    home
    Posts
    132
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Cookies to prevent going back a page?

    Can anyone show me how to use cookies to prevent a user from clicking back to a page?

    My client is doing an age verification check on one page and if you're over the age of 13, you go to one page, and if you're 13 or under, you go to another. They want to prevent the user from clicking back and adjusting their birthdate and they want to use cookies to do it.

    Any ideas?

  2. #2
    SitePoint Guru Ize's Avatar
    Join Date
    Nov 2005
    Location
    The Netherlands
    Posts
    808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sure, just set a cookie with the value entered in the form and check on the form-page wether it's set or not.
    If the value is already available and it's under 13, present or redirect to another page.

    Personally though, I would use a server-side language to add the cookies. Some smart kid could turn off Javascript and get in anyway.

    And on that note; if that same smart kid disabled cookies, he/she could get in as well.
    You could work out a server-side solution in which the visitor's data is saved in the database, together with his or her IP address, and block it for a certain time (an hour for instance) if his or her age is <= 13.

    But then again, you have to decide how far you want to take this


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
  •