Popup that shows every 24 hours

Discussion in 'PHP' started by FireStorM, May 18, 2006.

  1. #1
    Hello , can anyone help me get a popup code that shows only after 24 hours , based on cookies i think ..

    thx lots in advance
     
    FireStorM, May 18, 2006 IP
  2. clancey

    clancey Peon

    Messages:
    1,099
    Likes Received:
    63
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This is not possible without a persistent connection to the users machine or by installing software on the users machine to count down the time until the popup should be displayed. For software installed on a machine, it only needs to save the install time and then wake every minute to see if it time to display the message.

    If you do either of these things without explicit permission from users, your URL and/or code will be flagged for inclusion in anti-spyware, malware, adware and/or anti-virus databases.

    If you are talking about a popup that would be displayed only when a visitor returns to your site and only if it has been at least 24 hours since the previous visit, putting the time in a cookie would be the correct approach. However, it will fail on systems where cookies are routinely erased.
     
    clancey, May 18, 2006 IP
  3. meikeric

    meikeric Peon

    Messages:
    58
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think you may mean on a website, ie. if it's been 24 hours since the last one.

    This is probably what you want to do...

    
    <?php
    
    if(!$_COOKIES['popup'])
    {
          setcookie('popup',1,time()+(24*60*60)
          echo 'javascript popup code';
    }
    else
    {
          $Other_Code;
    }
    
    
    
    Code (markup):
     
    meikeric, May 18, 2006 IP