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
... ...
@@ -138,7 +138,7 @@ if (!isset($_POST["saveconfig"]))
138 138
 	Again, this user is only able to create, and not delete torrents to the tracker.
139 139
 	For full privileges, see the admin user.<br><br>
140 140
 	<input type="hidden" name="old_upload_password" value="<?php echo $temp;?>">
141
-	<b>Current MD5 hashed username+password: <?php echo $temp;?></b></td>
141
+	<b>Current hashed username+password: <?php echo $temp;?></b></td>
142 142
 	<td><input type="password" name="upload_password" size="40" value=""></td></tr>
143 143
 	<?php
144 144
 	$temp = fgets($fr);
... ...
@@ -157,7 +157,7 @@ if (!isset($_POST["saveconfig"]))
157 157
 	information about the tracker as well as access a few other important tools.
158 158
 	The admin is also able to upload torrents to the database.<br><br>
159 159
 	<input type="hidden" name="old_admin_password" value="<?php echo $temp;?>">
160
-	<b>Current MD5 hashed username+password: <?php echo $temp;?></b></td>
160
+	<b>Current hashed username+password: <?php echo $temp;?></b></td>
161 161
 	<td><input type="password" name="admin_password" size="40" value=""></td></tr>
162 162
 	<?php
163 163
 	$temp = fgets($fr);
... ...
@@ -462,19 +462,39 @@ if (isset($_POST["saveconfig"]))
462 462
 		exit();
463 463
 	}
464 464
 	
465
-	//calculate new MD5 password if needed
466
-	if ($_POST["upload_password"] != "")
465
+	//calculate new password if needed
466
+	$_GET['php_version'] = PHP_VERSION;
467
+	if (version_compare(PHP_VERSION, '5.5.0*', '>='))
467 468
 	{
468
-		$_POST["upload_password"] = md5($_POST["upload_username"].$_POST["upload_password"]);
469
+		if ($_POST["upload_password"] != "")
470
+		{
471
+			$_POST["upload_password"] = password_hash($_POST["upload_username"].$_POST["upload_password"], PASSWORD_BCRYPT);
472
+		}
473
+		else
474
+			$_POST["upload_password"] = $_POST["old_upload_password"];
475
+		if ($_POST["admin_password"] != "")
476
+		{
477
+			$_POST["admin_password"] = password_hash($_POST["admin_username"].$_POST["admin_password"], PASSWORD_BCRYPT);
478
+		}
479
+		else
480
+			$_POST["admin_password"] = $_POST["old_admin_password"];
469 481
 	}
470
-	else
471
-		$_POST["upload_password"] = $_POST["old_upload_password"];
472
-	if ($_POST["admin_password"] != "")
482
+	
483
+	else if (version_compare(PHP_VERSION, '5.4.0*', '<='))
473 484
 	{
474
-		$_POST["admin_password"] = md5($_POST["admin_username"].$_POST["admin_password"]);
485
+		if ($_POST["upload_password"] != "")
486
+		{
487
+			$_POST["upload_password"] = crypt($_POST["upload_username"].$_POST["upload_password"]);
488
+		}
489
+		else
490
+			$_POST["upload_password"] = $_POST["old_upload_password"];
491
+		if ($_POST["admin_password"] != "")
492
+		{
493
+			$_POST["admin_password"] = crypt($_POST["admin_username"].$_POST["admin_password"]);
494
+		}
495
+		else
496
+			$_POST["admin_password"] = $_POST["old_admin_password"];
475 497
 	}
476
-	else
477
-		$_POST["admin_password"] = $_POST["old_admin_password"];
478 498
 		
479 499
 	//check if config.php has write access
480 500
 	if (is_writable("config.php"))
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
... ...
@@ -60,17 +60,6 @@ if (!isset($_POST["saveconfig"]))
60 60
 	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="customtitle"<?php if ($temp == "true") echo " checked";?>></td></tr>
61 61
 	<?php
62 62
 	$temp = fgets($fr);
63
-	$temp = substr($temp, strpos($temp, "=")+3, -3);
64
-	?>
65
-	<tr><td>Short Announce URL: You can turn on the short announce feature, making the URL end in /announce for your tracker. You should not utilize both tracker URL forms in one torrent at the same time, or you will get inconsistent results. Note: You will need the provided htaccess file, have URL rewrite capabilities, and have it properly set up to use this feature. Otherwise, leave it disabled.</td>
66
-	<td><select name="announceurl" id="announceurl">
67
-	<option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
68
-	<option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
69
-	</select>
70
-	</td>
71
-	</tr>
72
-	<?php
73
-	$temp = fgets($fr);
74 63
 	$temp = substr($temp, strpos($temp, "=")+2, -2);
75 64
 	?>
76 65
 	<tr><td><span class="notice">*</span> Lists the number of torrents on each page on your torrent tracker list. Default is 10.</td>
... ...
@@ -233,10 +222,40 @@ if (!isset($_POST["saveconfig"]))
233 222
 	$temp = fgets($fr);
234 223
 	$temp = substr($temp, strpos($temp, "=")+3, -3);
235 224
 	?>
236
-	<tr><td><span class="notice">*</span> Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
225
+	<tr><td><span class="notice">*</span> Website url that the tracker runs on, example: http://www.mywebsite.com</td>
237 226
 	<td><input type="text" name="website_url" size="40" value="<?php echo $temp;?>"></td></tr>
238 227
 	<?php
239 228
 	$temp = fgets($fr);
229
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
230
+	?>
231
+	<tr><td><span class="notice">*</span> Main announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
232
+	<td><input type="text" name="announce_url0" size="40" value="<?php echo $temp;?>"></td></tr>
233
+	<?php
234
+	$temp = fgets($fr);
235
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
236
+	?>
237
+	<tr><td>Secondary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
238
+	<td><input type="text" name="announce_url1" size="40" value="<?php echo $temp;?>"></td></tr>
239
+	<?php
240
+	$temp = fgets($fr);
241
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
242
+	?>
243
+	<tr><td>Tertiary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
244
+	<td><input type="text" name="announce_url2" size="40" value="<?php echo $temp;?>"></td></tr>
245
+	<?php
246
+	$temp = fgets($fr);
247
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
248
+	?>
249
+	<tr><td>Quaternary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
250
+	<td><input type="text" name="announce_url3" size="40" value="<?php echo $temp;?>"></td></tr>
251
+	<?php
252
+	$temp = fgets($fr);
253
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
254
+	?>
255
+	<tr><td>Quinary announce url that the tracker runs on, example: http://www.mywebsite.com/tracker/announce</td>
256
+	<td><input type="text" name="announce_url4" size="40" value="<?php echo $temp;?>"></td></tr>
257
+	<?php
258
+	$temp = fgets($fr);
240 259
 	$temp = substr($temp, strpos($temp, "=")+2, -2);
241 260
 	?>
242 261
 	<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>
... ...
@@ -342,7 +361,7 @@ if (!isset($_POST["saveconfig"]))
342 361
 if (isset($_POST["saveconfig"]))
343 362
 {
344 363
 	//check required entries for values, if blank: error out
345
-	if ($_POST["announceurl"] == "")
364
+	if ($_POST["announce_url0"] == "")
346 365
 	{
347 366
 		echo errorMessage() . "Error: The announce URL is blank.</p>";
348 367
 		exit();
... ...
@@ -409,7 +428,12 @@ if (isset($_POST["saveconfig"]))
409 428
 	}
410 429
 	if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://")
411 430
 	{
412
-		echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
431
+		echo errorMessage() . "Error: The website URL list does not start with http:// or is blank.</p>";
432
+		exit();
433
+	}
434
+	if ($_POST["announce_url0"] == "" || Substr($_POST["announce_url0"], 0, 7) != "http://")
435
+	{
436
+		echo errorMessage() . "Error: The announce URL list does not start with http:// or is blank.</p>";
413 437
 		exit();
414 438
 	}
415 439
 	if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0)
... ...
@@ -496,7 +520,6 @@ if (isset($_POST["saveconfig"]))
496 520
 		"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
497 521
 		"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
498 522
 		"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
499
-		"\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n" .
500 523
 		"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
501 524
 		"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
502 525
 		"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
... ...
@@ -520,6 +543,11 @@ if (isset($_POST["saveconfig"]))
520 543
 		"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
521 544
 		"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
522 545
 		"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
546
+		"\$announce_url0 = '" . htmlspecialchars($_POST["announce_url0"]) . "';\n" .
547
+		"\$announce_url1 = '" . htmlspecialchars($_POST["announce_url1"]) . "';\n" .
548
+		"\$announce_url2 = '" . htmlspecialchars($_POST["announce_url2"]) . "';\n" .
549
+		"\$announce_url3 = '" . htmlspecialchars($_POST["announce_url3"]) . "';\n" .
550
+		"\$announce_url4 = '" . htmlspecialchars($_POST["announce_url4"]) . "';\n" .
523 551
 		"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
524 552
 		"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
525 553
 		"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
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,548 @@
1
+<?php
2
+require ("config.php");
3
+require_once ("funcsv2.php");
4
+//Check session
5
+session_start();
6
+
7
+if (!$_SESSION['admin_logged_in'])
8
+{
9
+	//check fails
10
+	header("Location: authenticate.php?status=session");
11
+	exit();
12
+}
13
+?>
14
+
15
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
16
+<html><head><title>Edit Config File</title>
17
+	<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
18
+	<link rel="stylesheet" href="./css/style.css" type="text/css" />
19
+</head><body>
20
+
21
+<?php
22
+//open up config file and display for editing
23
+if (!isset($_POST["saveconfig"]))
24
+{
25
+	?>
26
+	<h1>Edit Config File</h1>
27
+	<form action="<?php echo htmlentities($_SERVER['PHP_SELF']);?>" method="POST">
28
+	<input type="hidden" name="saveconfig" value="1">
29
+	<h2>This page allows you to configure the "config.php" settings.  This file stores all the necessary
30
+	settings for your tracker.  Please do NOT edit the "config.php" file directly, 
31
+	use this admin page for any changes.</h2>
32
+	<h2><span class="notice">*</span> - required value</h2>
33
+	<table border="1" cellpadding="3">
34
+	<?php
35
+	//open up config file
36
+	$fr = fopen("config.php", "r") or die(errorMessage() . "Error: couldn't read config.php!</p>");
37
+	$temp = fgets($fr);
38
+	$temp = fgets($fr);
39
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
40
+	?>
41
+	<tr><td>Make tracker hidden: This will require a login by either the admin or upload user in order to
42
+	see the torrents available on the main statistics page.  This does not mean it's a private tracker.  If you
43
+	need a private tracker, there are many other trackers out there.  Also, you will need to secure the "torrents"
44
+	folder with an .htaccess file for Apache or some other method.  The tracker will still accept all valid
45
+	connections by clients.  There is no user checking in that regard.</td>
46
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="hiddentracker"<?php if ($temp == "true") echo " checked";?>></td></tr>
47
+	<?php
48
+	$temp = fgets($fr);
49
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
50
+	?>
51
+	<tr><td>Enable or disable scraping by clients.  Generally it is safe to leave this on unless
52
+	you have a large number of torrents or users which can lead to increased bandwidth usage.  Also, scraping
53
+	can possibily be used maliciously by abusive clients.</td>
54
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="scrape"<?php if ($temp == "true") echo " checked";?>></td></tr>
55
+	<?php
56
+	$temp = fgets($fr);
57
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
58
+	?>
59
+	<tr><td>Displays custom titles on the main torrent statistics page instead of the filename. This is because the uploader script will auto-rename your uploaded filename to exactly what you specified initally or by automatically using the data from the uploaded torrent. Check this if you want the titles to be different from the filename.</td>
60
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="customtitle"<?php if ($temp == "true") echo " checked";?>></td></tr>
61
+	<?php
62
+	$temp = fgets($fr);
63
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
64
+	?>
65
+	<tr><td>Short Announce URL: You can turn on the short announce feature, making the URL end in /announce for your tracker. You should not utilize both tracker URL forms in one torrent at the same time, or you will get inconsistent results. Note: You will need the provided htaccess file, have URL rewrite capabilities, and have it properly set up to use this feature. Otherwise, leave it disabled.</td>
66
+	<td><select name="announceurl" id="announceurl">
67
+	<option title="disabled" value="announce.php"<?php if($temp == "announce.php") echo " selected=\"selected\"";?>>disabled</option>
68
+	<option title="enabled" value="announce"<?php if($temp == "announce") echo " selected=\"selected\"";?>>enabled</option>
69
+	</select>
70
+	</td>
71
+	</tr>
72
+	<?php
73
+	$temp = fgets($fr);
74
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
75
+	?>
76
+	<tr><td><span class="notice">*</span> Lists the number of torrents on each page on your torrent tracker list. Default is 10.</td>
77
+	<td><input type="text" name="indexpagelimitspecify" size="40" value="<?php echo $temp;?>"></td></tr>
78
+	<?php
79
+	$temp = fgets($fr);
80
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
81
+	?>
82
+	<tr><td><span class="notice">*</span> Lists the number of torrents on each page on the detailed statistics page. Default is 5.</td>
83
+	<td><input type="text" name="statspagelimitspecify" size="40" value="<?php echo $temp;?>"></td></tr>
84
+	<?php
85
+	$temp = fgets($fr);
86
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
87
+	?>
88
+	<tr><td><span class="notice">*</span> Maximum reannounce interval (in seconds) 1800 == 30 minutes</td>
89
+	<td><input type="text" name="report_interval" size="40" value="<?php echo $temp;?>"></td></tr>
90
+	<?php
91
+	$temp = fgets($fr);
92
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
93
+	?>
94
+	<tr><td><span class="notice">*</span> Minimum reannounce interval (also in seconds) 300 == 5 minutes</td>
95
+	<td><input type="text" name="min_interval" size="40" value="<?php echo $temp;?>"></td></tr>
96
+	<?php
97
+	$temp = fgets($fr);
98
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
99
+	?>
100
+	<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,
101
+	so please don't do that. 100 is the most you should set anyway.</td>
102
+	<td><input type="text" name="maxpeers" size="40" value="<?php echo $temp;?>"></td></tr>
103
+	<?php
104
+	$temp = fgets($fr);
105
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
106
+	?>	
107
+	<tr><td>If set, NAT checking will be performed.
108
+	This may cause trouble with some providers, so it's
109
+	off by default.</td>
110
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="NAT"<?php if ($temp == "true") echo " checked";?>></td></tr>
111
+	<?php
112
+	$temp = fgets($fr);
113
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
114
+	?>
115
+	<tr><td>Persistent MySQL connections:
116
+	Check with your webmaster to see if you're allowed to use these.
117
+	Highly recommended, especially for higher loads, but generally
118
+	not allowed unless it's a dedicated machine.</td>
119
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="persist"<?php if ($temp == "true") echo " checked";?>></td></tr>
120
+	<?php
121
+	$temp = fgets($fr);
122
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
123
+	?>
124
+	<tr><td>Allow users to override ip address.
125
+	Enable this if you know people have a legit reason to use
126
+	this function. Leave disabled otherwise.</td>
127
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="ip_override"<?php if ($temp == "true") echo " checked";?>></td></tr>
128
+	<?php
129
+	$temp = fgets($fr);
130
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
131
+	?>
132
+	<tr><td>For heavily loaded trackers, uncheck this. It will stop count the number
133
+	of downloaded bytes and the speed of the torrent, but will significantly reduce
134
+	the load.</td>
135
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="countbytes"<?php if ($temp == "true") echo " checked";?>></td></tr>
136
+	<?php
137
+	$temp = fgets($fr);
138
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
139
+	?>
140
+	<tr><td><span class="notice">*</span> Username for individual who can add torrents to tracker database.
141
+	This user is only able to create, and not delete torrents to the tracker.
142
+	For full privileges, see the admin user.</td>
143
+	<td><input type="text" name="upload_username" size="40" value="<?php echo $temp;?>"></td></tr>
144
+	<?php
145
+	$temp = fgets($fr);
146
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
147
+	?>
148
+	<tr><td><span class="notice">*</span> Password for individual who can add torrents to tracker database.
149
+	Again, this user is only able to create, and not delete torrents to the tracker.
150
+	For full privileges, see the admin user.<br><br>
151
+	<input type="hidden" name="old_upload_password" value="<?php echo $temp;?>">
152
+	<b>Current MD5 hashed username+password: <?php echo $temp;?></b></td>
153
+	<td><input type="password" name="upload_password" size="40" value=""></td></tr>
154
+	<?php
155
+	$temp = fgets($fr);
156
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
157
+	?>
158
+	<tr><td><span class="notice">*</span> Admin username. The admin is able to go to the admin page and show detailed 
159
+	information about the tracker as well as access a few other important tools.
160
+	The admin is also able to upload torrents to the database
161
+	just like the previous account.</td>
162
+	<td><input type="text" name="admin_username" size="40" value="<?php echo $temp;?>"></td></tr>
163
+	<?php
164
+	$temp = fgets($fr);
165
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
166
+	?>
167
+	<tr><td><span class="notice">*</span> Password for admin.  Again, The admin is able to go to the admin page and show detailed 
168
+	information about the tracker as well as access a few other important tools.
169
+	The admin is also able to upload torrents to the database.<br><br>
170
+	<input type="hidden" name="old_admin_password" value="<?php echo $temp;?>">
171
+	<b>Current MD5 hashed username+password: <?php echo $temp;?></b></td>
172
+	<td><input type="password" name="admin_password" size="40" value=""></td></tr>
173
+	<?php
174
+	$temp = fgets($fr);
175
+	$temp = clean(substr($temp, strpos($temp, "=")+3, -3));
176
+	?>
177
+	<tr><td>Title on index.php statistics page, if not set, defaults to "Tracker Statistics"</td>
178
+	<td><input type="text" name="title" size="40" value="<?php echo $temp;?>"></td></tr>
179
+	<?php
180
+	$temp = fgets($fr);
181
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
182
+	?>
183
+	<tr><td><span class="notice">*</span> Database Hostname: This is the MySQL database hostname, if it is the local machine, it should
184
+	be set to localhost.</td>
185
+	<td><input type="text" name="dbhost" size="40" value="<?php echo $temp;?>"></td></tr>
186
+	<?php
187
+	$temp = fgets($fr);
188
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
189
+	?>
190
+	<tr><td><span class="notice">*</span> Database Username: This is the user who has access to the database table.  If you are unsure,
191
+	check with your system administrator.</td>
192
+	<td><input type="text" name="dbuser" size="40" value="<?php echo $temp;?>"></td></tr>
193
+	<?php
194
+	$temp = fgets($fr);
195
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
196
+	?>
197
+	<tr><td><span class="notice">*</span> Database Password: This is the password for the user who has access to the database table.
198
+	If you are unsure, check with your system administrator.</td>
199
+	<td><input type="text" name="dbpass" size="40" value="<?php echo $temp;?>"></td></tr>
200
+	<?php
201
+	$temp = fgets($fr);
202
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
203
+	?>
204
+	<tr><td><span class="notice">*</span> Database name: This is the name of the database.  If you are unsure, check with
205
+	your system administrator.</td>
206
+	<td><input type="text" name="database" size="40" value="<?php echo $temp;?>"></td></tr>
207
+	<?php
208
+	$temp = fgets($fr);
209
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
210
+	?>
211
+	<tr><td>Enable RSS feed:
212
+	If you do not want the RSS feed to be created for privacy reasons or do not need it disable this checkbox.</td>
213
+	<td><input type="checkbox" value="<?php if($temp == "true") echo "on"; else echo "off"?>" name="enablerss"<?php if ($temp == "true") echo " checked";?>></td></tr>
214
+	<?php
215
+	$temp = fgets($fr);
216
+	$temp = clean(substr($temp, strpos($temp, "=")+3, -3));
217
+	?>
218
+	<tr><td>RSS Title: In the rss.xml file, this is the main <pre>&lt;title&gt;</pre> tag.</td>
219
+	<td><input type="text" name="rss_title" size="40" value="<?php echo $temp;?>"></td></tr>
220
+	<?php
221
+	$temp = fgets($fr);
222
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
223
+	?>
224
+	<tr><td>RSS link to main website: In the rss.xml file, this is the main <pre>&lt;link&gt;</pre> tag.</td>
225
+	<td><input type="text" name="rss_link" size="40" value="<?php echo $temp;?>"></td></tr>
226
+	<?php
227
+	$temp = fgets($fr);
228
+	$temp = clean(substr($temp, strpos($temp, "=")+3, -3));
229
+	?>
230
+	<tr><td>RSS description: In the rss.xml file, this is the main <pre>&lt;description&gt;</pre> tag.</td>
231
+	<td><input type="text" name="rss_description" size="60" value="<?php echo $temp;?>"></td></tr>
232
+	<?php
233
+	$temp = fgets($fr);
234
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
235
+	?>
236
+	<tr><td><span class="notice">*</span> Main website url that the tracker runs on, example: http://www.mywebsite.com</td>
237
+	<td><input type="text" name="website_url" size="40" value="<?php echo $temp;?>"></td></tr>
238
+	<?php
239
+	$temp = fgets($fr);
240
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
241
+	?>
242
+	<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>
243
+	<td><input type="text" name="max_upload_rate" size="40" value="<?php echo $temp;?>"></td></tr>
244
+	<?php
245
+	$temp = fgets($fr);
246
+	$temp = substr($temp, strpos($temp, "=")+2, -2);
247
+	?>
248
+	<tr><td><span class="notice">*</span> For HTTP seeding, this is the maximum number of uploads to run at a time</td>
249
+	<td><input type="text" name="max_uploads" size="40" value="<?php echo $temp;?>"></td></tr>
250
+	<?php
251
+	$temp = fgets($fr);
252
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
253
+	?>
254
+	<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>
255
+	<td>
256
+	<select name="dateformat" id="dateformat">
257
+	<option title="Mon, 4 Jan, 1999 01:15:40 PM" value="D, j M, Y h:i:s A"<?php if($temp == "D, j M, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, 4 Jan, 1999 01:15:40 PM</option>
258
+	<option title="Monday, 4 Jan, 1999 01:15:40 PM" value="l, j M, Y h:i:s A"<?php if($temp == "l, j M, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, 4 Jan, 1999 01:15:40 PM</option>
259
+	<option title="Mon, 4 January, 1999 01:15:40 PM" value="D, j F, Y h:i:s A"<?php if($temp == "D, j F, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, 4 January, 1999 01:15:40 PM</option>
260
+	<option title="Monday, 4 January, 1999 01:15:40 PM" value="l, j M, Y h:i:s A"<?php if($temp == "l, j F, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, 4 January, 1999 01:15:40 PM</option>
261
+	<option title="Mon, 4 Jan, 1999 13:15:40" value="D, j M, Y H:i:s"<?php if($temp == "D, j M, Y H:i:s") echo " selected=\"selected\"";?>>Mon, 4 Jan, 1999 13:15:40</option>
262
+	<option title="Monday, 4 Jan, 1999 13:15:40" value="l, j M, Y H:i:s"<?php if($temp == "l, j M, Y H:i:s") echo " selected=\"selected\"";?>>Monday, 4 Jan, 1999 13:15:40</option>
263
+	<option title="Mon, 4 January, 1999 13:15:40" value="D, j F, Y H:i:s"<?php if($temp == "D, j F, Y H:i:s") echo " selected=\"selected\"";?>>Mon, January 4, 1999 13:15:40</option>
264
+	<option title="Monday, 4 January, 1999 13:15:40" value="l, j F, Y H:i:s"<?php if($temp == "l, j F, Y H:i:s") echo " selected=\"selected\"";?>>Monday, 4 January, 1999 13:15:40</option>
265
+	<option title="Mon, Jan 4, 1999 01:15:40 PM" value="D, M j, Y h:i:s A"<?php if($temp == "D, M j, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, Jan 4, 1999 01:15:40 PM</option>
266
+	<option title="Monday, Jan 4, 1999 01:15:40 PM" value="l, M j, Y h:i:s A"<?php if($temp == "l, M j, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, Jan 4, 1999 01:15:40 PM</option>
267
+	<option title="Mon, January 4, 1999 01:15:40 PM" value="D, F j, Y h:i:s A"<?php if($temp == "D, F j, Y h:i:s A") echo " selected=\"selected\"";?>>Mon, January 4, 1999 01:15:40 PM</option>
268
+	<option title="Monday, January 4, 1999 01:15:40 PM" value="l, F j, Y h:i:s A"<?php if($temp == "l, F j, Y h:i:s A") echo " selected=\"selected\"";?>>Monday, January 4, 1999 01:15:40 PM</option>
269
+	<option title="Mon, Jan 4, 1999 13:15:40" value="D, M j, Y H:i:s"<?php if($temp == "D, M j, Y H:i:s") echo " selected=\"selected\"";?>>Mon, Jan 4, 1999 13:15:40</option>
270
+	<option title="Monday, Jan 4, 1999 13:15:40" value="l, M j, Y H:i:s"<?php if($temp == "l, M j, Y H:i:s") echo " selected=\"selected\"";?>>Monday, Jan 4, 1999 13:15:40</option>
271
+	<option title="Mon, January 4, 1999 13:15:40" value="D, F j, Y H:i:s"<?php if($temp == "D, F j, Y H:i:s") echo " selected=\"selected\"";?>>Mon, January 4, 1999 13:15:40</option>
272
+	<option title="Monday, January 4, 1999 13:15:40" value="l, F j, Y H:i:s"<?php if($temp == "l, F j, Y H:i:s") echo " selected=\"selected\"";?>>Monday, January 4, 1999 13:15:40</option>
273
+	</select>
274
+	</td>
275
+	</tr>
276
+	<?php
277
+	$temp = fgets($fr);
278
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
279
+	?>
280
+	<tr><td><span class="notice">*</span> Timezone that the server runs on</td>
281
+	<td>
282
+	<select name="timezone" id="timezone">
283
+	<option title="[UTC - 12] Baker Island Time" value="-1200"<?php if($temp == "-1200") echo " selected=\"selected\"";?>>[UTC - 12] Baker Island Time</option>
284
+	<option title="[UTC - 11] Niue Time, Samoa Standard Time" value="-1100"<?php if($temp == "-1100") echo " selected=\"selected\"";?>>[UTC - 11] Niue Time, Samoa Standard Time</option>
285
+	<option title="[UTC - 10] Hawaii-Aleutian Standard Time, Cook Island Time" value="-1000"<?php if($temp == "-1000") echo " selected=\"selected\"";?>>[UTC - 10] Hawaii-Aleutian Standard Time, Cook Isl...</option>
286
+	<option title="[UTC - 9:30] Marquesas Islands Time" value="-0930"<?php if($temp == "-0930") echo " selected=\"selected\"";?>>[UTC - 9:30] Marquesas Islands Time</option>
287
+	<option title="[UTC - 9] Alaska Standard Time, Gambier Island Time" value="-0900"<?php if($temp == "-0900") echo " selected=\"selected\"";?>>[UTC - 9] Alaska Standard Time, Gambier Island Tim...</option>
288
+	<option title="[UTC - 8] Pacific Standard Time" value="-0800"<?php if($temp == "-0800") echo " selected=\"selected\"";?>>[UTC - 8] Pacific Standard Time</option>
289
+	<option title="[UTC - 7] Mountain Standard Time" value="-0700"<?php if($temp == "-0700") echo " selected=\"selected\"";?>>[UTC - 7] Mountain Standard Time</option>
290
+	<option title="[UTC - 6] Central Standard Time" value="-0600"<?php if($temp == "-0600") echo " selected=\"selected\"";?>>[UTC - 6] Central Standard Time</option>
291
+	<option title="[UTC - 5] Eastern Standard Time" value="-0500"<?php if($temp == "-0500") echo " selected=\"selected\"";?>>[UTC - 5] Eastern Standard Time</option>
292
+	<option title="[UTC - 4] Atlantic Standard Time" value="-0400"<?php if($temp == "-0400") echo " selected=\"selected\"";?>>[UTC - 4] Atlantic Standard Time</option>
293
+	<option title="[UTC - 3:30] Newfoundland Standard Time" value="-0330"<?php if($temp == "-0330") echo " selected=\"selected\"";?>>[UTC - 3:30] Newfoundland Standard Time</option>
294
+	<option title="[UTC - 3] Amazon Standard Time, Central Greenland Time" value="-0300"<?php if($temp == "-0300") echo " selected=\"selected\"";?>>[UTC - 3] Amazon Standard Time, Central Greenland ...</option>
295
+	<option title="[UTC - 2] Fernando de Noronha Time, South Georgia &amp; the South Sandwich Islands Time" value="-0200"<?php if($temp == "-0200") echo " selected=\"selected\"";?>>[UTC - 2] Fernando de Noronha Time, South Georgia ...</option>
296
+	<option title="[UTC - 1] Azores Standard Time, Cape Verde Time, Eastern Greenland Time" value="-0100"<?php if($temp == "-0100") echo " selected=\"selected\"";?>>[UTC - 1] Azores Standard Time, Cape Verde Time, E...</option>
297
+	<option title="[UTC] Western European Time, Greenwich Mean Time" value="+0000"<?php if($temp == "+0000") echo " selected=\"selected\"";?>>[UTC] Western European Time, Greenwich Mean Time</option>
298
+	<option title="[UTC + 1] Central European Time, West African Time" value="+0100"<?php if($temp == "+0100") echo " selected=\"selected\"";?>>[UTC + 1] Central European Time, West African Time</option>
299
+	<option title="[UTC + 2] Eastern European Time, Central African Time" value="+0200"<?php if($temp == "+0200") echo " selected=\"selected\"";?>>[UTC + 2] Eastern European Time, Central African T...</option>
300
+	<option title="[UTC + 3] Moscow Standard Time, Eastern African Time" value="+0300"<?php if($temp == "+0300") echo " selected=\"selected\"";?>>[UTC + 3] Moscow Standard Time, Eastern African Ti...</option>
301
+	<option title="[UTC + 3:30] Iran Standard Time" value="+0330"<?php if($temp == "+0330") echo " selected=\"selected\"";?>>[UTC + 3:30] Iran Standard Time</option>
302
+	<option title="[UTC + 4] Gulf Standard Time, Samara Standard Time" value="+0400"<?php if($temp == "+0400") echo " selected=\"selected\"";?>>[UTC + 4] Gulf Standard Time, Samara Standard Time</option>
303
+	<option title="[UTC + 4:30] Afghanistan Time" value="+0430"<?php if($temp == "+0430") echo " selected=\"selected\"";?>>[UTC + 4:30] Afghanistan Time</option>
304
+	<option title="[UTC + 5] Pakistan Standard Time, Yekaterinburg Standard Time" value="+0500"<?php if($temp == "+0500") echo " selected=\"selected\"";?>>[UTC + 5] Pakistan Standard Time, Yekaterinburg St...</option>
305
+	<option title="[UTC + 5:30] Indian Standard Time, Sri Lanka Time" value="+0530"<?php if($temp == "+0530") echo " selected=\"selected\"";?>>[UTC + 5:30] Indian Standard Time, Sri Lanka Time</option>
306
+	<option title="[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirsk Standard Time" value="+0600"<?php if($temp == "+0600") echo " selected=\"selected\"";?>>[UTC + 6] Bangladesh Time, Bhutan Time, Novosibirs...</option>
307
+	<option title="[UTC + 6:30] Cocos Islands Time, Myanmar Time" value="+0630"<?php if($temp == "+0630") echo " selected=\"selected\"";?>>[UTC + 6:30] Cocos Islands Time, Myanmar Time</option>
308
+	<option title="[UTC + 7] Indochina Time, Krasnoyarsk Standard Time" value="+0700"<?php if($temp == "+0700") echo " selected=\"selected\"";?>>[UTC + 7] Indochina Time, Krasnoyarsk Standard Tim...</option>
309
+	<option title="[UTC + 8] Chinese Standard Time, Australian Western Standard Time, Irkutsk Standard Time" value="+0800"<?php if($temp == "+0800") echo " selected=\"selected\"";?>>[UTC + 8] Chinese Standard Time, Australian Wester...</option>
310
+	<option title="[UTC + 9] Japan Standard Time, Korea Standard Time, Chita Standard Time" value="+0900"<?php if($temp == "+0900") echo " selected=\"selected\"";?>>[UTC + 9] Japan Standard Time, Korea Standard Time...</option>
311
+	<option title="[UTC + 9:30] Australian Central Standard Time" value="+0930"<?php if($temp == "+0930") echo " selected=\"selected\"";?>>[UTC + 9:30] Australian Central Standard Time</option>
312
+	<option title="[UTC + 10] Australian Eastern Standard Time, Vladivostok Standard Time" value="+1000"<?php if($temp == "+1000") echo " selected=\"selected\"";?>>[UTC + 10] Australian Eastern Standard Time, Vladi...</option>
313
+	<option title="[UTC + 10:30] Lord Howe Standard Time" value="+1030"<?php if($temp == "+1030") echo " selected=\"selected\"";?>>[UTC + 10:30] Lord Howe Standard Time</option>
314
+	<option title="[UTC + 11] Solomon Island Time, Magadan Standard Time" value="+1100"<?php if($temp == "+1100") echo " selected=\"selected\"";?>>[UTC + 11] Solomon Island Time, Magadan Standard T...</option>
315
+	<option title="[UTC + 11:30] Norfolk Island Time" value="+1130"<?php if($temp == "+1130") echo " selected=\"selected\"";?>>[UTC + 11:30] Norfolk Island Time</option>
316
+	<option title="[UTC + 12] New Zealand Time, Fiji Time, Kamchatka Standard Time" value="+1200"<?php if($temp == "+1200") echo " selected=\"selected\"";?>>[UTC + 12] New Zealand Time, Fiji Time, Kamchatka ...</option>
317
+	<option title="[UTC + 13] Tonga Time, Phoenix Islands Time" value="+1300"<?php if($temp == "+1300") echo " selected=\"selected\"";?>>[UTC + 13] Tonga Time, Phoenix Islands Time</option>
318
+	<option title="[UTC + 14] Line Island Time" value="+1400"<?php if($temp == "+1400") echo " selected=\"selected\"";?>>[UTC + 14] Line Island Time</option>
319
+	</select>
320
+	</td>
321
+	</tr>
322
+	<?php
323
+	
324
+	//get MySQL table prefix, store in hidden form field
325
+	$temp = fgets($fr);
326
+	$temp = substr($temp, strpos($temp, "=")+3, -3);
327
+	?>
328
+	<input type="hidden" name="prefix" value="<?php echo $temp;?>" />	
329
+
330
+	<?php
331
+	fclose($fr);
332
+
333
+	?>		
334
+	</table>
335
+	<input type="submit" value="Save Config">
336
+	</form>
337
+	
338
+	<?php
339
+}
340
+
341
+
342
+if (isset($_POST["saveconfig"]))
343
+{
344
+	//check required entries for values, if blank: error out
345
+	if ($_POST["announceurl"] == "")
346
+	{
347
+		echo errorMessage() . "Error: The announce URL is blank.</p>";
348
+		exit();
349
+	}
350
+	if (!is_numeric($_POST["indexpagelimitspecify"]) || $_POST["indexpagelimitspecify"] == "" || $_POST["indexpagelimitspecify"] <= 0)
351
+	{
352
+		echo errorMessage() . "Error: The index page limit is not an integer, a negative number, or is blank.</p>";
353
+		exit();
354
+	}	
355
+	if (!is_numeric($_POST["statspagelimitspecify"]) || $_POST["statspagelimitspecify"] == "" || $_POST["statspagelimitspecify"] <= 0)
356
+	{
357
+		echo errorMessage() . "Error: The statistics page limit is not an integer, a negative number, or is blank.</p>";
358
+		exit();
359
+	}
360
+	if (!is_numeric($_POST["report_interval"]) || $_POST["report_interval"] == "" || $_POST["report_interval"] <= 0)
361
+	{
362
+		echo errorMessage() . "Error: The maximum reannounce interval is not an integer, a negative number, or is blank.</p>";
363
+		exit();
364
+	}
365
+	if (!is_numeric($_POST["min_interval"]) || $_POST["min_interval"] == "" || $_POST["min_interval"] <= 0)
366
+	{
367
+		echo errorMessage() . "Error: The minimum reannounce interval is not an integer, a negative number, or is blank.</p>";
368
+		exit();
369
+	}
370
+	if (!is_numeric($_POST["maxpeers"]) || $_POST["maxpeers"] == "" || $_POST["maxpeers"] > 300 || $_POST["maxpeers"] <= 0)
371
+	{
372
+		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>";
373
+		exit();
374
+	}
375
+	if ($_POST["upload_username"] == "")
376
+	{
377
+		echo errorMessage() . "Error: The upload username is blank.</p>";
378
+		exit();
379
+	}
380
+	if ($_POST["admin_username"] == "")
381
+	{
382
+		echo errorMessage() . "Error: The admin username is blank.</p>";
383
+		exit();
384
+	}
385
+	if ($_POST["dbhost"] == "")
386
+	{
387
+		echo errorMessage() . "Error: The database hostname is blank.</p>";
388
+		exit();
389
+	}
390
+	if ($_POST["dbuser"] == "")
391
+	{
392
+		echo errorMessage() . "Error: The database username is blank.</p>";
393
+		exit();
394
+	}
395
+	if ($_POST["dbpass"] == "")
396
+	{
397
+		echo errorMessage() . "Error: The database password is blank.</p>";
398
+		exit();
399
+	}
400
+	if ($_POST["database"] == "")
401
+	{
402
+		echo errorMessage() . "Error: The database name is blank.</p>";
403
+		exit();
404
+	}
405
+	if ($_POST["rss_link"] != "" && Substr($_POST["rss_link"], 0, 7) != "http://")
406
+	{
407
+		echo errorMessage() . "Error: The RSS website URL does not start with http://</p>";
408
+		exit();
409
+	}
410
+	if ($_POST["website_url"] == "" || Substr($_POST["website_url"], 0, 7) != "http://")
411
+	{
412
+		echo errorMessage() . "Error: The website URL does not start with http:// or is blank.</p>";
413
+		exit();
414
+	}
415
+	if (!is_numeric($_POST["max_upload_rate"]) || $_POST["max_upload_rate"] == "" || $_POST["max_upload_rate"] <= 0)
416
+	{
417
+		echo errorMessage() . "Error: The maximum upload rate is not an integer, a negative number, or is blank.</p>";
418
+		exit();
419
+	}
420
+	if (!is_numeric($_POST["max_uploads"]) || $_POST["max_uploads"] == "" || $_POST["max_uploads"] <= 0)
421
+	{
422
+		echo errorMessage() . "Error: The maximum uploads is not an integer, a negative number, or is blank.</p>";
423
+		exit();
424
+	}
425
+	if ($_POST["dateformat"] == "")
426
+	{
427
+		echo errorMessage() . "Error: The date format is blank.</p>";
428
+		exit();
429
+	}
430
+	if ($_POST["timezone"] == "")
431
+	{
432
+		echo errorMessage() . "Error: The timezone is blank.</p>";
433
+		exit();
434
+	}
435
+	if ($_POST["upload_username"] == $_POST["admin_username"])
436
+	{
437
+		echo errorMessage() . "Error: The admin username cannot be the same as the upload username.</p>";
438
+		exit();
439
+	}
440
+	
441
+	//calculate new MD5 password if needed
442
+	if ($_POST["upload_password"] != "")
443
+	{
444
+		$_POST["upload_password"] = md5($_POST["upload_username"].$_POST["upload_password"]);
445
+	}
446
+	else
447
+		$_POST["upload_password"] = $_POST["old_upload_password"];
448
+	if ($_POST["admin_password"] != "")
449
+	{
450
+		$_POST["admin_password"] = md5($_POST["admin_username"].$_POST["admin_password"]);
451
+	}
452
+	else
453
+		$_POST["admin_password"] = $_POST["old_admin_password"];
454
+		
455
+	//check if config.php has write access
456
+	if (is_writable("config.php"))
457
+	{
458
+		//go through checkboxes and change "on" to "true"
459
+		if (isset($_POST["hiddentracker"]))
460
+			$hiddentracker = "true";
461
+		else
462
+			$hiddentracker = "false";
463
+		if (isset($_POST["enablerss"]))
464
+			$enablerss = "true";
465
+		else
466
+			$enablerss = "false";
467
+		if (isset($_POST["scrape"]))
468
+			$scrape = "true";
469
+		else
470
+			$scrape = "false";
471
+		if (isset($_POST["customtitle"]))
472
+			$customtitle = "true";
473
+		else
474
+			$customtitle = "false";
475
+		if (isset($_POST["NAT"]))
476
+			$NAT = "true";
477
+		else
478
+			$NAT = "false";
479
+		if (isset($_POST["persist"]))
480
+			$persist = "true";
481
+		else
482
+			$persist = "false";
483
+		if (isset($_POST["ip_override"]))
484
+			$ip_override = "true";
485
+		else
486
+			$ip_override = "false";
487
+		if (isset($_POST["countbytes"]))
488
+			$countbytes = "true";
489
+		else
490
+			$countbytes = "false";
491
+
492
+		//write config.php file
493
+		$fd = fopen("config.php", "w") or die(errorMessage() . "Warning: write to config.php!</p>");
494
+		fwrite($fd, 
495
+		"<?php //Please do NOT edit this file, use the admin page for changes.\n" .
496
+		"\$GLOBALS['hiddentracker'] = " . $hiddentracker . ";\n" .
497
+		"\$GLOBALS['scrape'] = " . $scrape . ";\n" .
498
+		"\$GLOBALS['customtitle'] = " . $customtitle . ";\n" .
499
+		"\$announceurl = '" . htmlspecialchars($_POST["announceurl"]) . "';\n" .
500
+		"\$GLOBALS['indexpagelimitspecify'] = " . htmlspecialchars($_POST["indexpagelimitspecify"]) . ";\n" .
501
+		"\$GLOBALS['statspagelimitspecify'] = " . htmlspecialchars($_POST["statspagelimitspecify"]) . ";\n" .
502
+		"\$GLOBALS['report_interval'] = " . htmlspecialchars($_POST["report_interval"]) . ";\n" .
503
+		"\$GLOBALS['min_interval'] = " . htmlspecialchars($_POST["min_interval"]) . ";\n" .
504
+		"\$GLOBALS['maxpeers'] = " . htmlspecialchars($_POST["maxpeers"]) . ";\n" .
505
+		"\$GLOBALS['NAT'] = " . $NAT . ";\n" .
506
+		"\$GLOBALS['persist'] = " . $persist . ";\n" .
507
+		"\$GLOBALS['ip_override'] = " . $ip_override . ";\n" .
508
+		"\$GLOBALS['countbytes'] = " . $countbytes . ";\n" .
509
+		"\$upload_username = '" . htmlspecialchars($_POST["upload_username"]) . "';\n" .
510
+		"\$upload_password = '" . htmlspecialchars($_POST["upload_password"]) . "';\n" .
511
+		"\$admin_username = '" . htmlspecialchars($_POST["admin_username"]) . "';\n" .
512
+		"\$admin_password = '" . htmlspecialchars($_POST["admin_password"]) . "';\n" .
513
+		"\$GLOBALS['title'] = '" . htmlspecialchars(addquotes($_POST["title"])) . "';\n" .
514
+		"\$dbhost = '" . htmlspecialchars($_POST["dbhost"]) . "';\n" .
515
+		"\$dbuser = '" . htmlspecialchars($_POST["dbuser"]) . "';\n" .
516
+		"\$dbpass = '" . htmlspecialchars($_POST["dbpass"]) . "';\n" .
517
+		"\$database = '" . htmlspecialchars($_POST["database"]) . "';\n" .
518
+		"\$enablerss = " . $enablerss . ";\n" .
519
+		"\$rss_title = '" . htmlspecialchars(addquotes($_POST["rss_title"])) . "';\n" .
520
+		"\$rss_link = '" . htmlspecialchars($_POST["rss_link"]) . "';\n" .
521
+		"\$rss_description = '" . htmlspecialchars(addquotes($_POST["rss_description"])) . "';\n" .
522
+		"\$website_url = '" . htmlspecialchars($_POST["website_url"]) . "';\n" .
523
+		"\$GLOBALS['max_upload_rate'] = " . htmlspecialchars($_POST['max_upload_rate']) . ";\n" .
524
+		"\$GLOBALS['max_uploads'] = " . htmlspecialchars($_POST['max_uploads']) . ";\n" .
525
+		"\$dateformat = '" . htmlspecialchars($_POST["dateformat"]) . "';\n" .
526
+		"\$timezone = '" . htmlspecialchars($_POST["timezone"]) . "';\n" .
527
+		"\$prefix = '" . htmlspecialchars($_POST["prefix"]) . "';\n" .
528
+		"?>"
529
+		);
530
+
531
+		fclose($fd);
532
+		echo "<br><p class=\"success\">config.php file was edited successfully!</p>\n";
533
+		
534
+		//run RSS generator
535
+		require_once("rss_generator.php");
536
+	}
537
+	else
538
+	{
539
+		echo errorMessage() . "config.php was not able to be written.  Please check the permissions and try again.</p>\n";
540
+	}
541
+}
542
+
543
+?>
544
+<br>
545
+<br>
546
+<a href="admin.php"><img src="images/admin.png" border="0" class="icon" alt="Admin Page" title="Admin Page" /></a><a href="admin.php">Return to Admin Page</a>
547
+</body>
548
+</html>