Normal
I hacked something together^^ It is totally untested and written in notebpad, so expect some errors [code]<?php$httpformat="http"; //hier angeben ob http oder https$port="5000"; //port$loginname="administrator"; //Loginname an der Surveillance Station$passwd="Passwort"; //passwort an der Surveillance Station$ip="192.168.178.99"; //ip adresse der Surveillance station im LAN$cam_id="1"; // Kamera ID mit script "hole Kamera ID" abfragen, später automatisieren// db$db_user = "USER";$db_pw = "pw";$db_database = "database";$db_table = "table";$db_ip = 127.0.0.1;// activate Surveillance$surveillance = true;// connect to db$connection = mysql_connect(db_ip, $db_user,$db_pw) or die ("No connection. User or password is wrong");// select tablemysql_select_db($db_database) or die ("The Database ". $db_database ." doesn't exist");// update table$query = "UPDATE ".$db_table." Set available = ".mysql_real_escape_string($_GET['available']).", time = NOW() WHERE id = ".mysql_real_escape_string($_GET['id'])." AND pw='".mysql_real_escape_string($_GET['pw'])."'";$update = mysql_query($query);if (!$update) { die('Error: ' . mysql_error());}// select info$query = "SELECT available FROM ".$db_table;$result = mysql_query($query);while($row = mysql_fetch_object($result)) { if ($row->available == true) $surveillance = false;}//Login an der Surveillance Station:$json = file_get_contents($httpformat."://".$ip.":".$port."/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=3& account=".$loginname."&passwd=".$passwd."&session= SurveillanceStation&format=sid'");$obj = json_decode($json, true);$sid = $obj["data"]["sid"];if ($surveillance) { //Kamera aktivieren: $json = file_get_contents($httpformat."://".$ip.":".$port."/webapi/_______________________________________________________entry.cgi?api=SYNO.SurveillanceStation.Camera&method=Enable&version=3&cameraIds=".$cam_id."&_sid=".$sid);}else { //Logout Surveillance Station: $out = file_get_contents($httpformat."://".$ip.":".$port."/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=Logout &session=SurveillanceStation");}?>[/code]
I hacked something together^^ It is totally untested and written in notebpad, so expect some errors
[code]<?php
$httpformat="http"; //hier angeben ob http oder https
$port="5000"; //port
$loginname="administrator"; //Loginname an der Surveillance Station
$passwd="Passwort"; //passwort an der Surveillance Station
$ip="192.168.178.99"; //ip adresse der Surveillance station im LAN
$cam_id="1"; // Kamera ID mit script "hole Kamera ID" abfragen, später automatisieren
// db
$db_user = "USER";
$db_pw = "pw";
$db_database = "database";
$db_table = "table";
$db_ip = 127.0.0.1;
// activate Surveillance
$surveillance = true;
// connect to db
$connection = mysql_connect(db_ip, $db_user,$db_pw) or die ("No connection. User or password is wrong");
// select table
mysql_select_db($db_database) or die ("The Database ". $db_database ." doesn't exist");
// update table
$query = "UPDATE ".$db_table." Set available = ".mysql_real_escape_string($_GET['available']).", time = NOW() WHERE id = ".mysql_real_escape_string($_GET['id'])." AND pw='".mysql_real_escape_string($_GET['pw'])."'";
$update = mysql_query($query);
if (!$update) {
die('Error: ' . mysql_error());
}
// select info
$query = "SELECT available FROM ".$db_table;
$result = mysql_query($query);
while($row = mysql_fetch_object($result)) {
if ($row->available == true)
$surveillance = false;
//Login an der Surveillance Station:
$json = file_get_contents($httpformat."://".$ip.":".$port."/webapi/auth.cgi?api=SYNO.API.Auth&method=Login&version=3& account=".$loginname."&passwd=".$passwd."&session= SurveillanceStation&format=sid'");
$obj = json_decode($json, true);
$sid = $obj["data"]["sid"];
if ($surveillance) {
//Kamera aktivieren:
$json = file_get_contents($httpformat."://".$ip.":".$port."/webapi/_______________________________________________________entry.cgi?api=SYNO.SurveillanceStation.Camera&method=Enable&version=3&cameraIds=".$cam_id."&_sid=".$sid);
}else {
//Logout Surveillance Station:
$out = file_get_contents($httpformat."://".$ip.":".$port."/webapi/auth.cgi?api=SYNO.API.Auth&version=3&method=Logout &session=SurveillanceStation");
?>[/code]