$stat = stat("webcam.jpg");
$time = time();
$imagetime = ($time - $stat[10]);
if ( ! $i ) { $i = 1; }
else { $i++; };
if ( $imagetime < 60 ) {
$refresh = 30;
} elseif ( $imagetime < 120 ) {
$refresh = 90;
} else {
$refresh = 120;
}
$update = 0;
if ( $REMOTE_HOST ) {
$host = $REMOTE_HOST;
} else {
$host = $REMOTE_ADDR;
}
$dbh = mysql_connect('localhost', 'rex', 'dairyfarm');
mysql_select_db('rex');
$result = mysql_query("select hit_time from webcam where host='$host'");
while ($row = mysql_fetch_row($result)) {
$update = 1;
}
if ( $update ) {
mysql_query("update webcam set hit_time=null where host='$host'");
} else {
mysql_query("insert into webcam (host) values ('$host')");
}
srand((double)microtime()*1000000);
$rand=rand(9999,100000);
if ( $i < 50 ) {
?>
}
?>
Rex's Random Webcams
$rand=rand(9999,100000); ?>
> |
$rand=rand(9999,100000); ?>
$rand=rand(9999,100000); ?>
> |
 |
| |
thumbnails archive page
|
| |
| Last 5 webcam hits: |
$result = mysql_query("select host, date_format(hit_time, '%m/%d/%Y %r')
from webcam
order by hit_time DESC
limit 5");
while ( $row = @mysql_fetch_row($result) ) {
//$host = gethostbyaddr($row[0]);
echo "| $row[1] | ($row[0]) | \n";
}
?>
left image updated
$stat = stat("webcam.jpg");
$time = time();
echo strftime("%D %T", $stat[10]);
echo " (";
echo ($time - $stat[10]);
echo " seconds ago)\n";
?>
middle image updated
$stat = stat("alternative.jpg");
$time = time();
echo strftime("%D %T", $stat[10]);
echo " (";
echo ($time - $stat[10]);
echo " seconds ago)\n"; ?>
right image updated
$stat = stat("work.jpg");
$time = time();
echo strftime("%D %T", $stat[10]);
echo " (";
echo ($time - $stat[10]);
echo " seconds ago)\n"; ?>
| |