Contributed by: ivy on 2025/09/16 13:10 JST
Last modified on 2025/09/16 13:13 JST
siteconfig,phpに追加して、管理者だけにデバッグメッセージを表示します。
編集者、開発者をそれぞれIP登録します。 
[code]
/**
 * Access control based on IP address
 *
 * - Developers (in $allowed_admin): Enable rootdebug and template_comments
 * - Editors (in $allowed): Enable template_comments only
 * - Other users:
 *      - If maintenance page is set, show it and exit
 *      - If accessing restricted paths, return 403 Forbidden
 */
// Editor
$allowed = [
    '119.11.11.116',
    '119.92.4.24'
];
// Admin
$allowed_admin = [
    '119.29.14.30'
];
// Restricted path
$restricted = [
    '/admin/',
    '/users.php'
];
// Get user IP
$user_ip = $_SERVER['REMOTE_ADDR'];
// Developer check (first priority)
if (in_array($user_ip, $allowed_admin)) {
    $_CONF['rootdebug'] = true;
    return;
}
// Editor check
if (in_array($user_ip, $allowed)) {
    return;
}
// Default settings (disabled)
$_CONF['rootdebug'] = false;         // Disable developer mode
$_CONF['template_comments'] = false; // Disable template comments
// Restricted paths check
foreach ($restricted as $path) {
    if (strpos($_SERVER['REQUEST_URI'], $path) !== false) {
        header('HTTP/1.1 403 Forbidden');
        exit;
    }
}
[/code]