OpenVPN-Admin/include/functions.php

46 lines
945 B
PHP
Raw Normal View History

2015-07-09 14:26:07 +02:00
<?php
2017-02-05 17:03:00 +01:00
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));
}
2015-07-09 14:26:07 +02:00
function printError($str) {
echo '<div class="alert alert-danger" role="alert">' . $str . '</div>';
}
2015-07-09 14:26:07 +02:00
function printSuccess($str) {
echo '<div class="alert alert-success" role="alert">' . $str . '</div>';
}
2015-07-09 14:26:07 +02:00
function isInstalled($bdd) {
$req = $bdd->prepare("SHOW TABLES LIKE 'admin'");
$req->execute();
2015-07-09 14:26:07 +02:00
if(!$req->fetch())
return false;
2015-07-09 14:26:07 +02:00
return true;
}
2015-07-09 14:26:07 +02:00
function hashPass($pass) {
return password_hash($pass, PASSWORD_DEFAULT);
}
2015-07-09 14:26:07 +02:00
function passEqual($pass, $hash) {
return password_verify($pass, $hash);
}
?>