From a23b8504c627a94b5691b1c763ef198639322248 Mon Sep 17 00:00:00 2001 From: Benjamin Kraft Date: Fri, 14 Jun 2024 10:19:48 +0200 Subject: [PATCH] script to update all puuids, useful when changing api key --- public/elotracker/update_puuid.php | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 public/elotracker/update_puuid.php diff --git a/public/elotracker/update_puuid.php b/public/elotracker/update_puuid.php new file mode 100644 index 0000000..bad514d --- /dev/null +++ b/public/elotracker/update_puuid.php @@ -0,0 +1,24 @@ +query("SELECT * FROM accounts")->fetch_all(MYSQLI_ASSOC); + +foreach ($accounts as $currentAccount) { + $gameName = $currentAccount["gameName"]; + $tagLine = $currentAccount["tagLine"]; + $request = new RiotRequest("riot/account/v1/accounts/by-riot-id/$gameName/$tagLine"); + $request->useRouting(); + $fetchedAccount = $request->run(); + + if ($request->responseCode === 200){ + $conn->prepare(" + UPDATE accounts + SET puuid = ? + WHERE puuid = ? + ")->execute([$fetchedAccount->puuid, $currentAccount["puuid"]]); + } +} \ No newline at end of file