-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin.php
More file actions
29 lines (29 loc) · 754 Bytes
/
admin.php
File metadata and controls
29 lines (29 loc) · 754 Bytes
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
<?php
session_start();
$auth == false;
include_once 'datebase.php';
if (isset($_POST['ubmit'])) {
$e_login = htmlspecialchars($_POST['login']);
$e_password = htmlspecialchars(md5($_POST['password']));
$query = $pdo->prepare("SELECT pass FROM auth WHERE login=?");
$query->bindParam(1, $e_login, PDO::PARAM_STR);
$query->execute();
$user_pass = $query->fetch();
if (md5($user_pass[0]) == $e_password) {
session_start();
$_SESSION ['name'] = $e_login;
$incorrect = False;
} else {
$incorrect = True;
}
}
if (isset($_POST['logout'])) {
unset ($_SESSION['name']);
session_destroy();
}
if (isset($_SESSION ['name'])) {
header('location:adminroom.php');
exit;
} else {
include '/template/template6.html';
}