Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $user = readline();
- $counter = 0;
- $reverseUser = strrev($user);
- while (true) {
- $password = readline();
- if ($password == $reverseUser) {
- echo "User $user logged in.";
- break;
- }
- if ($password != $reverseUser && $counter <= 3) {
- echo 'Incorrect password. Try again.' . PHP_EOL;
- $counter++;
- }
- if ($counter > 3) {
- echo "User $user blocked!";
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement