Browse code

install/install.php: re-implement config.php setup from eFiction 3.5.72

Clarissa Walker authored on 2026/10/30 14:30:53
Showing 1 changed files
... ...
@@ -994,13 +994,13 @@ switch ($_GET['step'])
994 994
 
995 995
 		if (isset($_POST['submit']))
996 996
 		{
997
-			$dbhost = descript($_POST['dbhost']);
998
-			$dbname = descript($_POST['dbname']);
999
-			$dbuser = descript($_POST['dbuser']);
1000
-			$dbpass = descript($_POST['dbpass']);
997
+			$dbhost = descript(trim($_POST['dbhost']));
998
+			$dbname = descript(trim($_POST['dbname']));
999
+			$dbuser = descript(trim($_POST['dbuser']));
1000
+			$dbpass = $_POST['dbpass'];
1001 1001
 			$language = $_POST['language'];
1002
-			$sitekey = descript($_POST['sitekey']);
1003
-			$settingsprefix = descript($_POST['settingsprefix']);
1002
+			$sitekey = descript(trim($_POST['sitekey']));
1003
+			$settingsprefix = descript(trim($_POST['settingsprefix']));
1004 1004
 			$mysqli_access = @mysqli_connect($dbhost, $dbuser,$dbpass, $dbname);
1005 1005
 			 
1006 1006
 			if (!$mysqli_access)
... ...
@@ -1019,21 +1019,14 @@ switch ($_GET['step'])
1019 1019
 			}
1020 1020
 			if ($handle)
1021 1021
 			{
1022
-				$dbhost = descript($_POST['dbhost']);
1023
-				$dbname = descript($_POST['dbname']);
1024
-				$dbuser = descript($_POST['dbuser']);
1025
-				$dbpass = descript($_POST['dbpass']);
1026
-				$sitekey = descript($_POST['sitekey']);
1022
+				$dbhost = htmlspecialchars($_POST['dbhost'], ENT_QUOTES);
1023
+				$dbname = htmlspecialchars($_POST['dbname'], ENT_QUOTES);
1024
+				$dbuser = htmlspecialchars($_POST['dbuser'], ENT_QUOTES);
1025
+				$dbpass = $_POST['dbpass'];
1026
+				$sitekey = htmlspecialchars($_POST['sitekey'], ENT_QUOTES);
1027 1027
 				if (empty($sitekey)) $sitekey = random_string($randomcharset, 10);
1028 1028
 				$language = $_POST['language'];
1029
-				$settingsprefix = descript($_POST['settingsprefix']);
1030
-				$text = "<?php \n".
1031
-					"\$dbhost = ".var_export(($dbhost), true).";\n".
1032
-					"\$dbname = ".var_export(($dbname), true).";\n".
1033
-					"\$dbuser= ".var_export(($dbuser), true).";\n".
1034
-					"\$dbpass = ".var_export(($dbpass), true).";\n".
1035
-					"\$sitekey = ".var_export(($sitekey), true).";\n".
1036
-					"\$settingsprefix = ".var_export(($settingsprefix), true).";\n\n".
1029
+				$settingsprefix = htmlspecialchars(descript($_POST['settingsprefix'], ENT_QUOTES));
1037 1030
 					"include(\"includes/dbfunctions.php\");\n".
1038 1031
 					"?>";
1039 1032