Web Analytics Made Easy -
StatCounter Make a page that can only be visited once a day - CodingForum

Announcement

Collapse
No announcement yet.

Make a page that can only be visited once a day

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Make a page that can only be visited once a day

    I was just wondering if there was a way to make a page that can only be visited once a day somehow. Like using the IP or cookies.

  • #2
    Out of curiosity, why do you need to display a page only once per day? because whatever method you end up using I think it will be pretty easy for users to bypass it.

    Some users will have dynamic IP addresses. IP addresses can also be spoofed and cookies can be turned off in users' browsers and users could just go to another pc to view a page again on the same day.

    At best, if 1 visit per day is critical, you will be able to restrict access to a particular pc but you will have no way at all of knowing who is actually sitting at the keyboard.
    Last edited by webdev1958; Aug 28, 2011, 12:25 AM.

    Comment


    • #3
      most users who are not advanced will be easily limited to once a day visits by your setting a cookie with one-day expiration. If it exists, then reroute them to another page.
      Fuquay Dentist | Chapel Hill Dentist

      Comment


      • #4
        Using cookies. Add this code to the top of your page:
        PHP Code:
        <?php
        # if already visited, redirect to another page
        if ( $_COOKIE[visited] == "br549" )
        {
        header("location: http://your_domain.com/sorry.html");
        exit;
        }
        else
        {
        # Set Cookie & Expire Time
        $expire time()+60*60*24;
        setcookie"visited""br549"$expire);
        }
        ?>
        If you want to remove the cookie for testing purposes:

        PHP Code:
        <?php
        setcookie
        "visited"""time()-60 );
        ?>

        Comment


        • #5
          Like webdev, I'm curious what you are trying to do that you need to limit it to once per day. There might be a better way to accomplish your goal.

          If you don't want to rely on cookies you could store the IPs in a database table with the timestamp. This has the disadvantage that if multiple visitors share the same IP, if one of them visits it, the other won't be able to. However they can't clear their cookies to bypass it.

          Cookies or storing the IP on the server both have downsides.
          OracleGuy

          Comment


          • #6
            I too am interested in this, my reason, not to Prevent or limit access, but to prevent the user having to see a particular "Message Page" more than once, but im looking for a slight variation.

            What i would like is a fancy box to load once on entry with a "How to Guide", users should have the option to "Close" or "Dont show me this again", the latter setting a cookie for life "or until cookie is removed. Any users blocking cookies do so at their own displeasure!


            I have some experience using fancy box but not with auto open or with cookie setting.



            Not sure if im supposed to do this, but i run a website that generates an income and would be pleased to donate to the coder who assists me.



            ***EDIT***

            I have now sorted the on load function of the fancybox, so i think ..... i just need the cookie to determine whether or not this bit is executed
            Code:
            <body onload="$('#aLink').trigger('click');">
            <a id="aLink" href="http://www.google.com" ></a>
            Last edited by embeebutterly; Aug 29, 2011, 10:05 AM.

            Comment

            Working...
            X
            😀
            🥰
            🤢
            😎
            😡
            👍
            👎