<?php
  $users = array("user1", "user2", "user3");
  $pass = array("pass1", "pass2", "pass3");

  if(isSet($_POST['user']) && isSet($_POST['haslo'])){
    foreach($users as $key => $val){
      if($_POST['user'] == $val && $_POST['haslo'] == $pass[$key]){
        header("Location: glowna.php");
        exit();
      }
    }
  }
?>

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>Moja strona WWW</title>
  </head>
  <body>
    <div>
      <form action = "http://localhost/index.php"
            method = "post">
        <table>
          <tr>
            <td>Użytkownik:</td>
            <td>
              <input type="text" name="user">
            </td>
          </tr><tr>
            <td>Hasło:</td>
            <td>
              <input type="password" name="haslo">
            </td>
          </tr><tr>
            <td colspan="2" style="text-align:center">
              <input type="submit" value="Wejdź">
            </td>
          </tr>
        </table>
      </form>
    </div>
  </body>
</html>
