Advertisement
cafreak

checkLogin.php #1 [Mike M. tutorial]

Aug 17th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.67 KB | None | 0 0
  1. <?php
  2.  
  3.     @$getWarningID = strip_tags($_GET['id']);
  4.     $warnings = false;
  5.    
  6.     switch($getWarningID){
  7.         case 1:  //wrong username + password combination
  8.             $warning = "Wrong Username and/or Password!";
  9.             break;
  10.         case 2: //username is not found
  11.             $warning = "The filled in username is not found!";
  12.             break;
  13.         case 3: //username and/or password might be empty
  14.             $warning = "Username and/or Password not filled in!";
  15.             break;
  16.         case 4: //username is not alphanumeric OR haven't got the correct length
  17.             $warning = "Username has the incorrect length and it only allows ALPHANUMERIC characters!";
  18.             break;
  19.         case 5: //password haven't got the correct length, or does not contact a-z A-Z 0-9 ! @ # $ % ^ & *
  20.             $warning = "Password has the incorrect length or the password doesn't match the allowed characters<br />\n<strong>a-z A-Z 0-9 ! @ # $ % ^ & *</strong>";
  21.             break;
  22.         default:  //there is no warning
  23.             //$warning = "none";
  24.             unset($warning);
  25.             break;
  26.     }
  27.    
  28.     if(!empty($getWarningID) && !empty($warning)){
  29.     ?>
  30.     <p>
  31.         <strong>WARNING!:</strong><br/>
  32.         <?php
  33.             echo($warning);
  34.         ?>
  35.     </p>
  36.     <hr>
  37.     <?php
  38.     }
  39.     ?>
  40.    
  41.     <p>
  42.         <form action="doLogin.php" method="POST">
  43.             Username: <input type="username" name="username" value="" /><br />
  44.             Password: <input type="password" name="password" value="" />
  45.             <input type="submit" name="login" value="Login" /><br />
  46.             <strong>-=Passwords may only contain the following=-</strong>
  47.             <ul>
  48.                 <li>Minimal of 6 Characters!</li>
  49.                 <li>Maximum of 20 Characters!</li>
  50.                 <li>Lowercase and/or Uppercase alphabetic Characters</li>
  51.                 <li>The following special characters: ! @ # $ % ^ & *</li>
  52.             </ul>
  53.         </form>
  54.     </p>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement