/
status_cam.php
30 lines (23 loc) · 933 Bytes
/
status_cam.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
<?php
include "ssh_cam.php";
//header('Refresh:1;url=./cam.php');
header('Location: cam.php');
$file_name='st';
if (isset($_POST['status'])){
$st=$_POST['status'];
if (($st == "off") || ($st == "on")) {
file_put_contents($file_name, $st);
foreach ($ip_adresses as $ip_adress) {
log_cam("-----------------------------------------");
if (ssh_exec($ip_adress['ip'], $ip_adress['port_ssh'], "index.php?status={$st}")){
log_cam("Webcam {$ip_adress['ip']} port {$ip_adress['port_ssh']} is [ {$st} ]",'send');
// echo date('H:i:s')." - "."Webcam {$ip_adress['ip']} port {$ip_adress['port_ssh']} is [ {$st} ]<br />";
} else {
log_cam("Error [ send {$st} ] Webcam {$ip_adress['ip']} port {$ip_adress['port_ssh']}",'error');
// echo date('H:i:s')." - "."<b>Error [ send {$st} ] Webcam {$ip_adress['ip']} port {$ip_adress['port_ssh']}</b><br />";
}
}
}
}
//echo file_get_contents($file_name);
?>