Browse code

Password authentication changed from ancient MD5 to bcrypt for PHP 5.5 and above, and crypt for PHP versions 5.0 to 5.4.x. Will be more precise later.

Clarissa Walker authored on 2015/09/14 06:58:30
Showing 1 changed files
... ...
@@ -704,102 +704,208 @@ echo ("<br><br>");
704 704
 			else
705 705
 				$countbytes = "false";
706 706
 
707
+			$_GET['php_version'] = PHP_VERSION;
708
+			
707 709
 			//write config.php file
708
-			$fd = fopen("config.php", "w") or die(errorMessage() . "Error: couldn't make config.php!</p>");
709
-			fwrite($fd, 
710
-			"<?php //Please do NOT edit this file, use the admin page for changes.\n" .
711
-			"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
712
-			"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
713
-			"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
714
-			"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
715
-			"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
716
-			"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
717
-			"\$GLOBALS['min_interval'] = " . htmlspecialchars($_POST["min_interval"]) . ";\n" .
718
-			"\$GLOBALS['maxpeers'] = " . htmlspecialchars($_POST["maxpeers"]) . ";\n" .
719
-			"\$GLOBALS['NAT'] = " . $NAT . ";\n" .
720
-			"\$GLOBALS['persist'] = " . $persist . ";\n" .
721
-			"\$GLOBALS['ip_override'] = " . $ip_override . ";\n" .
722
-			"\$GLOBALS['countbytes'] = " . $countbytes . ";\n" .
723
-			"\$upload_username = '" . htmlspecialchars($_POST["upload_username"]) . "';\n" .
724
-			"\$upload_password = '" . md5($_POST["upload_username"].$_POST["upload_password"]) . "';\n" .
725
-			"\$admin_username = '" . htmlspecialchars($_POST["admin_username"]) . "';\n" .
726
-			"\$admin_password = '" . md5($_POST["admin_username"].$_POST["admin_password"]) . "';\n" .
727
-			"\$GLOBALS['title'] = '" . htmlspecialchars(addquotes($_POST["title"])) . "';\n" .
728
-			"\$dbhost = '" . htmlspecialchars($_POST["dbhost"]) . "';\n" .
729
-			"\$dbuser = '" . htmlspecialchars($_POST["dbuser"]) . "';\n" .
730
-			"\$dbpass = '" . htmlspecialchars($_POST["dbpass"]) . "';\n" .
731
-			"\$database = '" . htmlspecialchars($_POST["database"]) . "';\n" .
732
-			"\$enablerss = " . $enablerss . ";\n" .
733
-			"\$rss_title = '" . htmlspecialchars(addquotes($_POST["rss_title"])) . "';\n" .
734
-			"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
735
-			"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
736
-			"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
737
-			"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
738
-			"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
739
-			"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
740
-			"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
741
-			"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
742
-			"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
743
-			"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
744
-			"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
745
-			"\$timezone = '" . htmlspecialchars($_POST["timezone"]) . "';\n" .
746
-			"\$prefix = '" . htmlspecialchars($_POST["prefix"]) . "';\n" .
747
-			"?>"
748
-			);
749
-
750
-			fclose($fd);
710
+			if (version_compare(PHP_VERSION, '5.5.0*', '>=')) {
711
+				$fd = fopen("config.php", "w") or die(errorMessage() . "Error: couldn't make config.php!</p>");
712
+				fwrite($fd, 
713
+				"<?php //Please do NOT edit this file, use the admin page for changes.\n" .
714
+				"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
715
+				"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
716
+				"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
717
+				"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .	
718
+				"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
719
+				"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
720
+				"\$GLOBALS['min_interval'] = " . htmlspecialchars($_POST["min_interval"]) . ";\n" .
721
+				"\$GLOBALS['maxpeers'] = " . htmlspecialchars($_POST["maxpeers"]) . ";\n" .
722
+				"\$GLOBALS['NAT'] = " . $NAT . ";\n" .
723
+				"\$GLOBALS['persist'] = " . $persist . ";\n" .
724
+				"\$GLOBALS['ip_override'] = " . $ip_override . ";\n" .
725
+				"\$GLOBALS['countbytes'] = " . $countbytes . ";\n" .
726
+				"\$upload_username = '" . htmlspecialchars($_POST["upload_username"]) . "';\n" .
727
+				"\$upload_password = '" . password_hash($_POST["upload_username"].$_POST["upload_password"], PASSWORD_BCRYPT) . "';\n" .
728
+				"\$admin_username = '" . htmlspecialchars($_POST["admin_username"]) . "';\n" .
729
+				"\$admin_password = '" . password_hash($_POST["admin_username"].$_POST["admin_password"], PASSWORD_BCRYPT) . "';\n" .
730
+				"\$GLOBALS['title'] = '" . htmlspecialchars(addquotes($_POST["title"])) . "';\n" .
731
+				"\$dbhost = '" . htmlspecialchars($_POST["dbhost"]) . "';\n" .
732
+				"\$dbuser = '" . htmlspecialchars($_POST["dbuser"]) . "';\n" .
733
+				"\$dbpass = '" . htmlspecialchars($_POST["dbpass"]) . "';\n" .
734
+				"\$database = '" . htmlspecialchars($_POST["database"]) . "';\n" .
735
+				"\$enablerss = " . $enablerss . ";\n" .
736
+				"\$rss_title = '" . htmlspecialchars(addquotes($_POST["rss_title"])) . "';\n" .
737
+				"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
738
+				"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
739
+				"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
740
+				"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
741
+				"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
742
+				"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
743
+				"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
744
+				"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
745
+				"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
746
+				"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
747
+				"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
748
+				"\$timezone = '" . htmlspecialchars($_POST["timezone"]) . "';\n" .
749
+				"\$prefix = '" . htmlspecialchars($_POST["prefix"]) . "';\n" .
750
+				"?>"
751
+				);
752
+
753
+				fclose($fd);
754
+			}
755
+			
756
+			else if (version_compare(PHP_VERSION, '5.4.0*', '<=')) {
757
+				$fd = fopen("config.php", "w") or die(errorMessage() . "Error: couldn't make config.php!</p>");
758
+				fwrite($fd, 
759
+				"<?php //Please do NOT edit this file, use the admin page for changes.\n" .
760
+				"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
761
+				"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
762
+				"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
763
+				"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .	
764
+				"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
765
+				"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
766
+				"\$GLOBALS['min_interval'] = " . htmlspecialchars($_POST["min_interval"]) . ";\n" .
767
+				"\$GLOBALS['maxpeers'] = " . htmlspecialchars($_POST["maxpeers"]) . ";\n" .
768
+				"\$GLOBALS['NAT'] = " . $NAT . ";\n" .
769
+				"\$GLOBALS['persist'] = " . $persist . ";\n" .
770
+				"\$GLOBALS['ip_override'] = " . $ip_override . ";\n" .
771
+				"\$GLOBALS['countbytes'] = " . $countbytes . ";\n" .
772
+				"\$upload_username = '" . htmlspecialchars($_POST["upload_username"]) . "';\n" .
773
+				"\$upload_password = '" . crypt($_POST["upload_username"].$_POST["upload_password"]) . "';\n" .
774
+				"\$admin_username = '" . htmlspecialchars($_POST["admin_username"]) . "';\n" .
775
+				"\$admin_password = '" . crypt($_POST["admin_username"].$_POST["admin_password"]) . "';\n" .
776
+				"\$GLOBALS['title'] = '" . htmlspecialchars(addquotes($_POST["title"])) . "';\n" .
777
+				"\$dbhost = '" . htmlspecialchars($_POST["dbhost"]) . "';\n" .
778
+				"\$dbuser = '" . htmlspecialchars($_POST["dbuser"]) . "';\n" .
779
+				"\$dbpass = '" . htmlspecialchars($_POST["dbpass"]) . "';\n" .
780
+				"\$database = '" . htmlspecialchars($_POST["database"]) . "';\n" .
781
+				"\$enablerss = " . $enablerss . ";\n" .
782
+				"\$rss_title = '" . htmlspecialchars(addquotes($_POST["rss_title"])) . "';\n" .
783
+				"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
784
+				"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
785
+				"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
786
+				"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
787
+				"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
788
+				"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
789
+				"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
790
+				"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
791
+				"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
792
+				"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
793
+				"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
794
+				"\$timezone = '" . htmlspecialchars($_POST["timezone"]) . "';\n" .
795
+				"\$prefix = '" . htmlspecialchars($_POST["prefix"]) . "';\n" .
796
+				"?>"
797
+				);
798
+
799
+				fclose($fd);
800
+			}
751 801
 			echo "<br><p class=\"success\">config.php file was created successfully!</p>";
752 802
 		}
753 803
 
754 804
 		//if unable to create on server, user downloads config.php file for future upload
755
-		if (!is_writable("./"))
805
+		if (version_compare(PHP_VERSION, '5.5.0*', '>='))
756 806
 		{
757
-			?>
758
-			<h2>"config.php" was unable to be created on the server, 
759
-			you will have to download the file and upload it manually.</h2>
760
-			<br>
761
-			<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
762
-			<input type="hidden" name="download" value="1">
763
-			<input type="hidden" name="hiddentracker" value="<?php if (isset($_POST['hiddentracker']) AND $_POST['hiddentracker'] == 'on') echo 'true'; else echo 'false';?>">
764
-			<input type="hidden" name="scrape" value="<?php if (isset($_POST['scrape']) AND $_POST['scrape'] == 'on') echo 'true'; else echo 'false';?>">
765
-			<input type="hidden" name="customtitle" value="<?php if (isset($_POST['customtitle']) AND $_POST['customtitle'] == 'on') echo 'true'; else echo 'false';?>">
766
-			<input type="hidden" name="indexpagelimitspecify" value="<?php echo $_POST['indexpagelimitspecify'];?>">
767
-			<input type="hidden" name="statspagelimitspecify" value="<?php echo $_POST['statspagelimitspecify'];?>">
768
-			<input type="hidden" name="report_interval" value="<?php echo $_POST['report_interval'];?>">
769
-			<input type="hidden" name="min_interval" value="<?php echo $_POST['min_interval'];?>">
770
-			<input type="hidden" name="maxpeers" value="<?php echo $_POST['maxpeers'];?>">
771
-			<input type="hidden" name="NAT" value="<?php if (isset($_POST['NAT']) AND $_POST['NAT'] == 'on') echo 'true'; else echo 'false';?>">
772
-			<input type="hidden" name="persist" value="<?php if (isset($_POST['persist']) AND $_POST['persist'] == 'on') echo 'true'; else echo 'false';?>">
773
-			<input type="hidden" name="ip_override" value="<?php if (isset($_POST['ip_override']) AND $_POST['ip_override'] == 'on') echo 'true'; else echo 'false';?>">
774
-			<input type="hidden" name="countbytes" value="<?php if (isset($_POST['countbytes']) AND $_POST['countbytes'] == 'on') echo 'true'; else echo 'false';?>">
775
-			<input type="hidden" name="upload_username" value="<?php echo $_POST['upload_username'];?>">
776
-			<input type="hidden" name="upload_password" value="<?php echo md5($_POST["upload_username"].$_POST["upload_password"]);?>">
777
-			<input type="hidden" name="admin_username" value="<?php echo $_POST['admin_username'];?>">
778
-			<input type="hidden" name="admin_password" value="<?php echo md5($_POST["admin_username"].$_POST["admin_password"]);?>">
779
-			<input type="hidden" name="title" value="<?php echo $_POST['title'];?>">
780
-			<input type="hidden" name="dbhost" value="<?php echo $_POST['dbhost'];?>">
781
-			<input type="hidden" name="dbuser" value="<?php echo $_POST['dbuser'];?>">
782
-			<input type="hidden" name="dbpass" value="<?php echo $_POST['dbpass'];?>">
783
-			<input type="hidden" name="database" value="<?php echo $_POST['database'];?>">
784
-			<input type="hidden" name="enablerss" value="<?php if (isset($_POST['enablerss']) AND $_POST['enablerss'] == 'on') echo 'true'; else echo 'false';?>">
785
-			<input type="hidden" name="rss_title" value="<?php echo $_POST['rss_title'];?>">
786
-			<input type="hidden" name="rss_link" value="<?php echo $_POST['rss_link'];?>">
787
-			<input type="hidden" name="rss_description" value="<?php echo $_POST['rss_description'];?>">
788
-			<input type="hidden" name="website_url" value="<?php echo $_POST['website_url'];?>">
789
-			<input type="hidden" name="announce_url0" value="<?php echo $_POST['announce_url0'];?>">
790
-			<input type="hidden" name="announce_url1" value="<?php echo $_POST['announce_url1'];?>">
791
-			<input type="hidden" name="announce_url2" value="<?php echo $_POST['announce_url2'];?>">
792
-			<input type="hidden" name="announce_url3" value="<?php echo $_POST['announce_url3'];?>">
793
-			<input type="hidden" name="announce_url4" value="<?php echo $_POST['announce_url4'];?>">
794
-			<input type="hidden" name="max_upload_rate" value="<?php echo $_POST['max_upload_rate'];?>">
795
-			<input type="hidden" name="max_uploads" value="<?php echo $_POST['max_uploads'];?>">
796
-			<input type="hidden" name="dateformat" value="<?php echo $_POST['dateformat'];?>">
797
-			<input type="hidden" name="timezone" value="<?php echo $_POST['timezone'];?>">
798
-			<input type="hidden" name="prefix" value="<?php echo $_POST['prefix'];?>">
799
-			<input type="submit" value="Download config.php File">
800
-			</form>
801
-			<br>
802
-			<?php
807
+			if (!is_writable("./"))
808
+			{
809
+				?>
810
+				<h2>"config.php" was unable to be created on the server, 
811
+				you will have to download the file and upload it manually.</h2>
812
+				<br>
813
+				<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
814
+				<input type="hidden" name="download" value="1">
815
+				<input type="hidden" name="hiddentracker" value="<?php if (isset($_POST['hiddentracker']) AND $_POST['hiddentracker'] == 'on') echo 'true'; else echo 'false';?>">
816
+				<input type="hidden" name="scrape" value="<?php if (isset($_POST['scrape']) AND $_POST['scrape'] == 'on') echo 'true'; else echo 'false';?>">
817
+				<input type="hidden" name="customtitle" value="<?php if (isset($_POST['customtitle']) AND $_POST['customtitle'] == 'on') echo 'true'; else echo 'false';?>">
818
+				<input type="hidden" name="indexpagelimitspecify" value="<?php echo $_POST['indexpagelimitspecify'];?>">
819
+				<input type="hidden" name="statspagelimitspecify" value="<?php echo $_POST['statspagelimitspecify'];?>">
820
+				<input type="hidden" name="report_interval" value="<?php echo $_POST['report_interval'];?>">
821
+				<input type="hidden" name="min_interval" value="<?php echo $_POST['min_interval'];?>">
822
+				<input type="hidden" name="maxpeers" value="<?php echo $_POST['maxpeers'];?>">
823
+				<input type="hidden" name="NAT" value="<?php if (isset($_POST['NAT']) AND $_POST['NAT'] == 'on') echo 'true'; else echo 'false';?>">
824
+				<input type="hidden" name="persist" value="<?php if (isset($_POST['persist']) AND $_POST['persist'] == 'on') echo 'true'; else echo 'false';?>">
825
+				<input type="hidden" name="ip_override" value="<?php if (isset($_POST['ip_override']) AND $_POST['ip_override'] == 'on') echo 'true'; else echo 'false';?>">
826
+				<input type="hidden" name="countbytes" value="<?php if (isset($_POST['countbytes']) AND $_POST['countbytes'] == 'on') echo 'true'; else echo 'false';?>">
827
+				<input type="hidden" name="upload_username" value="<?php echo $_POST['upload_username'];?>">
828
+				<input type="hidden" name="upload_password" value="<?php echo password_hash($_POST["upload_username"].$_POST["upload_password"], PASSWORD_BCRYPT);?>">
829
+				<input type="hidden" name="admin_username" value="<?php echo $_POST['admin_username'];?>">
830
+				<input type="hidden" name="admin_password" value="<?php echo password_hash($_POST["admin_username"].$_POST["admin_password"], PASSWORD_BCRYPT);?>">
831
+				<input type="hidden" name="title" value="<?php echo $_POST['title'];?>">
832
+				<input type="hidden" name="dbhost" value="<?php echo $_POST['dbhost'];?>">
833
+				<input type="hidden" name="dbuser" value="<?php echo $_POST['dbuser'];?>">
834
+				<input type="hidden" name="dbpass" value="<?php echo $_POST['dbpass'];?>">
835
+				<input type="hidden" name="database" value="<?php echo $_POST['database'];?>">
836
+				<input type="hidden" name="enablerss" value="<?php if (isset($_POST['enablerss']) AND $_POST['enablerss'] == 'on') echo 'true'; else echo 'false';?>">
837
+				<input type="hidden" name="rss_title" value="<?php echo $_POST['rss_title'];?>">
838
+				<input type="hidden" name="rss_link" value="<?php echo $_POST['rss_link'];?>">
839
+				<input type="hidden" name="rss_description" value="<?php echo $_POST['rss_description'];?>">
840
+				<input type="hidden" name="website_url" value="<?php echo $_POST['website_url'];?>">
841
+				<input type="hidden" name="announce_url0" value="<?php echo $_POST['announce_url0'];?>">
842
+				<input type="hidden" name="announce_url1" value="<?php echo $_POST['announce_url1'];?>">
843
+				<input type="hidden" name="announce_url2" value="<?php echo $_POST['announce_url2'];?>">
844
+				<input type="hidden" name="announce_url3" value="<?php echo $_POST['announce_url3'];?>">
845
+				<input type="hidden" name="announce_url4" value="<?php echo $_POST['announce_url4'];?>">
846
+				<input type="hidden" name="max_upload_rate" value="<?php echo $_POST['max_upload_rate'];?>">
847
+				<input type="hidden" name="max_uploads" value="<?php echo $_POST['max_uploads'];?>">
848
+				<input type="hidden" name="dateformat" value="<?php echo $_POST['dateformat'];?>">
849
+				<input type="hidden" name="timezone" value="<?php echo $_POST['timezone'];?>">
850
+				<input type="hidden" name="prefix" value="<?php echo $_POST['prefix'];?>">
851
+				<input type="submit" value="Download config.php File">
852
+				</form>
853
+				<br>
854
+				<?php
855
+			}
856
+		}
857
+		
858
+		if (version_compare(PHP_VERSION, '5.4.0*', '<='))
859
+		{
860
+			if (!is_writable("./"))
861
+			{
862
+				?>
863
+				<h2>"config.php" was unable to be created on the server, 
864
+				you will have to download the file and upload it manually.</h2>
865
+				<br>
866
+				<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
867
+				<input type="hidden" name="download" value="1">
868
+				<input type="hidden" name="hiddentracker" value="<?php if (isset($_POST['hiddentracker']) AND $_POST['hiddentracker'] == 'on') echo 'true'; else echo 'false';?>">
869
+				<input type="hidden" name="scrape" value="<?php if (isset($_POST['scrape']) AND $_POST['scrape'] == 'on') echo 'true'; else echo 'false';?>">
870
+				<input type="hidden" name="customtitle" value="<?php if (isset($_POST['customtitle']) AND $_POST['customtitle'] == 'on') echo 'true'; else echo 'false';?>">
871
+				<input type="hidden" name="indexpagelimitspecify" value="<?php echo $_POST['indexpagelimitspecify'];?>">
872
+				<input type="hidden" name="statspagelimitspecify" value="<?php echo $_POST['statspagelimitspecify'];?>">
873
+				<input type="hidden" name="report_interval" value="<?php echo $_POST['report_interval'];?>">
874
+				<input type="hidden" name="min_interval" value="<?php echo $_POST['min_interval'];?>">
875
+				<input type="hidden" name="maxpeers" value="<?php echo $_POST['maxpeers'];?>">
876
+				<input type="hidden" name="NAT" value="<?php if (isset($_POST['NAT']) AND $_POST['NAT'] == 'on') echo 'true'; else echo 'false';?>">
877
+				<input type="hidden" name="persist" value="<?php if (isset($_POST['persist']) AND $_POST['persist'] == 'on') echo 'true'; else echo 'false';?>">
878
+				<input type="hidden" name="ip_override" value="<?php if (isset($_POST['ip_override']) AND $_POST['ip_override'] == 'on') echo 'true'; else echo 'false';?>">
879
+				<input type="hidden" name="countbytes" value="<?php if (isset($_POST['countbytes']) AND $_POST['countbytes'] == 'on') echo 'true'; else echo 'false';?>">
880
+				<input type="hidden" name="upload_username" value="<?php echo $_POST['upload_username'];?>">
881
+				<input type="hidden" name="upload_password" value="<?php echo crypt($_POST["upload_username"].$_POST["upload_password"]);?>">
882
+				<input type="hidden" name="admin_username" value="<?php echo $_POST['admin_username'];?>">
883
+				<input type="hidden" name="admin_password" value="<?php echo crypt($_POST["admin_username"].$_POST["admin_password"]);?>">
884
+				<input type="hidden" name="title" value="<?php echo $_POST['title'];?>">
885
+				<input type="hidden" name="dbhost" value="<?php echo $_POST['dbhost'];?>">
886
+				<input type="hidden" name="dbuser" value="<?php echo $_POST['dbuser'];?>">
887
+				<input type="hidden" name="dbpass" value="<?php echo $_POST['dbpass'];?>">
888
+				<input type="hidden" name="database" value="<?php echo $_POST['database'];?>">
889
+				<input type="hidden" name="enablerss" value="<?php if (isset($_POST['enablerss']) AND $_POST['enablerss'] == 'on') echo 'true'; else echo 'false';?>">
890
+				<input type="hidden" name="rss_title" value="<?php echo $_POST['rss_title'];?>">
891
+				<input type="hidden" name="rss_link" value="<?php echo $_POST['rss_link'];?>">
892
+				<input type="hidden" name="rss_description" value="<?php echo $_POST['rss_description'];?>">
893
+				<input type="hidden" name="website_url" value="<?php echo $_POST['website_url'];?>">
894
+				<input type="hidden" name="announce_url0" value="<?php echo $_POST['announce_url0'];?>">
895
+				<input type="hidden" name="announce_url1" value="<?php echo $_POST['announce_url1'];?>">
896
+				<input type="hidden" name="announce_url2" value="<?php echo $_POST['announce_url2'];?>">
897
+				<input type="hidden" name="announce_url3" value="<?php echo $_POST['announce_url3'];?>">
898
+				<input type="hidden" name="announce_url4" value="<?php echo $_POST['announce_url4'];?>">
899
+				<input type="hidden" name="max_upload_rate" value="<?php echo $_POST['max_upload_rate'];?>">
900
+				<input type="hidden" name="max_uploads" value="<?php echo $_POST['max_uploads'];?>">
901
+				<input type="hidden" name="dateformat" value="<?php echo $_POST['dateformat'];?>">
902
+				<input type="hidden" name="timezone" value="<?php echo $_POST['timezone'];?>">
903
+				<input type="hidden" name="prefix" value="<?php echo $_POST['prefix'];?>">
904
+				<input type="submit" value="Download config.php File">
905
+				</form>
906
+				<br>
907
+				<?php
908
+			}
803 909
 		}
804 910
 
805 911
 		//display message to delete install.php file
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
 
Browse code

Checks added to some files: torrent_functions.php, tracker.php dltorrent.php's check changed to authenticate no matter what Some fixes and modifications from 2014: index.php, funcsv2.php, batch_upload.php, newtorrents.php, install.php, editconfig.php Version bumped up to 1.05

Clarissa Walker authored on 2015/08/30 00:06:28
Showing 1 changed files
... ...
@@ -21,7 +21,6 @@ if (isset($_POST["download"]))
21 21
 	print "\$GLOBALS['hiddentracker'] = " . htmlspecialchars($_POST["hiddentracker"]) . ";\n";
22 22
 	print "\$GLOBALS['scrape'] = " . htmlspecialchars($_POST["scrape"]) . ";\n";
23 23
 	print "\$GLOBALS['customtitle'] = " . htmlspecialchars($_POST["customtitle"]) . ";\n";
24
-	print "\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n";
25 24
 	print "\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n";
26 25
 	print "\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n";
27 26
 	print "\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n";
... ...
@@ -45,6 +44,11 @@ if (isset($_POST["download"]))
45 44
 	print "\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n";
46 45
 	print "\$rss_description = '" . htmlspecialchars($_POST["rss_description"]) . "';\n";
47 46
 	print "\$website_url = '" . htmlspecialchars($_POST['website_url']) . "';\n";
47
+	print "\$announce_url0 = '" . htmlspecialchars($_POST['announce_url0']) . "';\n";
48
+	print "\$announce_url1 = '" . htmlspecialchars($_POST['announce_url1']) . "';\n";
49
+	print "\$announce_url2 = '" . htmlspecialchars($_POST['announce_url2']) . "';\n";
50
+	print "\$announce_url3 = '" . htmlspecialchars($_POST['announce_url3']) . "';\n";
51
+	print "\$announce_url4 = '" . htmlspecialchars($_POST['announce_url4']) . "';\n";
48 52
 	print "\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n";
49 53
 	print "\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n";
50 54
 	print "\$dateformat = '" . htmlspecialchars($_POST['dateformat']) . "';\n";
... ...
@@ -334,17 +338,6 @@ echo ("<br><br>");
334 338
 		different from the filename.</td>
335 339
 		<td><input type="checkbox" name="customtitle"></td></tr>
336 340
 
337
-		<tr><td>Short Announce URL: You can enable the short announce feature, making the URL end in /announce for
338
-		your tracker.  You should not utilize both tracker URL forms in one torrent at the same time, or you will get
339
-		inconsistent results.  Note: You will need the provided htaccess file, have URL rewrite capabilities, and have
340
-		it properly set up to use this feature.  Otherwise, leave it disabled.</td>
341
-		<td><select name="announceurl" id="announceurl">
342
-		<option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
343
-		<option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
344
-		</select>
345
-		</td>
346
-		</tr>
347
-
348 341
 		<tr><td><span class="notice">* </span>Lists the number of torrents on each page on your torrent tracker list.  Default is 10.</td>
349 342
 		<td><input type="text" name="indexpagelimitspecify" size="40" value="10"></td></tr>
350 343
 
... ...
@@ -421,6 +414,21 @@ echo ("<br><br>");
421 414
 		
422 415
 		<tr><td><span class="notice">* </span>Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
423 416
 		<td><input type="text" name="website_url" size="40"></td></tr>
417
+
418
+		<tr><td><span class="notice">* </span>Primary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
419
+		<td><input type="text" name="announce_url0" size="40"></td></tr>
420
+
421
+		<tr><td>Secondary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
422
+		<td><input type="text" name="announce_url1" size="40"></td></tr>
423
+
424
+		<tr><td>Tertiary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
425
+		<td><input type="text" name="announce_url2" size="40"></td></tr>
426
+
427
+		<tr><td>Quaternary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
428
+		<td><input type="text" name="announce_url3" size="40"></td></tr>
429
+
430
+		<tr><td>Quinary website url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
431
+		<td><input type="text" name="announce_url4" size="40"></td></tr>
424 432
 		
425 433
 		<tr><td><span class="notice">* </span>For HTTP seeding, this is the maximum total upload rate per second in kilobytes, for example 100 would be 100 KB/s</td>
426 434
 		<td><input type="text" name="max_upload_rate" size="40" value="100"></td></tr>
... ...
@@ -509,7 +517,7 @@ echo ("<br><br>");
509 517
 	if (isset($_POST["config"]))
510 518
 	{
511 519
 		//check required entries for values, if blank: error out
512
-		if ($_POST["announceurl"] == "")
520
+		if ($_POST["announce_url0"] == "")
513 521
 		{
514 522
 			echo errorMessage() . "Error: The announce URL is blank.</p>";
515 523
 			exit();
... ...
@@ -589,6 +597,11 @@ echo ("<br><br>");
589 597
 			echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
590 598
 			exit();
591 599
 		}
600
+		if ($_POST["announce_url0"] == "" || Substr($_POST["announce_url0"], 0, 7) != "http://")
601
+		{
602
+			echo errorMessage() . "Error: The announce URL does not start with http:// or is blank.</p>";
603
+			exit();
604
+		}
592 605
 		if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0)
593 606
 		{
594 607
 			echo errorMessage() . "Error: The maximum upload rate is not an integer, a negative number, or is blank.</p>";
... ...
@@ -660,7 +673,6 @@ echo ("<br><br>");
660 673
 			"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
661 674
 			"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
662 675
 			"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
663
-			"\$announceurl = " . htmlspecialchars($_POST["announceurl"]) . ";\n" .
664 676
 			"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
665 677
 			"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
666 678
 			"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
... ...
@@ -684,6 +696,11 @@ echo ("<br><br>");
684 696
 			"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
685 697
 			"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
686 698
 			"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
699
+			"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
700
+			"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
701
+			"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
702
+			"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
703
+			"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
687 704
 			"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
688 705
 			"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
689 706
 			"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
... ...
@@ -708,7 +725,6 @@ echo ("<br><br>");
708 725
 			<input type="hidden" name="hiddentracker" value="<?php if (isset($_POST['hiddentracker']) AND $_POST['hiddentracker'] == 'on') echo 'true'; else echo 'false';?>">
709 726
 			<input type="hidden" name="scrape" value="<?php if (isset($_POST['scrape']) AND $_POST['scrape'] == 'on') echo 'true'; else echo 'false';?>">
710 727
 			<input type="hidden" name="customtitle" value="<?php if (isset($_POST['customtitle']) AND $_POST['customtitle'] == 'on') echo 'true'; else echo 'false';?>">
711
-			<input type="hidden" name="announceurl" value="<?php echo $_POST['announceurl'];?>">
712 728
 			<input type="hidden" name="indexpagelimitspecify" value="<?php echo $_POST['indexpagelimitspecify'];?>">
713 729
 			<input type="hidden" name="statspagelimitspecify" value="<?php echo $_POST['statspagelimitspecify'];?>">
714 730
 			<input type="hidden" name="report_interval" value="<?php echo $_POST['report_interval'];?>">
... ...
@@ -732,6 +748,11 @@ echo ("<br><br>");
732 748
 			<input type="hidden" name="rss_link" value="<?php echo $_POST['rss_link'];?>">
733 749
 			<input type="hidden" name="rss_description" value="<?php echo $_POST['rss_description'];?>">
734 750
 			<input type="hidden" name="website_url" value="<?php echo $_POST['website_url'];?>">
751
+			<input type="hidden" name="announce_url0" value="<?php echo $_POST['announce_url0'];?>">
752
+			<input type="hidden" name="announce_url1" value="<?php echo $_POST['announce_url1'];?>">
753
+			<input type="hidden" name="announce_url2" value="<?php echo $_POST['announce_url2'];?>">
754
+			<input type="hidden" name="announce_url3" value="<?php echo $_POST['announce_url3'];?>">
755
+			<input type="hidden" name="announce_url4" value="<?php echo $_POST['announce_url4'];?>">
735 756
 			<input type="hidden" name="max_upload_rate" value="<?php echo $_POST['max_upload_rate'];?>">
736 757
 			<input type="hidden" name="max_uploads" value="<?php echo $_POST['max_uploads'];?>">
737 758
 			<input type="hidden" name="dateformat" value="<?php echo $_POST['dateformat'];?>">
Browse code

Import from the old rivettracker git repository at sourceforge (amisaph/amisapphire branch)

Clarissa Walker (ami-sapphire) authored on 2014/01/24 14:02:23
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,753 @@
1
+<?php
2
+require_once ("funcsv2.php");
3
+
4
+//check if config.php file already exists, if so, this could be an already existing installation
5
+if (file_exists("config.php"))
6
+{
7
+	echo "<font color=red><strong>The config.php file already exists.  This is an indication of an already existing installation" .
8
+	" of RivetTracker.  If you are sure you are installing for the first time, please try recopying the files/folders." .
9
+	" This is also a security feature to prevent malicious attempts to run the installer if you forgot to delete it." .
10
+	" This installer will now abort.</strong></font>";
11
+	exit();
12
+}
13
+
14
+if (isset($_POST["download"]))
15
+{
16
+	//download config.php using header()
17
+	header('content-type: application/octet-stream');
18
+	header("Content-Disposition: attachment; filename=\"config.php\"");
19
+
20
+	print "<?php //Please do NOT edit this file, use the admin page for changes.\n";
21
+	print "\$GLOBALS['hiddentracker'] = " . htmlspecialchars($_POST["hiddentracker"]) . ";\n";
22
+	print "\$GLOBALS['scrape'] = " . htmlspecialchars($_POST["scrape"]) . ";\n";
23
+	print "\$GLOBALS['customtitle'] = " . htmlspecialchars($_POST["customtitle"]) . ";\n";
24
+	print "\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n";
25
+	print "\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n";
26
+	print "\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n";
27
+	print "\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n";
28
+	print "\$GLOBALS['min_interval'] = " . htmlspecialchars($_POST["min_interval"]) . ";\n";
29
+	print "\$GLOBALS['maxpeers'] = " . htmlspecialchars($_POST["maxpeers"]) . ";\n";
30
+	print "\$GLOBALS['NAT'] = " . htmlspecialchars($_POST["NAT"]) . ";\n";
31
+	print "\$GLOBALS['persist'] = " . htmlspecialchars($_POST["persist"]) . ";\n";
32
+	print "\$GLOBALS['ip_override'] = " . htmlspecialchars($_POST["ip_override"]) . ";\n";
33
+	print "\$GLOBALS['countbytes'] = " . htmlspecialchars($_POST["countbytes"]) . ";\n";
34
+	print "\$upload_username = '" . htmlspecialchars($_POST["upload_username"]) . "';\n";
35
+	print "\$upload_password = '" . htmlspecialchars($_POST["upload_password"]) . "';\n";
36
+	print "\$admin_username = '" . htmlspecialchars($_POST["admin_username"]) . "';\n";
37
+	print "\$admin_password = '" . htmlspecialchars($_POST["admin_password"]) . "';\n";
38
+	print "\$GLOBALS['title'] = '" . htmlspecialchars(addquotes($_POST["title"])) . "';\n";
39
+	print "\$dbhost = '" . htmlspecialchars($_POST["dbhost"]) . "';\n";
40
+	print "\$dbuser = '" . htmlspecialchars($_POST["dbuser"]) . "';\n";
41
+	print "\$dbpass = '" . htmlspecialchars($_POST["dbpass"]) . "';\n";
42
+	print "\$database = '" . htmlspecialchars($_POST["database"]) . "';\n";
43
+	print "\$enablerss = " . htmlspecialchars($_POST['enablerss']) . ";\n";
44
+	print "\$rss_title = '" . htmlspecialchars(addquotes($_POST["rss_title"])) . "';\n";
45
+	print "\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n";
46
+	print "\$rss_description = '" . htmlspecialchars($_POST["rss_description"]) . "';\n";
47
+	print "\$website_url = '" . htmlspecialchars($_POST['website_url']) . "';\n";
48
+	print "\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n";
49
+	print "\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n";
50
+	print "\$dateformat = '" . htmlspecialchars($_POST['dateformat']) . "';\n";
51
+	print "\$timezone = '" . htmlspecialchars($_POST['timezone']) . "';\n";
52
+	print "\$prefix = '" . htmlspecialchars($_POST['prefix']) . "';\n";
53
+	print "?>";
54
+exit;
55
+}
56
+
57
+?>
58
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
59
+
60
+<html>
61
+<head>
62
+	<title>RivetTracker Installer</title>
63
+	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
64
+	<link rel="stylesheet" href="./css/style.css" type="text/css" />
65
+</head>
66
+<body>
67
+<p align="right"><a href="./docs/help.html"><img src="images/help.png" border="0" class="icon" alt="Help" title="Help" /></a><a href="./docs/help.html">Help</a></p>
68
+
69
+<?php
70
+
71
+	if (!isset($_POST["started"]))
72
+	{
73
+		?>
74
+		<center>
75
+		<h1>RivetTracker Installer</h1>
76
+		<img src="images/install.png" border="0" class="icon" alt="RivetTracker Installation" title="RivetTracker Installation" />
77
+		<br>
78
+		<br>
79
+		<br>
80
+		<h2>Check for PHP and MySQL</h2>
81
+		</center>
82
+		<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
83
+		<input type="hidden" name="started" value="1">
84
+<?php
85
+
86
+echo <<<HTML
87
+<style>table {width: 650px; margin: auto;} th {background: transparent; border: none; align: center;} td.a {width: 225px; text-align: center;} td.c {width: 50px; height: 42px; margin: auto;}</style>
88
+HTML;
89
+
90
+// PHP Version
91
+$_GET['php_version'] = PHP_VERSION;
92
+	
93
+// Check 5.3
94
+if (version_compare(PHP_VERSION, '5.3.0', '>='))
95
+	{
96
+echo <<<HTML
97
+<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>
98
+HTML;
99
+	}
100
+	// Check 5.0
101
+	else if (version_compare(PHP_VERSION, '5.0.0', '>='))
102
+	{
103
+echo <<<HTML
104
+<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>
105
+HTML;
106
+	}
107
+	// Does not support PHP 5
108
+	else if (version_compare(PHP_VERSION, '4.4.9', '<='))
109
+	{
110
+echo <<<HTML
111
+<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>
112
+HTML;
113
+	}
114
+
115
+echo <<<HTML
116
+<br>
117
+HTML;
118
+
119
+//MySQL check
120
+if (class_exists('mysqli') OR function_exists('mysql_connect'))
121
+{
122
+echo <<<HTML
123
+<font face="Verdana" size="3"><table><tr><th>MySQL Support:</th></tr><tr><td class="a">Yes</td><td class="b">Your server supports MySQL.</td><td class="c"><img src="./images/yes.png" class="icon" alt="Supported" /></td></tr></table></font>
124
+HTML;
125
+	}
126
+	// No MySQL
127
+	else
128
+	{
129
+echo <<<HTML
130
+<font face="Verdana" size="3"><table><tr><th>MySQL Support:</tr></th><tr><td class="a">No</td><td class="b">Your server does not support MySQL.</td><td class="c">&nbsp;<img src="./images/no.png" alt="Not Supported" /></td></tr></table></font>
131
+HTML;
132
+	}
133
+
134
+echo ("<br><br>");
135
+		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>";
136
+		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>");
137
+
138
+		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>";
139
+		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>");
140
+		?>
141
+		<br>
142
+		<br>
143
+		<center>
144
+		<input type="submit" name="checkpassed" value="Continue">
145
+		</form>
146
+		</center>
147
+		<br>
148
+		</body></html><?php exit;
149
+	}
150
+	if (isset($_POST["checkpassed"]))
151
+	{
152
+		?>
153
+		<center>
154
+		<h1>RivetTracker Installer</h1>
155
+		<img src="images/install.png" border="0" class="icon" alt="RivetTracker Installation" title="RivetTracker Installation" />
156
+		</center>
157
+		<br>
158
+		<br>
159
+		<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
160
+		<input type="hidden" name="started" value="1">
161
+		<h2>The MySQL database needs to be prepared for the tracker. This script will help
162
+		you do that.</h2>
163
+		<h2>You have two choices:</h2>
164
+		<br>
165
+		<ul>
166
+		<li><h2>If you have a username, password, and database for the tracker already
167
+		created:</h2></li>
168
+		</ul>
169
+		<input type="submit" name="preexisting" value="Click Here">
170
+		<br>
171
+		<br>
172
+		<ul>
173
+		<li><h2>If you need to create the account and database, and you have the username and password
174
+		of a user who can create user accounts and databases:</h2></li>
175
+		</ul>
176
+		<input type="submit" name="makeaccount" value="Click Here">
177
+		</form>
178
+		<br>
179
+		</body></html><?php exit;
180
+	}
181
+	if (isset($_POST["preexisting"]))
182
+	{
183
+		?>
184
+		<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
185
+		<input type="hidden" name="maketables" value="1">
186
+		<input type="hidden" name="started" value="1">
187
+		<h1>RivetTracker Installation</h1>
188
+		<center>
189
+		<img src="images/install.png" border="0" class="icon" alt="RivetTracker Installation" title="RivetTracker Installation" />
190
+		</center>
191
+		<br><br>
192
+		<table border=0 cellpadding=5>
193
+		<tr><td align="right">Database hostname:<br>(in MySQL format, example: localhost)</td><td align="left"><input type="text" name="host" value="localhost" size="40"></td></tr>
194
+		<tr><td align="right">Tracker's database username:</td><td align="left"><input type="text" name="username" size="40"></td></tr>
195
+		<tr><td align="right">Tracker's database password:</td><td align="left"><input type="password" name="password" size="40"></td></tr>
196
+		<tr><td align="right">Database name:</td><td align="left"><input type="text" name="database" size="40"></td></tr>
197
+		<tr><td align="right">Table Prefix:<br> (If you want to use an existing<br> database this will add the tables
198
+		in<br> with the specified prefix. If you<br> are unsure, leave this blank.)<br>e.g.: rt_</td><td align="left"><input type="text" name="prefix" size="40"></td></tr>
199
+		</table>
200
+		<br><br>
201
+		<center>
202
+		<input type="submit" value="Install">
203
+		</center>
204
+		<br>
205
+		</form></body></html><?php exit;
206
+
207
+	}
208
+	if (isset($_POST["makeaccount"]))
209
+	{
210
+		?>
211
+		<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
212
+		<input type="hidden" name="domakeaccount" value="1">
213
+		<input type="hidden" name="started" value="1">
214
+		<h1>Tracker Installation</h1>
215
+		<center>
216
+		<img src="images/install.png" border="0" class="icon" alt="RivetTracker Installation" title="RivetTracker Installation" />
217
+		</center>
218
+		<br><br>
219
+		<table border=0 cellpadding=5>
220
+		<tr><td align="right">Username of database admin:</td><td align="left"><input type="text" name="adminname" size="40"></td></tr>
221
+		<tr><td align="right">Password of database admin:</td><td align="left"><input type="password" name="adminpass" size="40"></td></tr>
222
+		<tr><td align="right">Database hostname:<br>(in MySQL format, example: localhost)</td><td align="left"><input type="text" name="host" size="40" value="localhost"></td></tr>
223
+		<tr><td align="right">Create user for MySQL:<br>(make sure this user does not already exist)</td><td align="left"><input type="text" name="username" size="40"></td></tr>
224
+		<tr><td align="right">Password:</td><td align="left"><input type="password" name="password" size="40"></td></tr>
225
+		<tr><td align="right">Create database (name):</td><td align="left"><input type="text" name="database" size="40"></td></tr>
226
+		</table>
227
+		<br><br>
228
+		<center>		
229
+		<input type="submit" value="Install">
230
+		</center>
231
+		</form></body></html>
232
+		<?php exit;
233
+	}
234
+
235
+	if (isset($_POST["prefix"])) {
236
+		$prefix = $_POST["prefix"];
237
+	} else {
238
+		$prefix = "";
239
+	}
240
+
241
+	$makenamemap= 'CREATE TABLE ' . $prefix . 'namemap (info_hash char(40) NOT NULL default "", title varchar(250) NOT NULL default "", filename varchar(250) NOT NULL default "", url varchar(250) NOT NULL default "", size bigint(20) unsigned NOT NULL, pubDate varchar(50) NOT NULL default "", PRIMARY KEY(info_hash)) DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci ENGINE = innodb';
242
+	$makesummary = 'CREATE TABLE ' . $prefix . 'summary (info_hash char(40) NOT NULL default "", dlbytes bigint unsigned NOT NULL default 0, seeds int unsigned NOT NULL default 0, leechers int unsigned NOT NULL default 0, finished int unsigned NOT NULL default 0, lastcycle int unsigned NOT NULL default "0", lastSpeedCycle int unsigned NOT NULL DEFAULT "0", speed bigint unsigned NOT NULL default 0, piecelength int(11) NOT NULL default -1, numpieces int(11) NOT NULL default 0, PRIMARY KEY (info_hash)) DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci ENGINE = innodb';
243
+	$maketimestamps = 'CREATE TABLE ' . $prefix . 'timestamps (info_hash char(40) not null, sequence int unsigned not null auto_increment, bytes bigint unsigned not null, delta smallint unsigned not null, primary key(sequence), key sorting (info_hash)) DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci ENGINE = innodb';
244
+	$makespeedlimit = 'CREATE TABLE ' . $prefix . 'speedlimit (uploaded bigint(25) NOT NULL default 0, total_uploaded bigint(30) NOT NULL default 0, started bigint(25) NOT NULL default 0) DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci ENGINE = innodb';
245
+	$makewebseedfiles = 'CREATE TABLE ' . $prefix . 'webseedfiles (info_hash char(40) default NULL, filename char(250) NOT NULL default "", startpiece int(11) NOT NULL default 0, endpiece int(11) NOT NULL default 0, startpieceoffset int(11) NOT NULL default 0, fileorder int(11) NOT NULL default 0, UNIQUE KEY fileseq (info_hash,fileorder)) DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci ENGINE = innodb';
246
+	if (isset($_POST["maketables"]))
247
+	{
248
+		$username = $_POST["username"] or die(errorMessage() . "No username was given, please try again.</p>");
249
+		$password = $_POST["password"] or die(errorMessage() . "No username password was given, this is a huge security risk, please try again.</p>");
250
+		$database = $_POST["database"] or die(errorMessage() . "No database specified, please try again.</p>");
251
+		$hostname = $_POST["host"] or die(errorMessage() . "No database hostname specified, please try again.</p>");
252
+
253
+		$db = mysql_connect($hostname, $username, $password) or die(errorMessage() . "Can't connect to database: " . mysql_error() . "</p>"); 
254
+		mysql_select_db($database) or die(errorMessage() . "Can't select database: " . mysql_error() . "</p>");
255
+		mysql_query($makesummary) or die(errorMessage() . "Can't make the summary table: " . mysql_error() . "</p>");
256
+		mysql_query($makenamemap) or die(errorMessage() . "Can't make the namemap table: " . mysql_error() . "</p>");
257
+		mysql_query($maketimestamps) or die(errorMessage() . "Can't make the timestamps table: " . mysql_error() . "</p>");
258
+		mysql_query($makespeedlimit) or die(errorMessage() . "Can't make the speedlimit table: " . mysql_error() . "</p>");
259
+		mysql_query($makewebseedfiles) or die(errorMessage() . "Can't make the webseedfiles table: " . mysql_error() . "</p>");
260
+		mysql_query("INSERT INTO ".$prefix."speedlimit values (0,0,0)") or die(errorMessage() . "Can't insert zeros into speedlimit table: " . mysql_error() . "</p>");
261
+		echo "<p class=\"success\">Database was created successfully!</p><br><br>";
262
+	}
263
+
264
+	if (isset($_POST["domakeaccount"]))
265
+	{
266
+		$username = $_POST["username"] or die(errorMessage() . "No username was given, please try again.</p>");
267
+		$password = $_POST["password"] or die(errorMessage() . "No username password was given, this is a huge security risk, please try again.</p>");
268
+		$database = $_POST["database"] or die(errorMessage() . "No database specified, please try again.</p>");
269
+		$hostname = $_POST["host"] or die(errorMessage() . "No database hostname specified, please try again.</p>");
270
+
271
+		$dbadmin = $_POST["adminname"] or die(errorMessage() . "No admin username was given, please try again.</p>");
272
+		$dbpass = $_POST["adminpass"]; // No admin password, OK but huge security risk...
273
+		
274
+		// Escaping strings will be ignored for now.
275
+		$db = mysql_connect($hostname, $dbadmin, $dbpass) or die(errorMessage() . "Error connecting: " . mysql_error() . "</p>");
276
+		mysql_select_db("mysql") or die(errorMessage() . "Can't select db \"mysql\":" . mysql_error() . "</p>");
277
+
278
+		mysql_query("INSERT INTO user SET user=\"$username\", password=PASSWORD(\"$password\"), host=\"\"") or die(errorMessage() . "Can't make user: " . mysql_error() . "</p>");
279
+		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>");
280
+		mysql_query("CREATE DATABASE $database") or die(errorMessage() . "Can't make database: " . mysql_error() . "</p>");
281
+		
282
+		mysql_query("FLUSH PRIVILEGES") or die(errorMessage() . "Can't flush privileges: " . mysql_error() . "</p>");
283
+	
284
+		mysql_select_db($database) or die(errorMessage() . "Can't select database \"$database\":" . mysql_error() . "</p>");
285
+	
286
+		mysql_query($makesummary) or die(errorMessage() . "Can't make the summary table: " . mysql_error() . "</p>");
287
+		mysql_query($makenamemap) or die(errorMessage() . "Can't make the namemap table: " . mysql_error() . "</p>");
288
+		mysql_query($maketimestamps) or die(errorMessage() . "Can't make the timestamps table: " . mysql_error() . "</p>");
289
+		mysql_query($makespeedlimit) or die(errorMessage() . "Can't make the speedlimit table: " . mysql_error() . "</p>");
290
+		mysql_query($makewebseedfiles) or die(errorMessage() . "Can't make the webseedfiles table: " . mysql_error() . "</p>");
291
+		mysql_query("INSERT INTO ".$prefix."speedlimit values (0,0,0)") or die(errorMessage() . "Can't insert zeros into speedlimit table: " . mysql_error() . "</p>");
292
+		echo "<p class=\"success\">Database was created successfully!</p><br><br>";
293
+
294
+	}
295
+
296
+	if (isset($_POST["domakeaccount"]) || isset($_POST["maketables"]))
297
+	{
298
+		//have user set values for config.php
299
+		?>
300
+		<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
301
+		<input type="hidden" name="config" value="1">
302
+		<input type="hidden" name="started" value="1">
303
+		<?php
304
+		echo "<input type=\"hidden\" name=\"dbhost\" value=\"" . $hostname . "\">\n";
305
+		echo "<input type=\"hidden\" name=\"dbuser\" value=\"" . $username . "\">\n";
306
+		echo "<input type=\"hidden\" name=\"dbpass\" value=\"" . $password . "\">\n";
307
+		echo "<input type=\"hidden\" name=\"database\" value=\"" . $database . "\">\n";
308
+		echo "<input type=\"hidden\" name=\"prefix\" value=\"" . $prefix . "\">\n";
309
+		?>
310
+		<h1>Create Configuration File</h1>
311
+		<br><br>
312
+		<h2>This last step allows you to configure the "config.php" file.  This file stores all the necessary
313
+		settings for your tracker.  You can edit these settings at a later time in the admin page if you need
314
+		to change them.  Please do NOT edit the "config.php" file directly, use the admin page for any changes.
315
+		It's usually pretty safe to leave most of the settings to the default unless you know what you're doing.</h2>
316
+		<h2><span class="notice">*</span> - required value</h2>
317
+		<table border=1 cellpadding=3>
318
+		
319
+		<tr><td>Make tracker hidden: This will require a login by either the admin or upload user in order to
320
+		see the torrents available on the main statistics page.  This does not mean it's a private tracker.  If you
321
+		need a private tracker, there are many other trackers out there.  Also, you will need to secure the "torrents"
322
+		folder with an .htaccess file for Apache or some other method.  The tracker will still accept all valid
323
+		connections by clients.  There is no user checking in that regard.</td>
324
+		<td><input type="checkbox" name="hiddentracker"></td></tr>
325
+		
326
+		<tr><td>Enable or disable scraping by clients.  Generally it is safe to leave this on unless
327
+		you have a large number of torrents or users which can lead to increased bandwidth usage.  Also, scraping
328
+		can possibily be used maliciously by abusive clients.</td>
329
+		<td><input type="checkbox" name="scrape" checked></td></tr>
330
+
331
+		<tr><td>Displays custom titles on the main torrent statistics page instead of the filename.  This is
332
+		because the uploader script will auto-rename your uploaded filename to exactly what you specified initally
333
+		or by automatically using the data from the uploaded torrent.  Check this if you want the titles to be
334
+		different from the filename.</td>
335
+		<td><input type="checkbox" name="customtitle"></td></tr>
336
+
337
+		<tr><td>Short Announce URL: You can enable the short announce feature, making the URL end in /announce for
338
+		your tracker.  You should not utilize both tracker URL forms in one torrent at the same time, or you will get
339
+		inconsistent results.  Note: You will need the provided htaccess file, have URL rewrite capabilities, and have
340
+		it properly set up to use this feature.  Otherwise, leave it disabled.</td>
341
+		<td><select name="announceurl" id="announceurl">
342
+		<option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
343
+		<option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
344
+		</select>
345
+		</td>
346
+		</tr>
347
+
348
+		<tr><td><span class="notice">* </span>Lists the number of torrents on each page on your torrent tracker list.  Default is 10.</td>
349
+		<td><input type="text" name="indexpagelimitspecify" size="40" value="10"></td></tr>
350
+
351
+		<tr><td><span class="notice">* </span>Lists the number of torrents on each page on the detailed statistics page.  Default is 5.</td>
352
+		<td><input type="text" name="statspagelimitspecify" size="40" value="5"></td></tr>
353
+
354
+		<tr><td><span class="notice">* </span>Maximum reannounce interval (in seconds) 1800 == 30 minutes</td>
355
+		<td><input type="text" name="report_interval" size="40" value="1800"></td></tr>
356
+
357
+		<tr><td><span class="notice">* </span>Minimum reannounce interval (also in seconds) 300 == 5 minutes</td>
358
+		<td><input type="text" name="min_interval" size="40" value="300"></td></tr>
359
+
360
+		<tr><td><span class="notice">* </span>Number of peers to send in one request.  Some logic will break if you set this to more than 300,
361
+		so please don't do that. 100 is the most you should set anyway.</td>
362
+		<td><input type="text" name="maxpeers" size="40" value="50"></td></tr>
363
+
364
+		<tr><td>If set, NAT checking will be performed.
365
+		This may cause trouble with some providers, so it's
366
+		off by default.</td>
367
+		<td><input type="checkbox" name="NAT"></td></tr>
368
+
369
+		<tr><td>Persistent MySQL connections:
370
+		Check with your webmaster to see if you're allowed to use these.
371
+		Highly recommended, especially for higher loads, but generally
372
+		not allowed unless it's a dedicated machine.</td>
373
+		<td><input type="checkbox" name="persist"></td></tr>
374
+
375
+		<tr><td>Allow users to override ip address.
376
+		Enable this if you know people have a legit reason to use
377
+		this function. Leave disabled otherwise.</td>
378
+		<td><input type="checkbox" name="ip_override"></td></tr>
379
+
380
+		<tr><td>For heavily loaded trackers, uncheck this. It will stop count the number
381
+		of downloaded bytes and the speed of the torrent, but will significantly reduce
382
+		the load.</td>
383
+		<td><input type="checkbox" name="countbytes" checked></td></tr>
384
+
385
+		<tr><td><span class="notice">* </span>Username for individual who can add torrents to tracker database.
386
+		This user is only able to create, and not delete torrents to the tracker.
387
+		For full privileges, see the admin user.</td>
388
+		<td><input type="text" name="upload_username" size="40"></td></tr>
389
+
390
+		<tr><td><span class="notice">* </span>Password for individual who can add torrents to tracker database.
391
+		Again, this user is only able to create, and not delete torrents to the tracker.
392
+		For full privileges, see the admin user.</td>
393
+		<td><input type="password" name="upload_password" size="40"></td></tr>
394
+
395
+		<tr><td><span class="notice">* </span>Admin username. The admin is able to go to the admin page and show detailed 
396
+		information about the tracker as well as access a few other important tools.
397
+		The admin is also able to upload torrents to the database
398
+		just like the previous account.</td>
399
+		<td><input type="text" name="admin_username" size="40"></td></tr>
400
+
401
+		<tr><td><span class="notice">* </span>Password for admin.  Again, The admin is able to go to the admin page and show detailed 
402
+		information about the tracker as well as access a few other important tools.
403
+		The admin is also able to upload torrents to the database.</td>
404
+		<td><input type="password" name="admin_password" size="40"></td></tr>
405
+
406
+		<tr><td>Title on index.php statistics page, if not set, defaults to "Tracker Statistics"</td>
407
+		<td><input type="text" name="title" size="40"></td></tr>
408
+		
409
+		<tr><td>Enable RSS feed: If you do not want the RSS feed to be created for 
410
+		privacy reasons or do not need it disable this checkbox.</td>
411
+		<td><input type="checkbox" name="enablerss" checked></td></tr>
412
+		
413
+		<tr><td>RSS Title: In the rss.xml file, this is the main <pre>&lt;title&gt;</pre> tag.</td>
414
+		<td><input type="text" name="rss_title" size="40"></td></tr>
415
+		
416
+		<tr><td>RSS link to main website: In the rss.xml file, this is the main <pre>&lt;link&gt;</pre> tag.</td>
417
+		<td><input type="text" name="rss_link" size="40"></td></tr>
418
+		
419
+		<tr><td>RSS description: In the rss.xml file, this is the main <pre>&lt;description&gt;</pre> tag.</td>
420
+		<td><input type="text" name="rss_description" size="60"></td></tr>
421
+		
422
+		<tr><td><span class="notice">* </span>Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
423
+		<td><input type="text" name="website_url" size="40"></td></tr>
424
+		
425
+		<tr><td><span class="notice">* </span>For HTTP seeding, this is the maximum total upload rate per second in kilobytes, for example 100 would be 100 KB/s</td>
426
+		<td><input type="text" name="max_upload_rate" size="40" value="100"></td></tr>
427
+		
428
+		<tr><td><span class="notice">* </span>For HTTP seeding, this is the maximum number of uploads to run at a time</td>
429
+		<td><input type="text" name="max_uploads" size="40" value="5"></td></tr>
430
+		
431
+		<tr><td><span class="notice">* </span>Date format of the torrent publication date. It shows on statistics.php. If you change this setting, you will have to change it for every other existing torrent!</td>
432
+		<td>
433
+		<select name="dateformat" id="dateformat">
434
+		<option title="Mon, 4 Jan, 1999 01:15:40 PM" value="D, j M, Y h:i:s A" selected="selected">Mon, 4 Jan, 1999 01:15:40 PM</option>
435
+		<option title="Monday, 4 Jan, 1999 01:15:40 PM" value="l, j M, Y h:i:s A">Monday, 4 Jan, 1999 01:15:40 PM</option>
436
+		<option title="Mon, 4 January, 1999 01:15:40 PM" value="D, j F, Y h:i:s A">Mon, 4 January, 1999 01:15:40 PM</option>
437
+		<option title="Monday, 4 January, 1999 01:15:40 PM" value="l, j F, Y h:i:s A">Monday, 4 January, 1999 01:15:40 PM</option>
438
+		<option title="Mon, 4 Jan, 1999 13:15:40" value="D, j M, Y H:i:s">Mon, 4 Jan, 1999 13:15:40</option>
439
+		<option title="Monday, 4 Jan, 1999 13:15:40" value="l, j M, Y H:i:s">Monday, 4 Jan, 1999 13:15:40</option>
440
+		<option title="Mon, 4 January, 1999 13:15:40" value="D, j F, Y H:i:s">Mon, 4 January, 1999 13:15:40</option>
441
+		<option title="Monday, 4 January, 1999 13:15:40" value="l, j F, Y H:i:s">Monday, 4 January, 1999 13:15:40</option>
442
+		<option title="Mon, Jan 4, 1999 01:15:40 PM" value="D, M j, Y h:i:s A">Mon, Jan 4, 1999 01:15:40 PM</option>
443
+		<option title="Monday, Jan 4, 1999 01:15:40 PM" value="l, M j, Y h:i:s A">Monday, Jan 4, 1999 01:15:40 PM</option>
444
+		<option title="Mon, January 4, 1999 01:15:40 PM" value="D, F j, Y h:i:s A">Mon, January 4, 1999 01:15:40 PM</option>
445
+		<option title="Monday, January 4, 1999 01:15:40 PM" value="l, F j, Y h:i:s A">Monday, January 4, 1999 01:15:40 PM</option>
446
+		<option title="Mon, Jan 4, 1999 13:15:40" value="D, M j, Y H:i:s">Mon, Jan 4, 1999 13:15:40</option>
447
+		<option title="Monday, Jan 4, 1999 13:15:40" value="l, M j, Y H:i:s">Monday, Jan 4, 1999 13:15:40</option>
448
+		<option title="Mon, January 4, 1999 13:15:40" value="D, F j, Y H:i:s">Mon, January 4, 1999 13:15:40</option>
449
+		<option title="Monday, January 4, 1999 13:15:40" value="l, F j, Y H:i:s">Monday, January 4, 1999 13:15:40</option>
450
+		</select>
451
+		</td>
452
+		</tr>
453
+
454
+		<tr><td><span class="notice">* </span>Timezone that the server runs on</td>
455
+		<td>
456
+		<select name="timezone" id="timezone">
457
+		<option title="[UTC - 12] Baker Island Time" value="-1200">[UTC - 12] Baker Island Time</option>
458
+		<option title="[UTC - 11] Niue Time, Samoa Standard Time" value="-1100">[UTC - 11] Niue Time, Samoa Standard Time</option>
459
+		<option title="[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time" value="-1000">[UTC - 10] Hawaii-Aleutian Standard Time, Cook Isl...</option>
460
+		<option title="[UTC - 9:30] Marquesas Islands Time" value="-0930">[UTC - 9:30] Marquesas Islands Time</option>
461
+		<option title="[UTC - 9] Alaska Standard Time, Gambier Island Time" value="-0900">[UTC - 9] Alaska Standard Time, Gambier Island Tim...</option>
462
+		<option title="[UTC - 8] Pacific Standard Time" value="-0800">[UTC - 8] Pacific Standard Time</option>
463
+		<option title="[UTC - 7] Mountain Standard Time" value="-0700">[UTC - 7] Mountain Standard Time</option>
464
+		<option title="[UTC - 6] Central Standard Time" value="-0600">[UTC - 6] Central Standard Time</option>
465
+		<option title="[UTC - 5] Eastern Standard Time" value="-0500">[UTC - 5] Eastern Standard Time</option>
466
+		<option title="[UTC - 4] Atlantic Standard Time" value="-0400">[UTC - 4] Atlantic Standard Time</option>
467
+		<option title="[UTC - 3:30] Newfoundland Standard Time" value="-0330">[UTC - 3:30] Newfoundland Standard Time</option>
468
+		<option title="[UTC - 3] Amazon Standard Time, Central Greenland Time" value="-0300">[UTC - 3] Amazon Standard Time, Central Greenland ...</option>
469
+		<option title="[UTC - 2] Fernando de Noronha Time, South Georgia &amp; the South Sandwich Islands Time" value="-0200">[UTC - 2] Fernando de Noronha Time, South Georgia ...</option>
470
+		<option title="[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time" value="-0100">[UTC - 1] Azores Standard Time, Cape Verde Time, E...</option>
471
+		<option title="[UTC] Western European Time, Greenwich Mean Time" value="+0000" selected="selected">[UTC] Western European Time, Greenwich Mean Time</option>
472
+		<option title="[UTC + 1] Central European Time, West African Time" value="+0100">[UTC + 1] Central European Time, West African Time</option>
473
+		<option title="[UTC + 2] Eastern European Time, Central African Time" value="+0200">[UTC + 2] Eastern European Time, Central African T...</option>
474
+		<option title="[UTC + 3] Moscow Standard Time, Eastern African Time" value="+0300">[UTC + 3] Moscow Standard Time, Eastern African Ti...</option>
475
+		<option title="[UTC + 3:30] Iran Standard Time" value="+0330">[UTC + 3:30] Iran Standard Time</option>
476
+		<option title="[UTC + 4] Gulf Standard Time, Samara Standard Time" value="+0400">[UTC + 4] Gulf Standard Time, Samara Standard Time</option>
477
+		<option title="[UTC + 4:30] Afghanistan Time" value="+0430">[UTC + 4:30] Afghanistan Time</option>
478
+		<option title="[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time" value="+0500">[UTC + 5] Pakistan Standard Time, Yekaterinburg St...</option>
479
+		<option title="[UTC + 5:30] Indian Standard Time, Sri Lanka Time" value="+0530">[UTC + 5:30] Indian Standard Time, Sri Lanka Time</option>
480
+		<option title="[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time" value="+0600">[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirs...</option>
481
+		<option title="[UTC + 6:30] Cocos Islands Time, Myanmar Time" value="+0630">[UTC + 6:30] Cocos Islands Time, Myanmar Time</option>
482
+		<option title="[UTC + 7] Indochina Time, Krasnoyarsk Standard Time" value="+0700">[UTC + 7] Indochina Time, Krasnoyarsk Standard Tim...</option>
483
+		<option title="[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time" value="+0800">[UTC + 8] Chinese Standard Time, Australian Wester...</option>
484
+		<option title="[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time" value="+0900">[UTC + 9] Japan Standard Time, Korea Standard Time...</option>
485
+		<option title="[UTC + 9:30] Australian Central Standard Time" value="+0930">[UTC + 9:30] Australian Central Standard Time</option>
486
+		<option title="[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time" value="+1000">[UTC + 10] Australian Eastern Standard Time, Vladi...</option>
487
+		<option title="[UTC + 10:30] Lord Howe Standard Time" value="+1030">[UTC + 10:30] Lord Howe Standard Time</option>
488
+		<option title="[UTC + 11] Solomon Island Time, Magadan Standard Time" value="+1100">[UTC + 11] Solomon Island Time, Magadan Standard T...</option>
489
+		<option title="[UTC + 11:30] Norfolk Island Time" value="+1130">[UTC + 11:30] Norfolk Island Time</option>
490
+		<option title="[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time" value="+1200">[UTC + 12] New Zealand Time, Fiji Time, Kamchatka ...</option>
491
+		<option title="[UTC + 13] Tonga Time, Phoenix Islands Time" value="+1300">[UTC + 13] Tonga Time, Phoenix Islands Time</option>
492
+		<option title="[UTC + 14] Line Island Time" value="+1400">[UTC + 14] Line Island Time</option>
493
+		</select>
494
+		</td>
495
+		</tr>
496
+		
497
+		</table>
498
+		<br>
499
+		<center>
500
+		<input type="submit" value="Create Config File">
501
+		</center>
502
+		<br><br><br>
503
+		</form>
504
+		</body>
505
+		</html>
506
+		<?php
507
+	}
508
+
509
+	if (isset($_POST["config"]))
510
+	{
511
+		//check required entries for values, if blank: error out
512
+		if ($_POST["announceurl"] == "")
513
+		{
514
+			echo errorMessage() . "Error: The announce URL is blank.</p>";
515
+			exit();
516
+		}
517
+		if (!is_numeric($_POST["indexpagelimitspecify"]) || $_POST["indexpagelimitspecify"] == "" || $_POST["indexpagelimitspecify"] <= 0)
518
+		{
519
+			echo errorMessage() . "Error: The index page limit is not an integer, a negative number, or is blank.</p>";
520
+			exit();
521
+		}	
522
+		if (!is_numeric($_POST["statspagelimitspecify"]) || $_POST["statspagelimitspecify"] == "" || $_POST["statspagelimitspecify"] <= 0)
523
+		{
524
+			echo errorMessage() . "Error: The statistics page limit is not an integer, a negative number, or is blank.</p>";
525
+			exit();
526
+		}
527
+		if (!is_numeric($_POST["report_interval"]) || $_POST["report_interval"] == "" || $_POST["report_interval"] <= 0)
528
+		{
529
+			echo errorMessage() . "Error: The maximum reannounce interval is not an integer, a negative number, or is blank.</p>";
530
+			exit();
531
+		}
532
+		if (!is_numeric($_POST["min_interval"]) || $_POST["min_interval"] == "" || $_POST["min_interval"] <= 0)
533
+		{
534
+			echo errorMessage() . "Error: The minimum reannounce interval is not an integer, a negative number, or is blank.</p>";
535
+			exit();
536
+		}
537
+		if (!is_numeric($_POST["maxpeers"]) || $_POST["maxpeers"] == "" || $_POST["maxpeers"] > 300 || $_POST["maxpeers"] <= 0)
538
+		{
539
+			echo errorMessage() . "Error: The number of peers to send in one request is not an integer, over 300, a negative number, zero, or blank.</p>";
540
+			exit();
541
+		}
542
+		if ($_POST["upload_username"] == "")
543
+		{
544
+			echo errorMessage() . "Error: The upload username is blank.</p>";
545
+			exit();
546
+		}
547
+		if ($_POST["upload_password"] == "")
548
+		{
549
+			echo errorMessage() . "Error: The upload user password is blank. This is considered a security risk.</p>";
550
+			exit();
551
+		}
552
+		if ($_POST["admin_username"] == "")
553
+		{
554
+			echo errorMessage() . "Error: The admin username is blank.</p>";
555
+			exit();
556
+		}
557
+		if ($_POST["admin_password"] == "")
558
+		{
559
+			echo errorMessage() . "Error: The admin user password is blank. This is considered a LARGE security risk.</p>";
560
+			exit();
561
+		}
562
+		if ($_POST["dbhost"] == "")
563
+		{
564
+			echo errorMessage() . "Error: The database hostname is blank.</p>";
565
+			exit();
566
+		}
567
+		if ($_POST["dbuser"] == "")
568
+		{
569
+			echo errorMessage() . "Error: The database username is blank.</p>";
570
+			exit();
571
+		}
572
+		if ($_POST["dbpass"] == "")
573
+		{
574
+			echo errorMessage() . "Error: The database password is blank.</p>";
575
+			exit();
576
+		}
577
+		if ($_POST["database"] == "")
578
+		{
579
+			echo errorMessage() . "Error: The database name is blank.</p>";
580
+			exit();
581
+		}
582
+		if ($_POST["rss_link"] != "" && Substr($_POST["rss_link"], 0, 7) != "http://")
583
+		{
584
+			echo errorMessage() . "Error: The RSS website URL does not start with http://</p>";
585
+			exit();
586
+		}
587
+		if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://")
588
+		{
589
+			echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
590
+			exit();
591
+		}
592
+		if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0)
593
+		{
594
+			echo errorMessage() . "Error: The maximum upload rate is not an integer, a negative number, or is blank.</p>";
595
+			exit();
596
+		}
597
+		if (!is_numeric($_POST["max_uploads"]) || $_POST["max_uploads"] == "" || $_POST["max_uploads"] <= 0)
598
+		{
599
+			echo errorMessage() . "Error: The maximum uploads is not an integer, a negative number, or is blank.</p>";
600
+			exit();
601
+		}
602
+		if ($_POST["dateformat"] == "")
603
+		{
604
+			echo errorMessage() . "Error: The date format is blank.</p>";
605
+			exit();
606
+		}
607
+		if ($_POST["timezone"] == "")
608
+		{
609
+			echo errorMessage() . "Error: The timezone is blank.</p>";
610
+			exit();
611
+		}
612
+		if ($_POST["upload_username"] == $_POST["admin_username"])
613
+		{
614
+			echo errorMessage() . "Error: The admin username cannot be the same as the upload username.</p>";
615
+			exit();
616
+		}
617
+	
618
+		//create config.php based on user input
619
+		//first try creating it on the server
620
+		if (is_writable("./"))
621
+		{
622
+			//go through checkboxes and change "on" to "true"
623
+			if ($_POST["hiddentracker"] == "on")
624
+				$hiddentracker = "true";
625
+			else
626
+				$hiddentracker = "false";
627
+			if ($_POST["enablerss"] == "on")
628
+				$enablerss = "true";
629
+			else
630
+				$enablerss = "false";
631
+			if ($_POST["scrape"] == "on")
632
+				$scrape = "true";
633
+			else
634
+				$scrape = "false";
635
+			if ($_POST["customtitle"] == "on")
636
+				$customtitle = "true";
637
+			else
638
+				$customtitle = "false";
639
+			if ($_POST["NAT"] == "on")
640
+				$NAT = "true";
641
+			else
642
+				$NAT = "false";
643
+			if ($_POST["persist"] == "on")
644
+				$persist = "true";
645
+			else
646
+				$persist = "false";
647
+			if ($_POST["ip_override"] == "on")
648
+				$ip_override = "true";
649
+			else
650
+				$ip_override = "false";
651
+			if ($_POST["countbytes"] == "on")
652
+				$countbytes = "true";
653
+			else
654
+				$countbytes = "false";
655
+
656
+			//write config.php file
657
+			$fd = fopen("config.php", "w") or die(errorMessage() . "Error: couldn't make config.php!</p>");
658
+			fwrite($fd, 
659
+			"<?php //Please do NOT edit this file, use the admin page for changes.\n" .
660
+			"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
661
+			"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
662
+			"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
663
+			"\$announceurl = " . htmlspecialchars($_POST["announceurl"]) . ";\n" .
664
+			"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
665
+			"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
666
+			"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
667
+			"\$GLOBALS['min_interval'] = " . htmlspecialchars($_POST["min_interval"]) . ";\n" .
668
+			"\$GLOBALS['maxpeers'] = " . htmlspecialchars($_POST["maxpeers"]) . ";\n" .
669
+			"\$GLOBALS['NAT'] = " . $NAT . ";\n" .
670
+			"\$GLOBALS['persist'] = " . $persist . ";\n" .
671
+			"\$GLOBALS['ip_override'] = " . $ip_override . ";\n" .
672
+			"\$GLOBALS['countbytes'] = " . $countbytes . ";\n" .
673
+			"\$upload_username = '" . htmlspecialchars($_POST["upload_username"]) . "';\n" .
674
+			"\$upload_password = '" . md5($_POST["upload_username"].$_POST["upload_password"]) . "';\n" .
675
+			"\$admin_username = '" . htmlspecialchars($_POST["admin_username"]) . "';\n" .
676
+			"\$admin_password = '" . md5($_POST["admin_username"].$_POST["admin_password"]) . "';\n" .
677
+			"\$GLOBALS['title'] = '" . htmlspecialchars(addquotes($_POST["title"])) . "';\n" .
678
+			"\$dbhost = '" . htmlspecialchars($_POST["dbhost"]) . "';\n" .
679
+			"\$dbuser = '" . htmlspecialchars($_POST["dbuser"]) . "';\n" .
680
+			"\$dbpass = '" . htmlspecialchars($_POST["dbpass"]) . "';\n" .
681
+			"\$database = '" . htmlspecialchars($_POST["database"]) . "';\n" .
682
+			"\$enablerss = " . $enablerss . ";\n" .
683
+			"\$rss_title = '" . htmlspecialchars(addquotes($_POST["rss_title"])) . "';\n" .
684
+			"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
685
+			"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
686
+			"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
687
+			"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
688
+			"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
689
+			"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
690
+			"\$timezone = '" . htmlspecialchars($_POST["timezone"]) . "';\n" .
691
+			"\$prefix = '" . htmlspecialchars($_POST["prefix"]) . "';\n" .
692
+			"?>"
693
+			);
694
+
695
+			fclose($fd);
696
+			echo "<br><p class=\"success\">config.php file was created successfully!</p>";
697
+		}
698
+
699
+		//if unable to create on server, user downloads config.php file for future upload
700
+		if (!is_writable("./"))
701
+		{
702
+			?>
703
+			<h2>"config.php" was unable to be created on the server, 
704
+			you will have to download the file and upload it manually.</h2>
705
+			<br>
706
+			<form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>">
707
+			<input type="hidden" name="download" value="1">
708
+			<input type="hidden" name="hiddentracker" value="<?php if (isset($_POST['hiddentracker']) AND $_POST['hiddentracker'] == 'on') echo 'true'; else echo 'false';?>">
709
+			<input type="hidden" name="scrape" value="<?php if (isset($_POST['scrape']) AND $_POST['scrape'] == 'on') echo 'true'; else echo 'false';?>">
710
+			<input type="hidden" name="customtitle" value="<?php if (isset($_POST['customtitle']) AND $_POST['customtitle'] == 'on') echo 'true'; else echo 'false';?>">
711
+			<input type="hidden" name="announceurl" value="<?php echo $_POST['announceurl'];?>">
712
+			<input type="hidden" name="indexpagelimitspecify" value="<?php echo $_POST['indexpagelimitspecify'];?>">
713
+			<input type="hidden" name="statspagelimitspecify" value="<?php echo $_POST['statspagelimitspecify'];?>">
714
+			<input type="hidden" name="report_interval" value="<?php echo $_POST['report_interval'];?>">
715
+			<input type="hidden" name="min_interval" value="<?php echo $_POST['min_interval'];?>">
716
+			<input type="hidden" name="maxpeers" value="<?php echo $_POST['maxpeers'];?>">
717
+			<input type="hidden" name="NAT" value="<?php if (isset($_POST['NAT']) AND $_POST['NAT'] == 'on') echo 'true'; else echo 'false';?>">
718
+			<input type="hidden" name="persist" value="<?php if (isset($_POST['persist']) AND $_POST['persist'] == 'on') echo 'true'; else echo 'false';?>">
719
+			<input type="hidden" name="ip_override" value="<?php if (isset($_POST['ip_override']) AND $_POST['ip_override'] == 'on') echo 'true'; else echo 'false';?>">
720
+			<input type="hidden" name="countbytes" value="<?php if (isset($_POST['countbytes']) AND $_POST['countbytes'] == 'on') echo 'true'; else echo 'false';?>">
721
+			<input type="hidden" name="upload_username" value="<?php echo $_POST['upload_username'];?>">
722
+			<input type="hidden" name="upload_password" value="<?php echo md5($_POST["upload_username"].$_POST["upload_password"]);?>">
723
+			<input type="hidden" name="admin_username" value="<?php echo $_POST['admin_username'];?>">
724
+			<input type="hidden" name="admin_password" value="<?php echo md5($_POST["admin_username"].$_POST["admin_password"]);?>">
725
+			<input type="hidden" name="title" value="<?php echo $_POST['title'];?>">
726
+			<input type="hidden" name="dbhost" value="<?php echo $_POST['dbhost'];?>">
727
+			<input type="hidden" name="dbuser" value="<?php echo $_POST['dbuser'];?>">
728
+			<input type="hidden" name="dbpass" value="<?php echo $_POST['dbpass'];?>">
729
+			<input type="hidden" name="database" value="<?php echo $_POST['database'];?>">
730
+			<input type="hidden" name="enablerss" value="<?php if (isset($_POST['enablerss']) AND $_POST['enablerss'] == 'on') echo 'true'; else echo 'false';?>">
731
+			<input type="hidden" name="rss_title" value="<?php echo $_POST['rss_title'];?>">
732
+			<input type="hidden" name="rss_link" value="<?php echo $_POST['rss_link'];?>">
733
+			<input type="hidden" name="rss_description" value="<?php echo $_POST['rss_description'];?>">
734
+			<input type="hidden" name="website_url" value="<?php echo $_POST['website_url'];?>">
735
+			<input type="hidden" name="max_upload_rate" value="<?php echo $_POST['max_upload_rate'];?>">
736
+			<input type="hidden" name="max_uploads" value="<?php echo $_POST['max_uploads'];?>">
737
+			<input type="hidden" name="dateformat" value="<?php echo $_POST['dateformat'];?>">
738
+			<input type="hidden" name="timezone" value="<?php echo $_POST['timezone'];?>">
739
+			<input type="hidden" name="prefix" value="<?php echo $_POST['prefix'];?>">
740
+			<input type="submit" value="Download config.php File">
741
+			</form>
742
+			<br>
743
+			<?php
744
+		}
745
+
746
+		//display message to delete install.php file
747
+		echo "<p class=\"error\">Make sure you go and delete this installer script when you are done! (install.php)</p><br><br>\n";
748
+		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";
749
+		echo "<br><center><a href=\"index.php\">Main Statistics Page</a></center>\n";		
750
+		echo "</body></html>\n";
751
+	}
752
+
753
+?>