mirror of
https://github.com/tuxis-ie/nsedit.git
synced 2025-04-19 20:09:14 +03:00
Show a clear message instead of ERROR 500
This commit is contained in:
parent
23b9fe2c54
commit
9407c92a6a
1 changed files with 12 additions and 7 deletions
|
@ -59,13 +59,18 @@ if (function_exists('openssl_random_pseudo_bytes') === FALSE) {
|
|||
|
||||
$defaults['defaulttype'] = ucfirst(strtolower($defaults['defaulttype']));
|
||||
|
||||
if (isset($authdb) && !file_exists($authdb) && class_exists('SQLite3')) {
|
||||
is_dir(dirname($authdb)) || mkdir(dirname($authdb));
|
||||
$db = new SQLite3($authdb, SQLITE3_OPEN_CREATE|SQLITE3_OPEN_READWRITE);
|
||||
$createsql = file_get_contents('includes/scheme.sql');
|
||||
$db->exec($createsql);
|
||||
$salt = bin2hex(openssl_random_pseudo_bytes(16));
|
||||
$db->exec("INSERT INTO users (emailaddress, password, isadmin) VALUES ('admin', '".crypt("admin", '$6$'.$salt)."', 1)");
|
||||
try {
|
||||
if (isset($authdb) && !file_exists($authdb) && class_exists('SQLite3')) {
|
||||
is_dir(dirname($authdb)) || mkdir(dirname($authdb));
|
||||
$db = new SQLite3($authdb, SQLITE3_OPEN_CREATE|SQLITE3_OPEN_READWRITE);
|
||||
$createsql = file_get_contents('includes/scheme.sql');
|
||||
$db->exec($createsql);
|
||||
$salt = bin2hex(openssl_random_pseudo_bytes(16));
|
||||
$db->exec("INSERT INTO users (emailaddress, password, isadmin) VALUES ('admin', '".crypt("admin", '$6$'.$salt)."', 1)");
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
print("We have issues getting the authdb working: $e");
|
||||
$blocklogin = TRUE;
|
||||
}
|
||||
|
||||
function string_starts_with($string, $prefix)
|
||||
|
|
Loading…
Add table
Reference in a new issue