2022-05-19 14:59:32 +00:00
|
|
|
<?php
|
|
|
|
|
2022-05-19 22:15:13 +00:00
|
|
|
define("CONF", parse_ini_file(__DIR__ . "/../config.ini", true, INI_SCANNER_TYPED));
|
|
|
|
|
|
|
|
define("SERVICE", substr(dirname($_SERVER['PHP_SELF']), strlen(CONF['common']['prefix']) + 1));
|
2022-05-19 14:59:32 +00:00
|
|
|
define("PAGE", basename($_SERVER['PHP_SELF'], '.php'));
|
2022-05-19 22:15:13 +00:00
|
|
|
define("DB_PATH", CONF['common']['root_path'] . "/db/niver.db"); // Niver's SQLite database
|
2022-05-19 14:59:32 +00:00
|
|
|
|
|
|
|
// Service-specific functions and constants
|
|
|
|
if (SERVICE === "reg" OR SERVICE === "ns")
|
2022-05-19 22:15:13 +00:00
|
|
|
require CONF['common']['root_path'] . "/dns.php";
|
2022-05-19 14:59:32 +00:00
|
|
|
if (SERVICE !== "")
|
2022-05-19 22:15:13 +00:00
|
|
|
require CONF['common']['root_path'] . "/" . SERVICE . ".php";
|
2022-05-19 14:59:32 +00:00
|
|
|
|
|
|
|
// Page titles definition
|
|
|
|
require "pages.php";
|
2022-05-20 00:19:45 +00:00
|
|
|
|
|
|
|
function userError($msg) {
|
|
|
|
http_response_code(422);
|
|
|
|
exit("<strong>User error<strong>: The server refused to process this request: <em>" . $msg . "</em>");
|
|
|
|
}
|
|
|
|
|
|
|
|
function serverError($msg) {
|
|
|
|
http_response_code(500);
|
|
|
|
exit("<strong>Server error<strong>: The server encountered an error: <em>" . $msg . "</em>");
|
|
|
|
}
|