Commit
This commit is contained in:
parent
653bfd912f
commit
32a2de52f9
@ -14,7 +14,7 @@ class Team
|
||||
public string $company = 'NN';
|
||||
public string $cardnumber = 'NN';
|
||||
public string $leader = 'NN';
|
||||
public int $phone = 0;
|
||||
public string $phone = 'NN';
|
||||
public int $participants = 0;
|
||||
public int $rounds = 0;
|
||||
public ?int $bestTime = NULL;
|
||||
@ -79,9 +79,9 @@ class Team
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPhone(int $phone): Self
|
||||
public function setPhone(string $phone): Self
|
||||
{
|
||||
if ($this->longerThan((string)$phone, 32))
|
||||
if ($this->longerThan($phone, 20))
|
||||
{
|
||||
throw new InvalidArgumentException("Phone number is too long!");
|
||||
}
|
||||
@ -91,9 +91,9 @@ class Team
|
||||
|
||||
public function setParticipants(int $participants): Self
|
||||
{
|
||||
if ($this->longerThan((string)$participants, 32))
|
||||
if ($participants > 9999)
|
||||
{
|
||||
throw new InvalidArgumentException("Participants is too long!");
|
||||
throw new InvalidArgumentException("Too many participants!");
|
||||
}
|
||||
$this->participants = $participants;
|
||||
return $this;
|
||||
@ -101,9 +101,9 @@ class Team
|
||||
|
||||
public function setRounds(int $rounds): Self
|
||||
{
|
||||
if ($this->longerThan((string)$rounds, 32))
|
||||
if ($rounds > 9999)
|
||||
{
|
||||
throw new InvalidArgumentException("Rounds is too long!");
|
||||
throw new InvalidArgumentException("Too many rounds!");
|
||||
}
|
||||
$this->rounds = $rounds;
|
||||
return $this;
|
||||
|
@ -28,13 +28,13 @@
|
||||
|
||||
<label for="phone">Telefon:</label>
|
||||
<br>
|
||||
<input type="number" id="phone" name="phone" value="<?=htmlspecialchars($team->phone)?>" maxlength="32">
|
||||
<input id="phone" name="phone" value="<?=htmlspecialchars($team->phone)?>" maxlength="20">
|
||||
<br>
|
||||
|
||||
|
||||
<label for="participants">Deltagere:</label>
|
||||
<br>
|
||||
<input type="number" id="participants" name="participants" value="<?=htmlspecialchars($team->participants)?>" maxlength="32">
|
||||
<input type="number" id="participants" name="participants" value="<?=htmlspecialchars($team->participants)?>" max="9999">
|
||||
<br>
|
||||
|
||||
<br>
|
||||
|
@ -28,8 +28,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST')
|
||||
$company = filter_input(INPUT_POST, 'company');
|
||||
$cardnumber = filter_input(INPUT_POST, 'cardnumber');
|
||||
$leader = filter_input(INPUT_POST, 'leader');
|
||||
$phone = filter_input(INPUT_POST, 'phone', FILTER_VALIDATE_INT);
|
||||
$participants = filter_input(INPUT_POST, 'participants', FILTER_VALIDATE_INT);
|
||||
$phone = filter_input(INPUT_POST, 'phone');
|
||||
$participants = (int)filter_input(INPUT_POST, 'participants');
|
||||
|
||||
if (!isset($team))
|
||||
{
|
||||
|
Reference in New Issue
Block a user