From 4d5f50109c6255f7ae365be4ff3aa16b90d9a302 Mon Sep 17 00:00:00 2001 From: Gregory Trolliet Date: Thu, 26 Nov 2020 17:10:20 +0100 Subject: [PATCH] Set the max try for code generation as a constant --- db.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/db.php b/db.php index 6063d7d..8868b4f 100644 --- a/db.php +++ b/db.php @@ -14,6 +14,7 @@ class DataBase const DEFAULT_SIZE = 3; const MAX_SIZE = 9; const CLOUD_CODE_LENGTH = 6; + const CLOUD_CODE_MAXTRY = 10; private $db; private $cloud; @@ -217,10 +218,10 @@ class DataBase $duration = self::DEFAULT_DURATION; } - for ($i = 0; $i < 10; $i++) { + for ($i = 0; $i < self::CLOUD_CODE_MAXTRY; $i++) { $code = bin2hex(random_bytes(self::CLOUD_CODE_LENGTH)); + $code = '2ae606bfb6d2'; if (!$this->loadCloudByCode($code)) { - echo 'LOAD CLOUD'; break; } }