30 lines
820 B
PHP
Executable file
30 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;
|
|
}
|
|
|
|
?>
|