C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$RTL8YJG\admin\install.php


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
<?php
/* $Id: install.php,v 1.2 2002/11/06 22:44:10 pbaecher Exp $ */
/*
          phpInstaller - PHP Script Installer
        ==============================================
            (c) 2002 by
               Paul Baecher         <paul@thewall.de>

          This  program is  free  software;  you can
          redistribute it and/or modify it under the
          terms of the GNU General Public License as
          published by the Free Software Foundation;
          either  version 2 of  the License,  or (at
          your option) any later version.

        ==============================================
*/
function check_php_version ($version)
{
    
$testSplit explode ('.'$version);
    
$currentSplit explode ('.'phpversion ());
    
    if( 
$testSplit[0] < $currentSplit[0] )
    {
        return 
true;
    }
    if( 
$testSplit[0] == $currentSplit[0] )
    {
        if( 
$testSplit[1] < $currentSplit[1] )
        {
            return 
true;
        }
        if( 
$testSplit[1] == $currentSplit[1] )
        {
            if( 
$testSplit[2] <= $currentSplit[2] )
            {
                return 
true;
            }
        }
    }
    
    return 
false;
}

if( !
check_php_version('4.0.6') )
{
    die(
'ThWboard install can not be performed because the PHP version used is to old ( < 4.0.6 ).<br>Please ask your webmaster or server administrator for updating the PHP version.');
}

require(
'install_functions.php');

if( !isset(
$action) )
{
    
$action '';
}

if( !
install_allowed() && $action != 'about' && $action != '' )
{
    
$action 'deny';
}

switch( 
$action )
{
    case 
'generate_config':
        
header('Content-Type: application/octetstream');
        
header('Content-Disposition: filename="config.inc.php"');
        
header('Pragma: no-cache');
        
header('Expires: 0');

        print 
'<?php
/* This file has been generated by the install script. You
need to upload it into your inc/ directory! */
$mysql_h    = "'
.$hostname.'";
$mysql_u    = "'
.$user.'";
$mysql_p    = "'
.$pass.'";
$mysql_db    = "'
.$db.'";
$pref        = "'
.$prefix.'";
$inst_lock    = TRUE;
?>'
;
        break;

    case 
'createadmin':
        if( 
strlen($admin_pass) < )
        {
            
p_errormsg(lng('error'), lng('adminpwtooshort'));
        }
    
        
mysql_connect($hostname$user$pass);
        
mysql_select_db($db);

        
thwb_query("INSERT INTO $prefix"."user (username, useremail, userpassword, userisadmin, userjoin, groupids, usernodelete) VALUES
            ('
$admin_user', '$admin_email', '".md5($admin_pass)."', '1', ".time().", ',3,', '1')");
        
        
p_header();
        
p_prewrite($hostname$user$pass$db$prefix);
        
p_footer('writeconfig', array(
            
'hostname' => $hostname,
            
'user' => $user,
            
'pass' => $pass,
            
'db' => $db,
            
'prefix' => $prefix
        
));
        break;

    case 
'createtables':
        
mysql_connect($hostname$user$pass);
        
mysql_select_db($db);
        
        
create_tables($delete_existing);
        
        
p_header();
        
p_adminprofile();
        
p_footer('createadmin', array(
            
'hostname' => $hostname,
            
'user' => $user,
            
'pass' => $pass,
            
'db' => $db,
            
'prefix' => $prefix
        
));
        break;
        
    case 
'writeconfig':
        if( !
WriteAccess('../inc/config.inc.php') )
        {
            
p_errormsg(lng('error'), lng('chmoderror'));
        }
        else
        {
            
$fp = @fopen('../inc/config.inc.php''w');
            
fwrite($fp'<?php
$mysql_h    = "'
.$hostname.'";
$mysql_u    = "'
.$user.'";
$mysql_p    = "'
.$pass.'";
$mysql_db    = "'
.$db.'";
$pref        = "'
.$prefix.'";
$inst_lock    = TRUE;
?>'
);
            
fclose($fp);
            
            
p_header();
            
p_done();
            
p_footer();
        }
        break;

    case 
'setprefix':
        
mysql_connect($hostname$user$pass);

        
$db '';
        if( 
$name_db && $selected_db == '_usefield' )
        {
            
$db $name_db;
        }
        else
        {
            
$db $selected_db;
        }

        if( !
db_exists($db) )
        {
            if( !
mysql_create_db($db) )
            {
                
p_errormsg(lng('error'), sprintf(lng('mysqlerror'), $dbmysql_error()));
            }
        }
        
        
mysql_select_db($db);
        
        
$r_table mysql_list_tables($db);
        
$a_tables = array();
        
$i 0;
        while( 
$i mysql_num_rows($r_table) )
        {
            
$tables[] = mysql_tablename($r_table$i);
            
$i++;
        }
        
        
p_header();
        
p_chooseprefix($db$tables);
        
p_footer('createtables', array(
            
'hostname' => $hostname,
            
'user' => $user,
            
'pass' => $pass,
            
'db' => $db,
        ));
        break;

    case 
'selectdb':
        
$dbhandle = @mysql_connect($hostname$user$pass);
        if( !
$dbhandle )
        {
            
p_errormsg(lng('error'), sprintf(lng('connecterror'), mysql_error()));
        }
        
        
$r_database mysql_listdbs();
        
        
$databases '';
        
$i 0;
        while( 
$i mysql_num_rows($r_database) )
        {
            
$databases .= '<option value="'.mysql_tablename($r_database$i).'">'.lng('existingdb').': '.mysql_tablename($r_database$i).'</option>';
            
$i++;
        }

        
p_header();
        
p_selectdb($databases);
        
p_footer('setprefix', array(
            
'hostname' => $hostname,
            
'user' => $user,
            
'pass' => $pass
        
));
        break;

    case 
'mysqldata':
        if( 
$accept != 'yes' )
        {
            
p_errormsg(lng('error'), lng('licaccept'));
        }
        else
        {
            
p_header();
            
p_mysqldata();
            
p_footer('selectdb');
        }
        break;

    case 
'license':
        
p_header();
        
p_license();
        
p_footer('mysqldata');
        break;

    case 
'about':
        
p_header();
        
p_about();
        
p_footer();
        break;

    case 
'deny':
        
p_header();
        
p_deny_install();
        
p_footer();
        break;

    case 
'welcome':        
        
p_header();
        
p_welcome();
        
p_footer('license');
        break;

    default:
        
p_header();
        
p_selectlang();
        
p_footer('welcome');

}
?>