Removed log file code and “json_validate” code because php 7.3 does not provide it

This commit is contained in:
pezcurrel 2024-07-28 09:19:42 +02:00
parent 40012eeaa3
commit 77a1fbaf2f

View file

@ -70,10 +70,6 @@ if (isset($_GET['host'])) {
$rl=['remaining'=>400,'restime'=>0];
if ($hostok) {
$logfp='sec/'.$_GET['host'].'.log';
$logfh=@fopen($logfp,'a+');
if ($logfh===false)
die('Could not open log file.');
$rlfp='sec/'.$_GET['host'].'.rl.state';
if (file_exists($rlfp)) {
$buf=@file($rlfp,FILE_IGNORE_NEW_LINES);
@ -178,9 +174,6 @@ if ($errors=='' && $_GET['acctock']!='' && $_GET['host']!='') {
$rl=ckratelimit($http_response_header,'echofun',true,false);
if ($res===false) {
echo "<div class=\"error\">Error: could not connect to «{$hhost}».</div>\n";
} elseif (@json_validate($res)===false) {
echo "<div class=\"error\">Error: «{$hurl}» has not returned valid JSON (".json_last_error().': '.json_last_error_msg().").</div>\n";
fwrite($logfh,$res);
} elseif (null===$res=@json_decode($res,true)) {
echo "<div class=\"error\">Error: «{$hurl}» returned data that could not be parsed as JSON (".json_last_error().': '.json_last_error_msg().").</div>\n";
} elseif (isset($res['error'])) {
@ -210,9 +203,6 @@ echo "<div id=\"footer\"><a href=\"".SREPO."\">{$usname} ".SVERS."</a></div>
</body>
</html>\n";
if (isset($logfh))
fclose($logfh);
function preprint($var) {
return '<pre>'.print_r($var,true)."</pre>\n";
}