Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: PHP script

  1. #1
    New to the CF scene
    Join Date
    Oct 2009
    Location
    Bourtange The Netherlands
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question PHP script

    Hi There,

    I'm a newbie and I have a wish.

    On my site I have a webcam. My wish is to get a script that can show on my site the webcam between sunrise and sunset.

    Between sunset and sunrise must the script show a picture.

    Is there anyone who can help me ?

    Regards,

    Bert

  • #2
    Super Moderator
    Join Date
    Feb 2009
    Location
    England
    Posts
    539
    Thanks
    8
    Thanked 63 Times in 54 Posts
    PHP Code:
    if ((time() < date_sunrise(time(), SUNFUNCS_RET_TIMESTAMP)) || (time() > date_sunset(time(), SUNFUNCS_RET_TIMESTAMP)) {
        
    // Night

    } else {
        
    // Day


    (not tested)

    This should run the "Night" section before sunrise and after sunset, and run the "Day" section between sunrise and sunset. It is based on the coordinates specified in the php.ini file, and may need tweaking to specify the actual location to want to base it on.
    lamped.co.uk :: Design, Development & Hosting
    marcgray.co.uk :: Technical blog


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •