forked from Chocobozzz/OpenVPN-Admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfunctions.php
45 lines (34 loc) · 945 Bytes
/
functions.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
43
44
45
<?php
function getMigrationSchemas() {
return [ 0, 5 ];
}
function updateSchema($bdd, $newKey) {
if ($newKey === 0) {
$req_string = 'INSERT INTO `application` (sql_schema) VALUES (?)';
}
else {
$req_string = 'UPDATE `application` SET `sql_schema` = ?';
}
$req = $bdd->prepare($req_string);
$req->execute(array($newKey));
}
function printError($str) {
echo '<div class="alert alert-danger" role="alert">' . $str . '</div>';
}
function printSuccess($str) {
echo '<div class="alert alert-success" role="alert">' . $str . '</div>';
}
function isInstalled($bdd) {
$req = $bdd->prepare("SHOW TABLES LIKE 'admin'");
$req->execute();
if(!$req->fetch())
return false;
return true;
}
function hashPass($pass) {
return password_hash($pass, PASSWORD_DEFAULT);
}
function passEqual($pass, $hash) {
return password_verify($pass, $hash);
}
?>