-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
42 lines (31 loc) · 1 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php include 'partials/header.php'; ?>
<?php if ($_POST) : ?>
<?php
if (!isset($_SESSION)) {
session_start();
}
if (isset($_POST['password']) && $_POST['password'] == '123' and ($_POST['user']) && $_POST['user'] == 'admin'){
$_SESSION['valida'] = 1;
header('Location: create.php');
}
if ($_SESSION['valida'] != 1) {
echo '<br><br><center><h1>ACESSO NEGADO!</h1></center>';
unset($_SESSION['valida']);
exit();
}
if (isset($_GET['logout']) && $_GET['logout'] == 'ok') {
unset($_SESSION['valida']);
session_destroy();
exit();
}
?>
<?php else : ?>
<title>PoS</title>
<h1>Faça Login</h1>
<form action="<?php $_SERVER["PHP_SELF"] ?>" method="POST">
Usuário: <br><input type="text" name="user"><br><br>
Senha: <br><input type="password" name="password"><br><br>
<button type="submit">Acessar</button><br><br>
</form>
<?php endif; ?>
<?php include 'partials/footer.php'; ?>