Browse code

Install script now supports MySQL databases with dashes. Seems CREATE $database was missing backtick quotes.

Clarissa Walker authored on 2015/09/11 02:50:34
Showing 1 changed files
... ...
@@ -94,22 +94,57 @@ HTML;
94 94
 // PHP Version
95 95
 $_GET['php_version'] = PHP_VERSION;
96 96
 	
97
-// Check 5.3
98
-if (version_compare(PHP_VERSION, '5.3.0', '>='))
97
+// Check 5.6
98
+if (version_compare(PHP_VERSION, '5.6.0*', '>='))
99 99
 	{
100 100
 echo <<<HTML
101
-<font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.3+.</td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></table></font>
101
+<font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.6+.</td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></table></font>
102
+HTML;
103
+	}
104
+	// Check 5.5
105
+	else if (version_compare(PHP_VERSION, '5.5.0*', '>='))
106
+	{
107
+echo <<<HTML
108
+<font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.5+.</td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></font>
109
+HTML;
110
+	}
111
+	// Check 5.4
112
+	else if (version_compare(PHP_VERSION, '5.4.0*', '>='))
113
+	{
114
+echo <<<HTML
115
+<font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.4+.</td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></font>
116
+HTML;
117
+	}
118
+	// Check 5.3
119
+	else if (version_compare(PHP_VERSION, '5.3.0*', '>='))
120
+	{
121
+echo <<<HTML
122
+<font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.3+.</td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></font>
123
+HTML;
124
+	}
125
+	// Check 5.2
126
+	else if (version_compare(PHP_VERSION, '5.2.0*', '>='))
127
+	{
128
+echo <<<HTML
129
+<font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.2+. Update to PHP 5.3 or higher when possible. </td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></font>
130
+HTML;
131
+	}
132
+	// Check 5.1
133
+	else if (version_compare(PHP_VERSION, '5.1.0*', '>='))
134
+	{
135
+echo <<<HTML
136
+<font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.1+. Update to PHP 5.3 or higher when possible. </td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></font>
102 137
 HTML;
103 138
 	}
104 139
 	// Check 5.0
105
-	else if (version_compare(PHP_VERSION, '5.0.0', '>='))
140
+	else if (version_compare(PHP_VERSION, '5.0.0*', '>='))
106 141
 	{
107 142
 echo <<<HTML
108 143
 <font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server supports PHP 5.0+. Update to PHP 5.3 or higher when possible. </td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></font>
109 144
 HTML;
110 145
 	}
111 146
 	// Does not support PHP 5
112
-	else if (version_compare(PHP_VERSION, '4.4.9', '<='))
147
+	else if (version_compare(PHP_VERSION, '4.4.9*', '<='))
113 148
 	{
114 149
 echo <<<HTML
115 150
 <font face="Verdana" size="3"><br><table><tr><th>PHP Version:</th></tr><tr><td class="a">{$_GET['php_version']}</td><td class="b">Your server does not support PHP 5. You may have issues running this tracker.</td><td class="c">&nbsp;<img src="./images/no.png" alt="Not Supported" </tr></table></font>
... ...
@@ -136,11 +171,14 @@ HTML;
136 171
 	}
137 172
 
138 173
 echo ("<br><br>");
139
-		if (version_compare(PHP_VERSION, '5.0.0', '>=') && class_exists('mysqli') || version_compare(PHP_VERSION, '5.0.0', '>=') && function_exists('mysql_connect')) echo "<center><font face=\"Verdana\">Fully supported. You may continue.</font></center>";
140
-		else if (version_compare(PHP_VERSION, '5.0.0', '>=') && !class_exists('mysqli') || version_compare(PHP_VERSION, '5.0.0', '>=') && !function_exists('mysql_connect')) die ("<center><font face=\"Verdana\">Fully supported, but cannot connect to database. You may not continue.</font></center>");
174
+		if (version_compare(PHP_VERSION, '5.3.0*', '>=') && class_exists('mysqli') || version_compare(PHP_VERSION, '5.3.0*', '>=') && function_exists('mysql_connect')) echo "<center><font face=\"Verdana\">Fully supported. You may continue.</font></center>";
175
+		else if (version_compare(PHP_VERSION, '5.3.0*', '>=') && !class_exists('mysqli') || version_compare(PHP_VERSION, '5.3.0*', '>=') && !function_exists('mysql_connect')) die ("<center><font face=\"Verdana\">Fully supported, but cannot connect to database. You may not continue.</font></center>");
176
+
177
+		if (version_compare(PHP_VERSION, '5.2.0*', '<=') && class_exists('mysqli') || version_compare(PHP_VERSION, '5.2.0*', '<=') && function_exists('mysql_connect')) echo "<center><font face=\"Verdana\">Supported. You may continue.</font></center>";
178
+		else if (version_compare(PHP_VERSION, '5.2.0*', '<=') && !class_exists('mysqli') || version_compare(PHP_VERSION, '5.2.0*', '<=') && !function_exists('mysql_connect')) die ("<center><font face=\"Verdana\">Supported, but cannot connect to database. You may not continue.</font></center>");
141 179
 
142
-		if (version_compare(PHP_VERSION, '4.4.9', '<=') && class_exists('mysqli') || version_compare(PHP_VERSION, '4.4.9', '<=') && function_exists('mysql_connect')) echo "<center><font face=\"Verdana\">Not fully supported, but you may try.</font></center>";
143
-		else if (version_compare(PHP_VERSION, '4.4.9', '<=') && !class_exists('mysqli') || version_compare(PHP_VERSION, '4.4.9', '<=') && !function_exists('mysql_connect')) die("<center><font face=\"Verdana\">Not fully supported, also cannot connect to database. You may not continue.</font></center>");
180
+		if (version_compare(PHP_VERSION, '4.4.9*', '<=') && class_exists('mysqli') || version_compare(PHP_VERSION, '4.4.9*', '<=') && function_exists('mysql_connect')) echo "<center><font face=\"Verdana\">Not fully supported, but you may try.</font></center>";
181
+		else if (version_compare(PHP_VERSION, '4.4.9*', '<=') && !class_exists('mysqli') || version_compare(PHP_VERSION, '4.4.9*', '<=') && !function_exists('mysql_connect')) die("<center><font face=\"Verdana\">Not fully supported, also cannot connect to database. You may not continue.</font></center>");
144 182
 		?>
145 183
 		<br>
146 184
 		<br>
... ...
@@ -280,8 +318,8 @@ echo ("<br><br>");
280 318
 		mysql_select_db("mysql") or die(errorMessage() . "Can't select db \"mysql\":" . mysql_error() . "</p>");
281 319
 
282 320
 		mysql_query("INSERT INTO user SET user=\"$username\", password=PASSWORD(\"$password\"), host=\"\"") or die(errorMessage() . "Can't make user: " . mysql_error() . "</p>");
283
-		mysql_query("INSERT INTO db SET Host=\"%\", db=\"$database\", user=\"$username\", select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', Create_priv='Y', Drop_priv='Y', Alter_priv='Y', index_priv='Y'") or die(errorMessage() . "Cannot insert into \"Db\": " . mysql_error() . "</p>");
284
-		mysql_query("CREATE DATABASE $database") or die(errorMessage() . "Can't make database: " . mysql_error() . "</p>");
321
+		mysql_query("INSERT INTO db SET Host=\"%\", db=\"$database\", user=\"$username\", select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', Create_priv='Y', Drop_priv='Y', Alter_priv='Y', index_priv='Y'") or die(errorMessage() . "Cannot insert into \"db\": " . mysql_error() . "</p>");
322
+		mysql_query("CREATE DATABASE `$database`") or die(errorMessage() . "Can't make database: " . mysql_error() . "</p>");
285 323
 		
286 324
 		mysql_query("FLUSH PRIVILEGES") or die(errorMessage() . "Can't flush privileges: " . mysql_error() . "</p>");
287 325
 	
... ...
@@ -767,7 +805,7 @@ echo ("<br><br>");
767 805
 		//display message to delete install.php file
768 806
 		echo "<p class=\"error\">Make sure you go and delete this installer script when you are done! (install.php)</p><br><br>\n";
769 807
 		echo "<p class=\"error\">Also, check the permissions and make sure the 'torrents' and 'rss' folders are able to be written to by the server.</p><br><br>\n";
770
-		echo "<br><center><a href=\"index.php\">Main Statistics Page</a></center>\n";		
808
+		echo "<br><center><a href=\"index.php\"><img src=\"images/stats.png\" border=\"0\" class=\"icon\" alt=\"Tracker Statistics\" title=\"Tracker Statistics\" />Main Statistics Page</a></center>\n";		
771 809
 		echo "</body></html>\n";
772 810
 	}
773 811