Order Allow,Deny
Deny from all
# Block direct access to class files
RewriteEngine On
RewriteRule ^classes/ - [F,L]
# Security headers (if mod_headers available)
Click buttons to automatically fix common issues:
PHP Version: " . phpversion() . "
"; if (version_compare(PHP_VERSION, '7.2.0', '<')) { echo "WARNING: PHP 7.2+ required!
"; } else { echo "OK: PHP version is compatible
"; } // Required extensions echo "OK: {$ext}
"; } else { echo "MISSING: {$ext}
"; } } // BCMath (for base58 decoding) echo ""; if (function_exists('bcmul')) { echo "OK: bcmath"; } else { echo "WARNING: bcmath not available (short URLs won't work)"; } echo "
"; // Password algorithms echo "OK: Argon2ID available
"; } else { echo "INFO: Argon2ID not available, using bcrypt (OK)
"; } // Config file echo "OK: config.php exists
"; try { $config = require __DIR__ . '/config.php'; echo "OK: config.php is valid PHP
"; if (!empty($config['flickr']['api_key'])) { echo "OK: Flickr API key set
"; } else { echo "INFO: Flickr API key not set
"; } if (!empty($config['telegram']['bot_token'])) { echo "OK: Telegram bot token set
"; } else { echo "INFO: Telegram bot token not set
"; } } catch (Throwable $e) { echo "ERROR in config.php: " . htmlspecialchars($e->getMessage()) . "
"; } } else { echo "MISSING: config.php — use Quick Fix above!
"; } // Writable directories echo "OK: Root directory is writable
"; } else { echo "ERROR: Root directory is not writable (needed for auth_config.php)
"; } // Test class loading echo "OK: {$class}
"; } else { echo "ERROR: {$class} - file loaded but class not found
"; } } catch (Throwable $e) { echo "ERROR loading {$class}: " . htmlspecialchars($e->getMessage()) . "
"; echo "" . htmlspecialchars($e->getTraceAsString()) . ""; } } else { echo "
MISSING: {$file}
"; } } // Test Auth instantiation echo "OK: Auth class instantiated
"; if ($auth->hasUsers()) { echo "OK: Users exist, login page should work
"; } else { echo "INFO: No users yet, setup.php should appear
"; } } catch (Throwable $e) { echo "ERROR: " . htmlspecialchars($e->getMessage()) . "
"; echo "" . htmlspecialchars($e->getTraceAsString()) . ""; } // Security checks echo "
OK: HTTPS enabled
"; } else { echo "WARNING: HTTPS not detected (recommended for production)
"; } // .htaccess exists if (file_exists(__DIR__ . '/.htaccess')) { echo "OK: .htaccess exists
"; } else { echo "WARNING: .htaccess missing — use Quick Fix above!
"; } // ========== LEAK DETECTION ========== echo "OK: {$file} is protected (HTTP {$httpCode})
"; } elseif ($httpCode == 200) { // Check if content contains sensitive data $hasSensitiveData = false; if (strpos($content, 'api_key') !== false || strpos($content, 'api_secret') !== false || strpos($content, 'bot_token') !== false || strpos($content, 'password_hash') !== false || strpos($content, 'password') !== false) { $hasSensitiveData = true; } if ($hasSensitiveData) { echo "CRITICAL LEAK: {$file} is ACCESSIBLE and contains sensitive data! ({$desc})
"; $leaksFound++; } else { echo "WARNING: {$file} is accessible (HTTP 200) - {$desc}
"; } } else { echo "INFO: {$file} returned HTTP {$httpCode}
"; } } // Check for common info disclosure files echo "WARNING: {$file} exists - consider removing ({$desc})
"; } } // Check if secrets are exposed in JS files echo "DANGER: {$file} may contain: " . implode(', ', $foundSecrets) . "
"; $leaksFound++; } else { echo "OK: {$file} - no secrets found
"; } } } // Check config.php for exposed secrets (verify it's not outputting) if (file_exists(__DIR__ . '/config.php')) { $configContent = file_get_contents(__DIR__ . '/config.php'); // Check if config has echo/print statements if (preg_match('/(echo|print|var_dump|print_r)\s*\(/i', $configContent)) { echo "DANGER: config.php contains output statements!
"; $leaksFound++; } else { echo "OK: config.php has no output statements
"; } // Check if config returns array (proper format) if (strpos($configContent, 'return') !== false) { echo "OK: config.php uses return statement (good)
"; } else { echo "WARNING: config.php may not return array properly
"; } } // Summary if ($leaksFound > 0) { echo "Use Quick Fix buttons above or manually fix the issues.
"; echo "No critical leaks detected.
"; } // File permissions echo "WARNING: {$file} is world-readable ({$perms}), recommended: {$recommended}
"; } else { echo "OK: {$file} permissions: {$perms}
"; } } } // PHP security settings echo "These are hosting settings - may not be changeable on shared hosting
"; $securitySettings = array( 'expose_php' => array('recommended' => '0', 'desc' => 'Hide PHP version'), 'display_errors' => array('recommended' => '0', 'desc' => 'Hide errors in production'), 'allow_url_include' => array('recommended' => '0', 'desc' => 'Prevent remote file inclusion'), 'session.cookie_httponly' => array('recommended' => '1', 'desc' => 'Protect session cookie'), 'session.cookie_secure' => array('recommended' => '1', 'desc' => 'HTTPS-only cookies'), 'session.use_strict_mode' => array('recommended' => '1', 'desc' => 'Strict session mode'), ); foreach ($securitySettings as $setting => $info) { $value = ini_get($setting); $valueStr = ($value === '' || $value === '0' || $value === false) ? '0' : '1'; if ($valueStr === $info['recommended']) { echo "OK: {$setting} = {$valueStr} ({$info['desc']})
"; } else { echo "INFO: {$setting} = {$valueStr}, recommended: {$info['recommended']} ({$info['desc']})
"; } } // Cryptographic Functions echo "OK: random_bytes() works
"; } catch (Exception $e) { echo "ERROR: random_bytes() failed
"; } } else { echo "WARNING: random_bytes() not available
"; } if (function_exists('openssl_random_pseudo_bytes')) { echo "OK: openssl_random_pseudo_bytes() available
"; } else { echo "WARNING: openssl_random_pseudo_bytes() not available
"; } if (function_exists('password_hash')) { echo "OK: password_hash() available
"; } else { echo "ERROR: password_hash() not available!
"; } // Server info (be careful not to expose too much) echo "Server software: " . htmlspecialchars(isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : 'Unknown') . "
Document root: " . htmlspecialchars(isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : 'Unknown') . "
Script path: " . htmlspecialchars(__DIR__) . "
If all green: Use 'Delete debug.php & Go to Site' button above
"; echo "If errors: Use Quick Fix buttons, then refresh this page
"; echo "IMPORTANT: Delete this file after debugging!
"; ?>