rejestracja/index.php

43 lines
1.4 KiB
PHP

<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>srona głowna</title>
</head>
<body>
<?php
session_start();
$loginErr=$hasloErr=$daneErr="";
$login=$haslo="";
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
if (empty($_POST["login"])) {
$loginErr= "login jest wymagany";}
if (empty($_POST["haslo"])) {
$hasloErr= "haslo jest wymagane";}
if ($_POST["login"]=="pacjent"&& $_POST["haslo"]=="pacjent") header("Location: pacjent.php");
else if ($_POST["login"]=="lekarz"&& $_POST["haslo"]=="lekarz") header("Location: lekarz.php");
else if ($_POST["login"]=="recepcjonista"&& $_POST["haslo"]=="recepcjonista") header("Location: recepcjonista.php");
else $loginErr="nieprawidłowe dane";
}
?>
<form method="post" id="formularz1" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
<div id="logowanie">
Login: <input type="text" name="login" value="<?php echo $login;?>">
<span class="error"> <?php echo $loginErr;?></span>
<br><br>
Hasło: <input type="text" name="haslo" value="<?php echo $haslo;?>">
<span class="error"> <?php echo $hasloErr;?></span><br><br>
<input type="submit" name="submit" value="Submit"><br>
<span class="error"> <?php echo $daneErr;?></span><br>
</div>
</form>
</body>
</html>
<?php
?>