Browse Source

Safer calling of `install.php` (#7971)

To prevent `install.php` from being accessed in unintended places
Inverle 6 months ago
parent
commit
25250f46b4
1 changed files with 5 additions and 0 deletions
  1. 5 0
      app/install.php

+ 5 - 0
app/install.php

@@ -1,6 +1,11 @@
 <?php
 <?php
 declare(strict_types=1);
 declare(strict_types=1);
 
 
+if (isset($_SESSION) || basename(is_string($_SERVER['SCRIPT_NAME']) ? $_SERVER['SCRIPT_NAME'] : '') !== 'index.php') {
+	header('HTTP/1.1 403 Forbidden');
+	exit('Forbidden');
+}
+
 if (function_exists('opcache_reset')) {
 if (function_exists('opcache_reset')) {
 	opcache_reset();
 	opcache_reset();
 }
 }