Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- declare(strict_types=1);
- $users = [
- 'names' => [
- 'janusz',
- 'admin'
- ],
- 'wallets' => [
- 500,
- 200
- ],
- 'passwords' => [
- 'haslo',//haslo janusza
- 'admin'//haslo admina
- ]
- ];
- $login = 'somsiad';
- $password = 'haslo';
- helloUser($login, $password);
- function helloUser(string $login, string $password)
- {
- global $users;
- $userId = array_search($login, $users['names'], true);
- if (in_array(strtolower($login), $users['names'], true) and $password === $users['passwords'][$userId]) {
- echo 'Witaj ' . $login . ', w twoim portfelu jest ' . $users['wallets'][$userId] . ' zł!';
- } else {
- echo 'Zły login lub hasło';
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement