OpenVPN-Admin/include/functions.php
2017-02-05 17:07:56 +01:00

46 lines
945 B
PHP

<?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);
}
?>