2. TLDs for Testing, & Documentation Examples define("PLACEHOLDER_IPV6", "2001:db8::3"); // From RFC3849: IPv6 Address Prefix Reserved for Documentation define("PLACEHOLDER_IPV4", "203.0.113.42"); // From RFC5737: IPv4 Address Blocks Reserved for Documentation if ($_SERVER['REQUEST_URI'] === '/sftpgo-auth.php') return; $pageAddress = substr($_SERVER['REQUEST_URI'], strlen(CONF['common']['prefix']) + 1); if (strpos($pageAddress, "?") !== false) { parse_str(substr($pageAddress, strpos($pageAddress, "?") + 1), $_GET); $pageAddress = substr($pageAddress, 0, strpos($pageAddress, "?")); } define("PAGE_URL", $pageAddress); define("PAGE_ADDRESS", $pageAddress . ((substr($pageAddress, -1) === '/' OR $pageAddress === '') ? 'index' : '')); define("PAGE_LINEAGE", explode('/', PAGE_ADDRESS)); define("SERVICE", dirname(PAGE_ADDRESS)); define("PAGE", basename(PAGE_ADDRESS, '.php')); require "pages.php"; if (PAGE !== 'index') { if (!isset(TITLES[SERVICE][PAGE])) { http_response_code(404); exit('Page not found.'); } if (SERVICE !== '.') { if (!isset(TITLES[SERVICE]['index'])) { http_response_code(404); exit('Page not found.'); } } } function getTitlesLineage($titles, $pageElements) { if (!isset($titles['index']) OR $pageElements[0] === 'index') return [$titles[$pageElements[0]]]; $result = $titles['index']; if (!isset($pageElements[1])) unset($titles['index']); else $titles = $titles[array_shift($pageElements)]; $results = getTitlesLineage($titles, $pageElements); $results[] = $result; return $results; } define('TITLES_LINEAGE', array_reverse(getTitlesLineage(TITLES, PAGE_LINEAGE))); if ( isset($_COOKIE['niver-session-key']) // Resume session OR (SERVICE === "auth" // Create new session AND (PAGE === "login" OR PAGE === "register") AND isset($_POST['username'])) ) { session_start([ 'name' => 'niver-session-key', 'sid_length' => 64, 'sid_bits_per_character' => 6, 'cookie_secure' => true, 'cookie_httponly' => true, 'cookie_samesite' => 'Strict', 'cookie_path' => CONF['common']['prefix'] . '/', 'cookie_lifetime' => 432000, // = 60*60*24*5 = 5 days 'gc_maxlifetime' => 10800, 'use_strict_mode' => true, 'use_cookies' => true, 'use_only_cookies' => true, ]); } ?> > <?php foreach(array_reverse(TITLES_LINEAGE) as $id => $title) echo strip_tags($title) . (array_key_last(TITLES_LINEAGE) === $id ? '' : ' < '); ?> ' . "\n"; ?>

🆔 /auth/logout'>Se déconnecter Anonyme Se connecter

CSRF verification failed ! (Wrong or unset Sec-Fetch-Site HTTP header)"); function executePage() { require "pages/" . PAGE_ADDRESS . ".php"; global $final_message; echo $final_message ?? ''; ?>