From 9ae8415875e633a5855f22caffac058eed741cc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Bos=C3=A1k?= <85733005+wodosharlatan@users.noreply.github.com> Date: Mon, 27 Mar 2023 08:44:20 +0200 Subject: [PATCH] Update CreateTokens.php --- dbOperations/CreateTokens.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dbOperations/CreateTokens.php b/dbOperations/CreateTokens.php index de19de2..c601e82 100644 --- a/dbOperations/CreateTokens.php +++ b/dbOperations/CreateTokens.php @@ -15,11 +15,12 @@ $userNameArrayLenght = count($userNameArray); for ($i = 0; $i < $userNameArrayLenght; $i++){ $token = rand(100000,9999999); - $insertToken = "INSERT INTO `$dataBaseName`.`TokenTable` (`UserName`,`Token`) VALUES ('" . $userNameArray[$i] ."','". $token . "')"; + $validatedName = trim($userNameArray[$i]); + $insertToken = "INSERT INTO `$dataBaseName`.`TokenTable` (`UserName`,`Token`) VALUES ('" . $validatedName ."','". $token . "')"; if(mysqli_query($connection, $insertToken)){ $x++; } } print("Inserted " . $x ." users with tokens into Token Table!"); -?> \ No newline at end of file +?>