View Full Version : PHP script

10-25-2009, 01:22 PM
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 ?



10-25-2009, 11:20 PM
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.