-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
48 lines (42 loc) · 1.21 KB
/
index.php
File metadata and controls
48 lines (42 loc) · 1.21 KB
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
43
44
45
46
47
48
<?php
session_start();
ob_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Login</title>
</head>
<body>
<?php
if(!isset($_SESSION['login'])) {
if(isset($_POST['acao'])) {
$login = 'marcio';
$senha = '123';
$loginForm = $_POST['login'];
$senhaForm = $_POST['senha'];
if($login == $loginForm && $senha == $senhaForm) {
// Logado com sucesso
$_SESSION['login'] = $login;
header('Location: index.php');
exit();
} Else {
// Falha no login
$loginError = '<div class="invalid">Dados inválidos</div>';
}
}
include('login.php');
} else {
if(isset($_GET['logout'])) {
unset($_SESSION['login']);
session_destroy();
header('Location: index.php');
}
include('home.php');
}
?>
</body>
</html>