function getdirs($dir) { $result = array(); $path = $_SERVER['DOCUMENT_ROOT']; $path = PathBckSlash($path, "/") . $dir; if (is_dir($path)) { $dp = dir($path); while (($file = $dp->read()) !== false) { if ($file != '.' && $file != '..') { clearstatcache(); if (is_dir($path . "/" . $file)) { //$folder= array("name" => $dir . "/" . $file); $subfolders = getdirs($dir . "/" . $file); $result[] = array("name" => $file, "dir" => $dir . "/" . $file, "isfldr" => true, "subfolder" => $subfolders); } } } $dp->close(); } return $result; }
<?php // version 1.03, 12/03/2012; // example usage: gallery.php?start=14&len=12 require 'common.php'; getparams(); $status = getdirs(); if ($status == 0) { print "directory \"{$archive_dir}\" not found<br>"; exit; } getfiles(); header('content-type: text/html; charset=utf-8'); echo "<html><head><title>" . date("Y M d H:i:s", ftime($working_dir . "/" . $files[$start])) . "</title></head><body>"; navigation_top(); navigation_bottom(); // Gallery echo "<p>"; if ($start > sizeof($files)) { $start = sizeof($files) - 1; } $last = $start + $len; if ($last >= sizeof($files)) { $last = sizeof($files) - 1; } for ($count = $start; $count <= $last; $count++) { $filename = $files[$count]; $smallname = $thumbdir . "/" . $filename; $smallname_abs = $root_dir . "/" . $smallname; if (file_exists($smallname_abs)) { echo "<a href='image.php?cam={$cam}&img={$filename}&dir={$dir}&i={$count}'><img src='" . $smallname . "' title='" . date("H:i:s", ftime($working_dir . "/" . $filename)) . "'></a> ";
//Задаем кодировку (важно) echo "<meta charset='utf-8'>"; //Пока работаем с 1 файлом //$code = getcode('index.html'); //Ищем файлы (Необходимо указать проверяемую директорию) ?> <h2>Что проверить?</h2> <form action="find.php" method="post"> <p>Директория: <input type="text" name="directory" value="/home/nefayran/Web/site/img" /></p> <p>Файл: <input type="text" name="file" value="index.html" /></p> <p><input type="submit" value = "Искать"/></p> </form> <?php $files = getdirs($_POST['directory']); $code = getcode($_POST['file']); //Код есть, файл есть, теперь надо сравнить //Проход по файлам echo '<h2>Что используется:</h2>'; echo "<ul>"; $good = array(); for ($i = 2; $i < count($files); $i++) { //Задаем файл ссылку на который надо найти $file = $files[$i]; //Проход по коду for ($j = 0; $j < count($code); $j++) { if (stristr($code[$j], $file) == TRUE) { echo '<li>' . $file . '</li>'; //Запомним используемые файлы array_push($good, $file);
<?php // version 1.04, 12/01/2013; // usage: http://www.opensmartcam.com/mjpeg.php?cam=MyWebcamDirectory&dir=2013-01-19 // comment out the following 4 lines, if you do not use a database and no registration script: session_start(); session_regenerate_id(true); require 'register/includes/functions.php'; require 'register/includes/config.php'; // read cgi parameters, scan directories, prepare a list of pictures: require 'common.php'; getparams(); getdirs(); getfiles(); ?> <html> <head> <title>OpenSmartCam</title> <link rel="stylesheet" href="/css/osc1.css" type="text/css" /> <script src="js/mjpeg.js" type="text/javascript"></script> </head> <body> <div id='wrapper'> <?php include "inc/navi.php"; ?> <div id='content'>