Initial git commit for OpenLog beginning with v5.2.4.
This commit is contained in:
61
distfiles/settings.php
Normal file
61
distfiles/settings.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/*
|
||||
settings.php
|
||||
OpenLog Online Logbook
|
||||
Copyright (C) 2025 Rod Wright
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0
|
||||
*/
|
||||
|
||||
$sttl=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"session_ttl_days\""))[0];
|
||||
$ostype=strtoupper(substr(php_uname('s'), 0, 3));
|
||||
if ($ostype == 'WIN') {
|
||||
$sdir=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"win_server_session_dir\""))[0];
|
||||
} else {
|
||||
$sdir=mysqli_fetch_row(mysqli_query($db,"select confvalue from configs where confname=\"unix_server_session_dir\""))[0];
|
||||
}
|
||||
$lifetime=60 * 60 * 24 * $sttl;
|
||||
if (!is_dir($sdir)) mkdir($sdir, 0700, true);
|
||||
ini_set('session.cookie_lifetime', $lifetime);
|
||||
ini_set('session.gc_maxlifetime', $lifetime);
|
||||
ini_set('session.save_path', $sdir);
|
||||
|
||||
$ss=session_status();
|
||||
if ($ss==PHP_SESSION_NONE) session_start();
|
||||
|
||||
// get config options from database and assign them to constants
|
||||
unset($techid);
|
||||
if (isset($_SESSION['login']) && $_SESSION['login'] != '') {
|
||||
$techid=$_SESSION['login'];
|
||||
}
|
||||
|
||||
$configqry=mysqli_query($db,"select confname,confvalue,confid from configs");
|
||||
while ($configrow = mysqli_fetch_assoc($configqry)) {
|
||||
$constname=strtoupper($configrow["confname"]);
|
||||
if (isset($techid)) {
|
||||
$confid=$configrow["confid"];
|
||||
$custqry=mysqli_query($db,"select customconfvalue from customs where customconfnum=\"$confid\" and customtech=\"$techid\"");
|
||||
if (mysqli_num_rows($custqry)) {
|
||||
$custrow=mysqli_fetch_row($custqry);
|
||||
$custval=$custrow[0];
|
||||
} else {
|
||||
unset($custval);
|
||||
}
|
||||
}
|
||||
if (isset($custval)) {
|
||||
$constvalue=$custval;
|
||||
} else {
|
||||
$constvalue=$configrow["confvalue"];
|
||||
}
|
||||
define("$constname","$constvalue");
|
||||
}
|
||||
|
||||
// error reporting
|
||||
$logerrors=LOG_ERRORS;
|
||||
if ($logerrors==1) {
|
||||
error_reporting(E_ALL);
|
||||
} else {
|
||||
error_reporting(0);
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user