This repository has been archived on 2024-02-16. You can view files and clone it, but cannot push or open issues or pull requests.
ITSynOpen/server/update.php

31 lines
820 B
PHP
Executable File

<?php
require_once('config.inc.php');
$apikeys = $config['update'];
header('Content-type: text/plain');
if( isset($_GET['apikey']) && in_array($_GET['apikey'], $apikeys, true) ) {
if(isset($_GET['open']) && $_GET['open']=='true')
{
file_put_contents ( 'status.txt' , 'true,'.time() );
exec("./open.sh");
echo "true";
} else if(isset($_GET['open']) && $_GET['open'] =='false') {
file_put_contents ( 'status.txt' , 'false,'.time() );
exec("./close.sh");
echo "false";
}else{
echo "you are too stupid to use the api!\n";
}
} else {
$str=file_get_contents('status.txt');
$arr=explode(',',$str);
$open=$arr[0];
$date=$arr[1]; //lastchange: upadate via file see explode/implode
echo "API Key Missing!\n";
echo $open;
}
?>