-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreinit.php
40 lines (33 loc) · 978 Bytes
/
preinit.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
<?php
if (file_exists('./config.php' )){
require './config.php';
} else {
require './../config.php';
}
// DB Connection init
$link = mysqli_connect($db_server, $db_user, $db_password, $db_database);
if(!$link){
print('<div align="center">Проблемы с подключением к базе! Пните админа! )))</div>');
}
session_start();
// Login scheme
if (isset($_POST['mpass'])) {
$hash = password_hash($master, PASSWORD_DEFAULT);
if (password_verify($_POST['mpass'], $hash)) {
//print('alert("Пароль ок!");');
SetCookie("ponygalai_admin", "true");
$_SESSION['admin'] = true;
} else {
print('');
}
}
if ( isset($_COOKIE['ponygalai_admin']) ){
$_SESSION['admin'] = true;
//print('admin on');
}
if (isset($_GET['logout'])) {
unset($_SESSION['admin']);
SetCookie("ponygalai_admin", "");
header('Location: index.php');
}
// Login Scheme END