rejestracja/index.php

63 lines
2.1 KiB
PHP
Raw Normal View History

2020-12-06 20:15:35 +01:00
<!DOCTYPE html>
<html>
<head>
2021-02-01 22:51:05 +01:00
<link rel="stylesheet" href="style.css">
2020-12-06 20:15:35 +01:00
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
</head>
<body>
<script type="text/javascript">
function logowanie(formularz)
{
2021-01-30 17:10:07 +01:00
/* login=formularz.login.value;
2020-12-06 20:15:35 +01:00
haslo=formularz.haslo.value;
if (login==""&&haslo=="")
alert("wprowadz dane");
else if (login=="a"){
window.location.replace("../rejestracja/pacjent.php");
}
else if (login=="b"){
window.location.replace("../rejestracja/recepcjonista.php");
}
else if (login=="c"){
window.location.replace("../rejestracja/lekarz.php");
2021-01-30 17:10:07 +01:00
}*/
2020-12-06 20:15:35 +01:00
}
</script>
2021-01-30 17:10:07 +01:00
<?php
$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");
if ($_POST["login"]=="lekarz"&& $_POST["haslo"]=="lekarz") header("Location: lekarz.php");
if ($_POST["login"]=="recepcjonista"&& $_POST["haslo"]=="recepcjonista") header("Location: recepcjonista.php");
else $daneErr="nieprawidłowe dane";
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
2021-02-01 22:51:05 +01:00
<div id="logowanie">
2021-01-30 17:10:07 +01:00
Login: <input type="text" name="login" value="<?php echo $login;?>">
2021-02-01 22:51:05 +01:00
<span class="error"> <?php echo $loginErr;?></span>
<br><br>
2021-01-30 17:10:07 +01:00
Hasło: <input type="text" name="haslo" value="<?php echo $haslo;?>">
2021-02-01 22:51:05 +01:00
<span class="error"> <?php echo $hasloErr;?></span><br><br>
2021-01-30 17:10:07 +01:00
<input type="submit" name="submit" value="Submit"><br>
<span class="error"> <?php echo $daneErr;?></span><br>
2021-02-01 22:51:05 +01:00
</div>
2021-01-30 17:10:07 +01:00
<?php print $login;
?>
<!--<input type="button" value="wyślij" onClick="logowanie(this.form)">
<input type="button" value="home" onClick="window.location.replace(\"../rejestracja/index.php\")">-->
2020-12-06 20:15:35 +01:00
</form>
</body>
</html>
<?php
?>