You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.3 KiB

10 years ago
<?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));
}
10 years ago
function printError($str) {
echo '<div class="alert alert-danger" role="alert">' . $str . '</div>';
}
10 years ago
function printSuccess($str) {
echo '<div class="alert alert-success" role="alert">' . $str . '</div>';
}
10 years ago
function isInstalled($bdd) {
$req = $bdd->prepare("SHOW TABLES LIKE 'admin'");
$req->execute();
10 years ago
if(!$req->fetch())
return false;
10 years ago
return true;
}
10 years ago
function hashPass($pass) {
return password_hash($pass, PASSWORD_DEFAULT);
}
10 years ago
function passEqual($pass, $hash) {
return password_verify($pass, $hash);
}
//login with LDAP
function loginLDAP($serverFQDN, $username, $password)
{
//connect to LDAP server or AD server. Both work
$ldap = ldap_connect($serverFQDN);
//check if user exists if works return true if not return false
if ($bind = ldap_bind($ldap, $username, $password))
{
return true;
}
else
{
return false;
}
}
?>