help php timer

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

    help php timer

    I just want to make a PHP script that will act normal when visited,and
    $do_secret_thing="no"; but ONCE every six hours when visited it will set:
    $do_secret_thing="yes";
    this Needs to happen ONCE every SIX HOURS.
    Anyone please give me sample php code. I will be gratefull. Thanks in advance.:-)

    #2
    are u want to do it separatly for each visitors or just for al users at ones?

    Comment


      #3
      All users. The six hours need to be serverside. Users have nothing to do with it

      Comment


        #4
        You can store last Explose in a mysql record or just in a file. when a vistor visits ur site, it has to check time defferent between now n last Explose time. then if it more than 6h, just Explose it again n save last Explose time.

        *Explose=ur secret thing :-)

        Comment


          #5
          you can do that with server crono job set it to your file accesing it once every 6 h .. :p
          This is ten percent luck, twenty percent skill
          Fifteen percent concentrated power of will
          Five percent pleasure, fifty percent pain

          And a hundred percent reason to remember the name!

          Comment


            #6
            if you want a php code
            PHP Code:
            <?php
            $last
            =file_get_contents("time.txt");
            if(
            time() > ($last + (6*60*60))) 
            {
                
            file_put_contents("time.txt",time());
                echo 
            "special thing";
            } else {
            echo 
            "nothing";
            }
            ?>
            but i would go for a cron job

            Comment

            Working...
            X