From 19218d758d4fc0f8f5db5a97eb9dcfdb5086f844 Mon Sep 17 00:00:00 2001 From: Maksymilian Jopek Date: Sat, 25 Feb 2023 19:06:54 +0100 Subject: Remove path from repo Add start script --- api/remove.php | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'api/remove.php') diff --git a/api/remove.php b/api/remove.php index 65f1a82..0ef23e5 100644 --- a/api/remove.php +++ b/api/remove.php @@ -1,10 +1,11 @@ query('//game[@id="' . $id . '"]')->item(0); $game->parentNode->removeChild($game); $count = $doc->getElementsByTagName("count")->item(0); -$count->nodeValue = intval($count->nodeValue) - 1; +$icount = intval($count->nodeValue) - 1; +$count->nodeValue = $icount; + + +[$data, $_] = get_data(); +$i = 1; +foreach($data as $d) { + if($d["id"] === $id) continue; + $g = $xpath->query('//game[@id="' . $d["id"] . '"]')->item(0); + var_dump('//game[@id="' . $d["id"] . '"]'); + $g->setAttribute("order", $i); + $i++; +} $doc->save($path); header("Location: " . $_SERVER["HTTP_REFERER"]); + -- cgit v1.3.1