WebCam PHP


SUBMITTED BY: Guest

DATE: July 23, 2014, 12:04 p.m.

FORMAT: Text only

SIZE: 1.2 kB

HITS: 724

  1. <?php
  2. /*
  3. cavemonkey50's Webcam Update Script
  4. Author: Ronald Heft, Jr. (cavemonkey50.com)
  5. Script Webpage: http://cavemonkey50.com/code/webcam_update_script
  6. Last Updated: 11/03/05
  7. Version 1.5
  8. Purpose: To check if the webcam image was updated and display the appropriate information.
  9. */
  10. // Configure the following variables:
  11. $file = "cavecam.jpg"; // The name of the image
  12. $dir = "/home/cavemon/public_html/cavecam/images/"; // The directory the image resides (using full server path)
  13. $time = 60; // How long the webcam should be displayed before considered offline (in seconds)
  14. // End variable configuration. Do not edit any PHP from beyond this point. Only edit HTML.
  15. $filename = $dir . $file; // Assembles the filename
  16. if (file_exists($filename)) { // Checks if the image exists
  17. if (filemtime($filename) + $time >= time()) { // See if the webcam was updated
  18. ?>
  19. <!-- Insert the HTML for when the webcam is active. -->
  20. <?php } else { ?>
  21. <!-- Insert the HTML for when the webcam is inactive. -->
  22. <?php } } else { // If the webcam does not exist ?>
  23. <!-- Insert the HTML for when the webcam image does not exist. -->
  24. <?php } ?>

comments powered by Disqus