From 423f6ae383996f70a34072a81da4542cf443478d Mon Sep 17 00:00:00 2001 From: tp_dhu Date: Mon, 17 Feb 2025 01:25:42 +0000 Subject: [PATCH] gitignore --- .gitignore | 1 - public/test.php | 60 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c031f10..0b7fd76 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,4 @@ downloads/ app/.env.cfg public/tmp/ storage/ -/public/test.php public/test.php diff --git a/public/test.php b/public/test.php index 8a7e230..eb1d385 100644 --- a/public/test.php +++ b/public/test.php @@ -1,6 +1,62 @@ count($this->opinion), + 'size' => count($this->size), + 'age' => count($this->age), + 'shape' => count($this->shape), + 'color' => count($this->color), + 'origin' => count($this->origin), + 'material' => count($this->material), + 'purpose' => count($this->purpose), + 'noun' => count($this->noun), + ]; + // perform mixed-radix conversion + $order = ['noun', 'purpose', 'material', 'origin', 'color', 'shape', 'age', 'size', 'opinion']; + $digits = []; + foreach($order as $category){ + $radix = $bases[$category]; + $digits[$category] = $id % $radix; + $id = intdiv($id, $radix); + } + if($id > 0){ + throw new Exception("ID too large"); + } + + foreach($list as $k){ + $phrase[] = $this->$k[$digits[$k]]; + } + + return implode('-', $phrase); + } +} + +function generate(){ + $generator = new TicketPhraseGen(); + $ticket_number = 2; + $phrase = $generator->convert_id_to_phrase($ticket_number); + echo "Ticket #{$ticket_number} is {$phrase}"; +} + +generate(); + + +function password_test(){ + $password = "pass!local"; + echo password_hash($password, PASSWORD_DEFAULT); +}