Guest User

Untitled

a guest
Jul 15th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.71 KB | None | 0 0
  1. <?php
  2.     // A Simple List of allowed users
  3.     // You could substitute this code with a database connection
  4.     $allowedUsers =  array ("test" => "test",
  5.                             "smartfox" => "smartfox",
  6.                             "flash" => "flash");
  7.    
  8.     // The response variable
  9.     $res = "res=KO";
  10.  
  11.  
  12.     // Check incoming data
  13.     if ($_POST['name'] != "" && $_POST['pass'] != "")
  14.  
  15.     {
  16.         foreach($allowedUsers as $name => $password)
  17.         {
  18.             if ($_POST['name'] == $name && $_POST['pass'] == $password)
  19.  
  20.             {
  21.                 // Ok, user found
  22.                 $res = "res=OK";
  23.                 break;
  24.             }
  25.         }
  26.     }
  27.    
  28.     print $res;
  29. ?>
Add Comment
Please, Sign In to add comment