浏览代码

Disable direct access to installer

ohartl 9 年之前
父节点
当前提交
c3c78de871
共有 10 个文件被更改,包括 61 次插入0 次删除
  1. 1 0
      installer/.htaccess
  2. 10 0
      installer/index.php
  3. 8 0
      installer/step0.php
  4. 6 0
      installer/step1.php
  5. 6 0
      installer/step2.php
  6. 6 0
      installer/step3.php
  7. 6 0
      installer/step4.php
  8. 6 0
      installer/step5.php
  9. 6 0
      installer/step6.php
  10. 6 0
      installer/step7.php

+ 1 - 0
installer/.htaccess

@@ -0,0 +1 @@
+Deny from all

+ 10 - 0
installer/index.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 define('INSTALLER_MAX_STEP', 6);
 
 define('INSTALLER_TYPE_CREATE', 0);
@@ -26,6 +32,8 @@ $installerStepMapping = array(
 	7 => 6,
 );
 
+/*-----------------------------------------------------------------------------*/
+
 function installer_reset()
 {
 	global $_SESSION;
@@ -78,6 +86,8 @@ if(!isset($_SESSION['installer'])){
 	installer_reset();
 }
 
+/*-----------------------------------------------------------------------------*/
+
 $step = (isset($_GET['step']) && is_numeric($_GET['step'])) ? intval($_GET['step']) : 0;
 
 echo '<h1>Installation of WebMUM</h1>';

+ 8 - 0
installer/step0.php

@@ -1,7 +1,14 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 0;
 
+/*-----------------------------------------------------------------------------*/
 
 $requirements = array();
 $numberOfRequirements = 5;
@@ -21,6 +28,7 @@ if(file_exists('config') && file_exists('config/config.php.example')){
 	$requirements[] = 'config_example';
 }
 
+/*-----------------------------------------------------------------------------*/
 
 if(isset($_GET['go']) && $_GET['go'] == 'next'){
 	if(count($requirements) === $numberOfRequirements){

+ 6 - 0
installer/step1.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 1;
 
 $error = null;

+ 6 - 0
installer/step2.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 2;
 
 /*-----------------------------------------------------------------------------*/

+ 6 - 0
installer/step3.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 3;
 
 if($_SESSION['installer']['lastStep'] > $thisStep){

+ 6 - 0
installer/step4.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 4;
 
 $error = null;

+ 6 - 0
installer/step5.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 5;
 
 $error = null;

+ 6 - 0
installer/step6.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 6;
 
 $error = null;

+ 6 - 0
installer/step7.php

@@ -1,5 +1,11 @@
 <?php
 
+if(strpos($_SERVER['REQUEST_URI'], 'installer/') !== false){
+	die('You cannot directly access the installer files.');
+}
+
+/*-----------------------------------------------------------------------------*/
+
 $thisStep = 7;
 
 $error = '';