SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: PHP Question

  1. #1
    SitePoint Addict Chris Roane's Avatar
    Join Date
    Jul 1999
    Location
    Helena, MT
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    I am creating a topsites page for one of my clients in PHP and MySQL.

    How can I make the topsite list reset daily?

    Thanks!

    Chris Roane


  2. #2
    exit();
    Join Date
    Jul 2000
    Posts
    759
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe setup a cron job..?

    Or you could use the PHP function that pauses the script for the number of seconds you want it too..I forget what the function is called, I'm sure somebody will reply that knows

  3. #3
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Maybe you mean sleep? But I don't see how you would do such a thing with sleep.

    Yes, a cronjob would definitely work. (also the best soln IMO)
    Or you could update the page depends on when the user loads (check if over one day, then update - inefficient performance if there are a lot of hits)
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  4. #4
    SitePoint Evangelist
    Join Date
    May 2000
    Location
    Canada
    Posts
    533
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    sleep .. lol... yes, sleep a script for 24 hours.. hehe, thats just an evil concept which should have never been brought up ... hehe

    oh ya, i wont comment on the actual question of this thread as both of the earlier 2 have given the best answer possible
    cogito, ergo sum

  5. #5
    SitePoint Addict Chris Roane's Avatar
    Join Date
    Jul 1999
    Location
    Helena, MT
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For any of you who would actually want to know how to do this, I got this reply from the webmaster-forums.com:

    --------------------------------------------
    Create a file called 'cront', and inside it put something like:


    code sample:0 0 * * * lynx -dump http://www.url.com/to/reset_topsites.php



    upload the file to your home directory, login to telnet and type
    'crontab cront'

    This would execute the script via lynx at midnight each night.
    --------------------------------------------

    Chris Roane


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
  •