-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathinstall.php
More file actions
286 lines (268 loc) · 7.56 KB
/
install.php
File metadata and controls
286 lines (268 loc) · 7.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
<?php
//IFS 1.13n Custom Installer
//Possible Options: ($_POST['action'])
//action=<empty> : Default, shows Database login options
//action=one : Detect path settings, Show basic options
//action=two : Install Core Scripts, Ask for default tf/tg's
//action=final : Show success screen
define(CONFIG_FILE, "configuration.php");
?>
<html>
<head><title>IFS Install</title>
<style>
body {
background-color: #000000;
color: #ffffff;
}
table {
border: 1px solid #ffffff;
}
</style>
</head>
<body>
<?
switch($_GET['action']) {
case "one":
//Check Database connection
if($link = mysql_connect($_POST['hostname'],$_POST['username'],$_POST['password'])) {
//Connection Success!
$query = "SHOW DATABASES";
$result = mysql_query($query,$link);
?>
<form action="?action=two" method="POST">
<input type="hidden" name="username" value="<? echo $_POST['username']; ?>">
<input type="hidden" name="password" value="<? echo $_POST['password']; ?>">
<input type="hidden" name="hostname" value="<? echo $_POST['hostname']; ?>">
<table align="center" width="700">
<tr>
<td><h2>IFS Installation</h2></td>
</tr>
<tr>
<td colspan="2">Please Select the database you wish to install IFS to</td>
</tr>
<tr>
<td></td>
<td>
<select name="Database">
<?
while($db = mysql_fetch_array($result)) {
?>
<option value="<? echo $db[0]; ?>"><? echo $db[0]; ?></option>
<?
}
?>
</select>
</td>
</tr>
<tr>
<td><br><b>Table Prefixes</b></td>
</tr>
<tr>
<td>IFS Tables</td>
<td><input type="text" name="ifs_pre" value="ifs_"></td>
</tr>
<tr>
<td>Mambo Tables</td>
<td><input type="text" name="www_pre" value="www_"></td>
</tr>
<tr>
<td>Ship Database Tables</td>
<td><input type="text" name="sdb_pre" value="sdb_"></td>
</tr>
<tr>
<td><br><b>Fleet Settings</b></td>
</tr>
<tr>
<td>Fleet Name</td>
<td><input type="text" name="fleetname" width="40"></td>
</tr>
<tr>
<td>Fleet Description</td>
<td><textarea name="fleetdesc" rows="4" cols="40">This text will appear in the bottom section of your front page, and is generally used to describe your fleet.</textarea></td>
</tr>
<tr>
<td>Fleet Banner</td>
<td><input type="text" name="fleetbanner" value="images/example-banner.jpg" size="30"></td>
</tr>
<tr>
<td>Maximum Characters Per Player</td>
<td><input type="text" name="maxchars" value="5" size="10"></td>
</tr>
<tr>
<td><br><b>Email Settings</b></td>
</tr>
<tr>
<td>Webmaster Email</td>
<td><input type="text" name="webemail" value="user@domain.com" size="30"></td>
</tr>
<tr>
<td>Site Email</td>
<td><input type="text" name="frommail" value="IFS Mail <user@domain.com>" size="30"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value=" Next Step "></td>
</tr>
</table>
</form>
<?
} else {
echo "Could not establish a connection. Please go <a href=\"#\" onclick=\"history.back();\">Back</a> and check your connection settings";
}
break;
case "two":
//Build Config File
$output = "<?php
/***
* INTEGRATED FLEET MANAGEMENT SYSTEM
* OBSIDIAN FLEET
* http://www.obsidianfleet.net/ifs/
*
* Developer: Frank Anon
* fanon@obsidianfleet.net
*
* Updated By: Nolan
* john.pbem@gmail.com
*
* Version: 1.13n (Nolan Ed.)
* Release Date: June 3, 2004
* Patch 1.13n: December 2009
*
* Copyright (C) 2003-2004 Frank Anon for Obsidian Fleet RPG
* Distributed under the terms of the GNU General Public License
* See doc/LICENSE for details
*
* This file contains code from Mambo Site Server 4.0.12
* Copyright (C) 2000 - 2002 Miro International Pty Ltd
*
* Date: 6/03/04
* Comments: Configuration variables
*
* See CHANGELOG for patch details
*
***/
/********************
* mySQL settings *
********************/
\$host = '".$_POST['hostname']."'; // mySQL server
/* Feel free to change the following prefixes. The install script reads this
config file, so you don't need to worry about the defaults. */
\$mpre = '".$_POST['www_pre']."'; // prefix for webpage-related tables
\$spre = '".$_POST['ifs_pre']."'; // prefix for simm-related tables
\$sdb = '".$_POST['sdb_pre']."'; // prefix for shipdb tables
\$user = '".$_POST['username']."'; // mySQL username
\$password = '".$_POST['password']."'; // mySQL password
\$db = '".$_POST['Database']."'; // mySQL database
/********************
* Email config *
********************/
// The \"from\" address of IFS-generated email
\$emailfrom = \"".$_POST['frommail']."\";
// The webmaster's email address
\$webmasteremail = \"".$_POST['webemail']."\";
/********************
* Misc Settings *
********************/
\$maxchars = \"".$_POST['maxchars']."\"; // Max. number of characters per player
\$fleetname = '".$_POST['fleetname']."'; // Name of the fleet
\$live_site = 'http://".$_SERVER['SERVER_NAME'].dirname($_SERVER['PHP_SELF'])."'; // URL to your site
\$fleetdesc = '".$_POST['fleetdesc']."';
\$fleetbanner = '".$_POST['fleetbanner']."'; //
// Legacy settings from the Mambo config file. Dunno how important they are
// Path settings
\$base_path = '".$_SERVER['DOCUMENT_ROOT'].dirname($_SERVER['PHP_SELF'])."/';
\$pdf_path = \$base_path . 'pdf/';
\$image_path = \$base_path . 'images/stories';
\$sitename = \$fleetname;
\$col = 3;
\$row = 3;
if (\$directory !='uploadfiles'){
\$title[0] = 'Story Images';
\$dir[0]=\$base_path . 'images/stories';
\$picurl[0]=\$live_site . '/images/stories/';
\$tndir[0]=\$live_site . '/images/stories/';
} else {
\$title[0]='Uploaded File Images';
\$dir[0]=\$base_path . 'uploadfiles/\$Itemid';
\$picurl[0]=\$live_site . '/uploadfiles/\$Itemid';
\$tndir[0]=\$live_site . '/uploadfiles/\$Itemid';
}
/********************
* Various IDs *
********************/
// you shouldn't need to touch this unless you've been playing with the db
define (\"UNASSIGNED_SHIP\", \"1\");
define (\"TRANSFER_SHIP\", \"2\");
define (\"DELETED_SHIP\", \"3\");
define (\"FSS_SHIP\", \"4\");
define (\"PENDING_RANK\", \"1\");
/********************
* Constants *
********************/
// you shouldn't need to touch these, either. In fact, don't. =)
define (\"email-from\", \$emailfrom);
define (\"fleetname\", \$fleetname);
define (\"webmasteremail\", \$webmasteremail);
define (\"live_site\", \$live_site);
?>";
$handle = fopen(CONFIG_FILE, "wb");
if(fwrite($handle,$output)) {
//Success!
include "manual_install.php";
//If Linux, chmod settings file back to 755
@chmod(CONFIG_FILE,0755);
?>
<table align="center" width="700">
<tr>
<td><h2>IFS Has been successfully installed!</h2></td>
</tr>
<tr>
<td><br>Click <a href="index.php">here</a> to go to your installation, and login using admin/admin to get started.</td>
</tr>
</table>
<?
} else {
//Failure.
echo "Error occured during writing. Check configuration file is writeable";
}
fclose($handle);
break;
default:
//Check if settings file is writeable
if(file_exists(CONFIG_FILE) && is_writeable(CONFIG_FILE)) {
?>
<form action="?action=one" method="POST">
<table align="center" width="700">
<tr>
<td colspan="2"><h2>Welcome to the IFS Installer</h2></td>
</tr>
<tr>
<td colspan="2">Please Input Your MySQL Username and Password</td>
</tr>
<tr>
<td>Username</td>
<td><input type="text" size="20" name="username"></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" size="20" name="password"></td>
</tr>
<tr>
<td>Hostname</td>
<td><input type="text" size="20" name="hostname" value="localhost"></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value=" Next Step "></td>
</tr>
</table>
</form>
<?
} else {
echo "Cannot write to file, please make sure File exists and has write permissions";
}
break;
}
?>
</body>
</html>