Files
ritzenbergen-backend/bulitipp/zeitzutippen.php

24 lines
678 B
PHP
Executable File

<?php
header("Access-Control-Allow-Origin: *");
include("../../mysqlverbinden.php");
include("../rowforeach.php");
include("inc.php");
$query=srowforeach("SELECT deadline from `buli-paarungen` where spieltag=? ORDER BY `deadline` ASC;", [getmaxspieltag()+1]);
if(count($query)>0){
$unixtime = date_create_from_format('Y-m-d H:i:s', $query[0][0])->getTimestamp()-time();
$hours=(int) date("H", $unixtime);
$days=date("d", $unixtime)-1;
}
$data=[
"spieltag" => getmaxspieltag()+1,
"deadline" => $query[0][0],
"unixtime" => $unixtime,
"hours" => $hours,
"days" => $days
];
echo json_encode($data,JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);