Advertisement
MartinGeorgiev

05. Login

Jan 29th, 2019
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.37 KB | None | 0 0
  1. <?php
  2.  
  3. $username = readline();
  4. $pass = strrev($username);
  5.  
  6. for ($i = 0; $i <= 3; $i++) {
  7.     $input = readline();
  8.     if ($pass == $input) {
  9.         echo "User $username logged in." . PHP_EOL;
  10.         break;
  11.     } else if ($i == 3) {
  12.         echo "User $username blocked!" . PHP_EOL;
  13.     } else {
  14.         echo "Incorrect password. Try again." . PHP_EOL;
  15.     }
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement