Mandate POST method for ping.php
This commit is contained in:
parent
cf570fdeea
commit
a8bbdf907a
1 changed files with 15 additions and 10 deletions
|
@ -1,12 +1,17 @@
|
||||||
<?php
|
<?php
|
||||||
|
require_once('config.inc.php');
|
||||||
|
|
||||||
|
$apikeys = $config['ping'];
|
||||||
|
|
||||||
header('Content-type: text/plain');
|
header('Content-type: text/plain');
|
||||||
if(isset($_GET['apikey']) && ($_GET['apikey']=='apikey1' || $_GET['apikey']=='apikey2')){
|
if ($_SERVER['REQUEST_METHOD'] == 'POST' &&
|
||||||
|
isset($_GET['apikey']) && in_array($_GET['apikey'], $apikeys, true))
|
||||||
|
{
|
||||||
file_put_contents ( 'pinged.txt' , 'true' );
|
file_put_contents ( 'pinged.txt' , 'true' );
|
||||||
echo true;
|
echo $str;
|
||||||
} else {
|
} else {
|
||||||
$str=file_get_contents('pinged.txt');
|
$str=file_get_contents('pinged.txt');
|
||||||
echo "API Key Missing!\n";
|
echo "API Key Missing (must be POST method)!\n";
|
||||||
echo $str;
|
echo $str;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
Reference in a new issue