X-Git-Url: https://git.auder.net/?p=westcastle.git;a=blobdiff_plain;f=scripts%2Frw_players.php;h=de63ad6a91f304ffe504b11ea06b22cbc2e4b081;hp=b5bdabcb0a178baf828d25fbf35990de28c6ddf9;hb=1369a09d4b3a4d3c3d19b68197a311fbb7ec97f4;hpb=ade10194c01dcf4a71fc92f055d5dc53ac555e0e diff --git a/scripts/rw_players.php b/scripts/rw_players.php index b5bdabc..de63ad6 100644 --- a/scripts/rw_players.php +++ b/scripts/rw_players.php @@ -2,6 +2,12 @@ if (!isset($_POST["players"])) { + if (isset($_GET["restore"]) && $_GET["restore"]) + { + // Restore backup + if (!rename("../joueurs.csv.bak", "../joueurs.csv")) + exit("[]"); + } // Retrieve all players $handle = fopen("../joueurs.csv", "r"); $players = []; @@ -23,6 +29,7 @@ if (!isset($_POST["players"])) } else { + copy("../joueurs.csv", "../joueurs.csv.bak"); //backup current checkpoint // Write header + all players $handle = fopen("../joueurs.csv", "w"); fputcsv($handle, ["prenom","nom","pdt","session","present"]);