forked from nathan242/ipcam-cctv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrecording-log.php
68 lines (60 loc) · 2.71 KB
/
recording-log.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
require_once($_SERVER['DOCUMENT_ROOT'].'/include/main.php');
require_once($_SERVER['DOCUMENT_ROOT'].'/include/config.php');
if (isset($_GET['camera']) && $_GET['camera'] != '*') {
$database->prepared_query('select `id` from `devices` where `name`=?', array('s'), array($_GET['camera']));
if (isset($database->result[0])) { $config = new config($database, $database->result[0]['id']); } else { $config = new config($database); }
} else {
$config = new config($database);
}
if (isset($_GET['log']) && $log = @file_get_contents($config->config_data['log_directory'].'/'.basename($_GET['log']))) {
$logfile = basename($_GET['log']);
$pagepath = array(array('CCTV CONTROL', '/cctv.php'), array('RECORDING LOG VIEWER', '/recording-log.php'.((isset($_GET['camera']) && !empty($_GET['camera'])) ? '?camera='.$_GET['camera'] : '')), array('RECORDING LOG VIEWER: '.$logfile, '/recording-log.php?camera='.((isset($_GET['camera']) && !empty($_GET['camera'])) ? $_GET['camera'] : '*').'&log='.$logfile));
$topbar = true;
include $_SERVER['DOCUMENT_ROOT'].'/include/header.php';
echo '<p><a class="btn btn-default" href="/recording-log.php';
if (isset($_GET['camera']) && !empty($_GET['camera'])) {
echo '?camera='.$_GET['camera'];
}
echo '"><<BACK</a></p>';
echo '<pre>'.$log.'</pre>';
} else {
$pagepath = array(array('CCTV CONTROL', '/cctv.php'), array('RECORDING LOG VIEWER', $_SERVER['REQUEST_URI']));
$topbar = true;
include $_SERVER['DOCUMENT_ROOT'].'/include/header.php';
echo '<p><a class="btn btn-default" href="/cctv.php"><<BACK</a></p>';
$database->query("select `name` from devices");
if (isset($database->result[0])) {
echo '<p><form action="" method="get"><select name="camera" onchange="this.form.submit()"><option';
if (!isset($_GET['camera']) || empty($_GET['camera'])) {
echo ' selected';
}
echo '>*</option>';
foreach ($database->result as $row) {
echo '<option';
if (isset($_GET['camera']) && $_GET['camera'] == $row['name']) {
echo ' selected';
}
echo '>'.$row['name'].'</option>';
}
echo '</select></form></p>';
}
$logfiles = scandir($config->config_data['log_directory'],1);
//print_r($logfiles);
foreach ($logfiles as $logfile) {
if ($logfile != '.' && $logfile != '..') {
if (isset($_GET['camera']) && !empty($_GET['camera']) && $_GET['camera'] != '*') {
if (strpos($logfile, $_GET['camera']) === 0 && $logfile[strlen($_GET['camera'])] == '.') {
echo '<p><a href="recording-log.php?log='.$logfile;
echo '&camera='.$_GET['camera'];
echo '">'.$logfile.'</a></p>';
}
} else {
echo '<p><a href="recording-log.php?log='.$logfile;
echo '">'.$logfile.'</a></p>';
}
}
}
}
include $_SERVER['DOCUMENT_ROOT'].'/include/footer.php';
?>