Backend für Modals hinzugefügt
This commit is contained in:
@@ -1,16 +1,141 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>BuLi-Punkte</title>
|
||||
<link rel="stylesheet" href="bulitipp2.css">
|
||||
</head>
|
||||
<body>
|
||||
<style>
|
||||
h1{
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
$result=[];
|
||||
foreach (srowforeach("SELECT paarung, score1, score2 from `buli-results` where spieltag=?;", [$spieltag]) as $key => $value) {
|
||||
$id = $value[0];
|
||||
$score1 = $value[1];
|
||||
$score2 = $value[2];
|
||||
$tipp = getTipp($name, $spieltag, $id);
|
||||
$paarungQuery = srowforeach("SELECT heim, gast from `buli-paarungen` where id=?;", [$id])[0];
|
||||
$heim = $paarungQuery[0];
|
||||
$gast = $paarungQuery[1];
|
||||
$punkte = ps($name, $spieltag, $id);
|
||||
$result[]=["id"=>$id,"result"=>[$score1,$score2],"tipp"=>$tipp,"heim"=>$heim,"gast"=>$gast,"punkte"=>$punkte];
|
||||
}
|
||||
<?php
|
||||
include("../../mysqlverbinden.php");
|
||||
include("../rowforeach.php");
|
||||
|
||||
echo json_encode($result, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
|
||||
$ansichten=["spiel","user","user-preview"];
|
||||
|
||||
if(!isset($_GET["spieltag"])) die("GET spieltag fehlt");
|
||||
$spieltag=$_GET["spieltag"];
|
||||
|
||||
if(!isset($_GET["paarung"])) die("GET paarung fehlt");
|
||||
$paarungid=$_GET["paarung"];
|
||||
|
||||
if(!isset($_GET["detail"])) die("GET detail fehlt");
|
||||
$detail=$_GET["detail"];
|
||||
|
||||
if(!isset($_GET["name"])) die("GET name fehlt");
|
||||
$name=$_GET["name"];
|
||||
|
||||
if(!in_array($detail,$ansichten)) die("Ungültige Ansicht");
|
||||
|
||||
include("./inc.php");
|
||||
$paarungsql=srowforeach("SELECT heim, gast from `buli-paarungen` where `id`=?;",[$paarungid]);
|
||||
if(count($paarungsql)==0) $paarung=null;
|
||||
else $paarung=$paarungsql[0];
|
||||
if($detail=="spiel") $results=srowforeach("SELECT score1,score2 from `buli-results` where `paarung`=? AND `spieltag`=?;",[$paarungid,$spieltag])[0];
|
||||
if($detail=="spiel"){
|
||||
?>
|
||||
<h1 class="detailansichtSchriftart">Detailansicht, <?php echo $spieltag; ?>. Spieltag</h1>
|
||||
<h2 class="detailansichtSchriftart"><?php echo $paarung[0]; ?> - <?php echo $paarung[1]; ?></h2>
|
||||
<h1><?php echo $results[0]; ?> - <?php echo $results[1]; ?></h1>
|
||||
<table class="detailansichtSchriftart">
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Tipp</td>
|
||||
<td>Punkte</td>
|
||||
<td>Gesamtpunkte</td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach (rowforeach("SELECT `username` from `buli-user`;") as $key => $value) {
|
||||
$name=$value[0];
|
||||
$punkte=ps($name,$spieltag,$paarungid);
|
||||
$gesamtpunkte=gs($name,$spieltag);
|
||||
$tipp=getTipp($name,$spieltag,$paarungid);
|
||||
$tippstr=($tipp==null)?"-":$tipp[0]." - ".$tipp[1];
|
||||
?>
|
||||
|
||||
<tr>
|
||||
<td><?php echo $name; ?></td>
|
||||
<td><?php echo $tippstr; ?></td>
|
||||
<td><?php echo $punkte; ?></td>
|
||||
<td><?php echo $gesamtpunkte; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
|
||||
}
|
||||
?>
|
||||
|
||||
</table>
|
||||
<?php
|
||||
}else if($detail=="user"){
|
||||
?>
|
||||
<h1 class="detailansichtSchriftart">Detailansicht für <?php echo $name; ?>, <?php echo $spieltag; ?>. Spieltag</h1>
|
||||
<table class="detailansichtSchriftart">
|
||||
<tr>
|
||||
<td>Tipp von <?php echo $name; ?></td>
|
||||
<td>Ergebnis</td>
|
||||
<td>Tipp</td>
|
||||
<td>Punkte</td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach(srowforeach("SELECT paarung, score1, score2 from `buli-results` where spieltag=?;",[$spieltag]) as $key=>$value){
|
||||
$id=$value[0];
|
||||
$score1=$value[1];
|
||||
$score2=$value[2];
|
||||
$tipp=getTipp($name,$spieltag,$id);
|
||||
$paarungQuery=srowforeach("SELECT heim, gast from `buli-paarungen` where id=?;",[$id])[0];
|
||||
$heim=$paarungQuery[0];
|
||||
$gast=$paarungQuery[1];
|
||||
$punkte=ps($name,$spieltag,$id);
|
||||
$tippstr=($tipp==null)?"-":$tipp[0]." - ".$tipp[1];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $heim; ?> - <?php echo $gast; ?></td>
|
||||
<td><?php echo $score1; ?> - <?php echo $score2; ?></td>
|
||||
<td><?php echo $tippstr; ?></td>
|
||||
<td><?php echo $punkte; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
||||
<?php
|
||||
}else if($detail=="user-preview"){
|
||||
?>
|
||||
<h1 class="detailansichtSchriftart">Detailansicht für <?php echo $name; ?>, <?php echo $spieltag; ?>. Spieltag</h1>
|
||||
<table class="detailansichtSchriftart">
|
||||
<tr>
|
||||
<td>Paarung</td>
|
||||
<td>Tipp von <?php echo $name; ?></td>
|
||||
</tr>
|
||||
<?php
|
||||
foreach(srowforeach("SELECT `id`,`heim`,`gast` from `buli-paarungen` where spieltag=?;",[$spieltag]) as $key=>$value){
|
||||
$id=$value[0];
|
||||
$tipp=getTipp($name,$spieltag,$id);
|
||||
$heim=$value[1];
|
||||
$gast=$value[2];
|
||||
$tippstr=($tipp==null)?"-":$tipp[0]." - ".$tipp[1];
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $heim; ?> - <?php echo $gast; ?></td>
|
||||
<td><?php echo $tippstr; ?></td>
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -65,9 +65,10 @@ if ($responseData!=null) {
|
||||
|
||||
}
|
||||
|
||||
if($spieltag>=34){
|
||||
$spieltag=getmaxspieltag()+1;
|
||||
if(srowforeach("SELECT COUNT(*) from `buli-results` where spieltag=?;",[$spieltag-1])[0][0]<9) $spieltag--;
|
||||
|
||||
if($spieltag<=34){
|
||||
|
||||
$response = file_get_contents("https://api.openligadb.de/getmatchdata/bl".$bundesliga."/".$year."/".$spieltag, false);
|
||||
|
||||
|
||||
|
||||
@@ -12,6 +12,6 @@ if(count($userquery) == 0) die("User nicht gefunden");
|
||||
|
||||
$userid = $userquery[0][0];
|
||||
|
||||
if(count(srowforeach("SELECT id FROM `buli-tipps` WHERE user = ? AND spieltag=?",[$userid,5])) == 0) echo "false";
|
||||
if(count(srowforeach("SELECT id FROM `buli-tipps` WHERE user = ? AND spieltag=?",[$userid,$spieltag])) == 0) echo "false";
|
||||
else echo "true";
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ if(!isset($_GET["spieltag"])) die("GET spieltag fehlt");
|
||||
$spieltag=$_GET["spieltag"];
|
||||
|
||||
$data=[];
|
||||
foreach (srowforeach("SELECT `heim`,`gast` from `buli-paarungen` where `spieltag`=?;",[$spieltag]) as $key => $value) {
|
||||
array_push($data,[$value[0],$value[1]]);
|
||||
foreach (srowforeach("SELECT `heim`,`gast`, `id` from `buli-paarungen` where `spieltag`=?;",[$spieltag]) as $key => $value) {
|
||||
array_push($data,[$value[0],$value[1],$value[2]]);
|
||||
}
|
||||
|
||||
$result=["reload"=>$reload,"data"=>$data];
|
||||
|
||||
28
bulitipp/spieltag-user.php
Executable file
28
bulitipp/spieltag-user.php
Executable file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Content-Type: application/json");
|
||||
|
||||
include("./check.php");
|
||||
|
||||
if(!isset($_GET["user"])) die("GET user fehlt");
|
||||
$user = $_GET["user"];
|
||||
|
||||
if(!isset($_GET["spieltag"])) die("GET spieltag fehlt");
|
||||
$spieltag = $_GET["spieltag"];
|
||||
|
||||
$userquery=srowforeach("SELECT `username` FROM `buli-user` WHERE id = ?",[$user]);
|
||||
if(count($userquery) == 0) die("User nicht gefunden");
|
||||
|
||||
$username = $userquery[0][0];
|
||||
|
||||
$data=[];
|
||||
|
||||
foreach(srowforeach("SELECT `id`, `heim`, `gast` from `buli-paarungen` where `spieltag`=?;",[$spieltag]) as $key=>$value){
|
||||
$paarungsid = $value[0];
|
||||
$tipp = getTipp($username, $spieltag, $paarungsid);
|
||||
$result = getResult($paarungsid,$spieltag);
|
||||
array_push($data, ["tipp"=>$tipp, "result"=> $result, "paarung"=>["id"=>$paarungsid, "heim"=>$value[1], "gast"=>$value[2]]]);
|
||||
}
|
||||
|
||||
$result=["reload"=>$reload, "data"=>$data];
|
||||
echo json_encode($result, JSON_UNESCAPED_SLASHES|JSON_UNESCAPED_UNICODE);
|
||||
Reference in New Issue
Block a user