C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$RTL8YJG\inc\header.inc.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
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
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
<?php
/* $Id: header.inc.php,v 1.10 2003/01/02 13:49:46 superhausi Exp $ */
/*
          ThWboard - PHP/MySQL Bulletin Board System
        ==============================================
            (c) 2000, 2001 by
               Paul Baecher         <paul@thewall.de>
               Felix Gonschorek   <funner@thewall.de>

          download the latest version:
            http://www.thwboard.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.

        ==============================================

*/

if( !@include('./inc/config.inc.php') )
{
    print 
'Das Forum ist noch nicht installiert! Klicken Sie <a href="./admin/install.php">hier</a>, um mit der Installation zu beginnen.';
    exit;
}
include(
'./inc/functions.inc.php');
include(
'./inc/thwbcode.inc.php');

if( !
$pref )
{
    
$pref 'thwb_';
}

error_reporting(7); // E_ERROR | E_WARNING | E_PARSE
set_magic_quotes_runtime(0);

// php 4.1+
if( !empty($_REQUEST) )
    
extract($_REQUEST);

if( 
get_magic_quotes_gpc() )
{
    
$HTTP_GET_VARS r_stripslashes($HTTP_GET_VARS);
    
$HTTP_POST_VARS r_stripslashes($HTTP_POST_VARS);
    
$HTTP_COOKIE_VARS r_stripslashes($HTTP_COOKIE_VARS);
    
$GLOBALS r_stripslashes($GLOBALS);
}

// most apps (icq, outlook) treat urls containing [ or ] incorrectly. thus,
// we have to acceppt threadid, postid, boardid, categoryid if set.
if( isset($threadid) )
{
    
$thread['threadid'] = $threadid;
}
if( isset(
$boardid) )
{
    
$board['boardid'] = $boardid;
}
if( isset(
$postid) )
{
    
$post['postid'] = $postid;
}
if( isset(
$categoryid) )
{
    
$category['categoryid'] = $categoryid;
}
if( isset(
$userid) )
{
    
$user['userid'] = $userid;
}

if( !(
$REMOTE_ADDR = @getenv('REMOTE_ADDR')) )
    
$REMOTE_ADDR = @getenv('HTTP_X_FORWARDED_FOR');

if( isset(
$board['boardid']) && $board['boardid'] < )
{
    
header('Location: index.php?categoryid='.(intval($board['boardid']) * -1));
    exit;
}

/*
################################################################################
            code start
################################################################################
*/

$mysql = @mysql_connect($mysql_h$mysql_u$mysql_p);
$db = @mysql_select_db($mysql_db);

$mysql_h ''$mysql_u ''$mysql_p ''$mysql_db '';

if( !
$mysql || !$db )
{
    print 
'<b>Sorry</b><br><br>Es gibt momentan leider ein kleines Datenbank-Problem, bitte versuche es sp&#xE4;ter noch einmal.';
    exit;
}

define('P_VIEW'<< 0);
define('P_REPLY'<< 1);
define('P_POSTNEW'<< 2);
define('P_CLOSE'<< 3);
define('P_DELTHREAD'<< 4);
define('P_OMOVE'<< 5);
define('P_DELPOST'<< 6);
define('P_EDIT'<< 7);
define('P_OCLOSE'<< 8);
define('P_ODELTHREAD'<< 9);
define('P_ODELPOST'<< 10);
define('P_OEDIT'<< 11);
define('P_TOP'<< 12);
define('P_EDITCLOSED'<< 13);
define('P_IP'<< 14);
define('P_EDITTOPIC'<< 15);
define('P_NOFLOODPROT'<< 16);
define('P_NOEDITLIMIT'<< 17);
define('P_CANSEEINVIS'<< 18);
define('P_NOPMLIMIT'<< 19);
define('P_INTEAM'<< 20);
define('P_CEVENT'<< 21);
/* Note: Bits 1 to 27 are reserved for thwb, use 28 to 31 for hacks! */

define("BWORD_NONE"0);
define("BWORD_TOPIC"1);
define("BWORD_POST"2);
define("BWORD_ALL"3);

/*
################################################################################
            Creating config array
################################################################################
*/

$r_registry thwb_query("SELECT keyname, keyvalue, keytype FROM " $pref "registry");
while ( 
$registry mysql_fetch_array($r_registry) )
{
    switch( 
$registry['keytype'] )
    {
        case 
'integer':
        case 
'boolean':
            
$config[$registry['keyname']] = intval($registry['keyvalue']);
            break;
            
        case 
'array':
            if( 
$registry['keyvalue'] )
            {
                
$array explode("\n"$registry['keyvalue']);
                while( list(
$k$v) = @each($array) )
                    
$array[$k] = '"'.addslashes(trim($v)).'"';
                eval(
"\$config[\$registry['keyname']] = array(".implode(','$array).");");
            }
            break;
                
        default:
            
$config[$registry['keyname']] = $registry['keyvalue'];
    }
}

/*
################################################################################
            verify cookie data and create g_user[]
################################################################################
*/

$thwb_cookie $HTTP_COOKIE_VARS['thwb_cookie'];

$thwb_cookie_userid substr($thwb_cookie32);
$thwb_cookie_userpassword substr($thwb_cookie032);

$r_user thwb_query("SELECT username, useremail, userid, userpassword, userhidesig,
    userbanned, userisadmin, userlastpost, usernoding, styleid, groupids FROM "
.$pref."user
    WHERE userid='"
.intval($thwb_cookie_userid)."'");
$g_user mysql_fetch_array($r_user);

if( 
$thwb_cookie_userpassword != $g_user['userpassword'] || mysql_num_rows($r_user) < )
{
    unset(
$g_user);
    
$g_user['userid'] = 0;
    
$g_user['groupids'] = $config['guest_groupid'];
    
$g_user['username'] = "Gast";

    
$option[] = '<a href="register.php">Registrieren</a>';
    
$uri $HTTP_SERVER_VARS['REQUEST_URI'];
    if( !
stristr$uri'login.php' ) )
    {
        if( 
substr($uri, -11) != '/' )
            
$path urlencode(basename($HTTP_SERVER_VARS['REQUEST_URI']));
        else
            
$path '';
    }
    
$option[] = '<a href="login.php?source='.$path.'">Einloggen</a>';
}
else
{
    
$option[] = '<a href="pm.php">Private Messages</a>';
    
$option[] = '<a href="editprofile.php">Profil</a>';
    
$g_user['groupids'] = substr($g_user['groupids'], 1strlen($g_user['groupids']) - 2);

    if( !
$g_user['userbanned'] )
    {
        
$option[] = '<a href="logout.php">Logout</a>';
    }
}
$g_user['userhtmlname'] = parse_code($g_user['username']);

// online
thwb_query("INSERT INTO ".$pref."online (onlineip, onlinetime, userid)
    VALUES ('" 
$HTTP_SERVER_VARS['REMOTE_ADDR'] . "', '" time() . "', '" $g_user['userid'] . "');");

if( 
time() % 60 55 )
{
    
// delete some old records
    
thwb_query("DELETE FROM ".$pref."online WHERE onlinetime<" . (time() - 300));
}

if( 
$config['forumclosed'] && !$g_user['userisadmin'] )
{
    
$navpath 'Forum geschlossen!';
    
message('Forum geschlossen'parse_code(implode("\n"$config['closedmsg']), 1111));
}


/*
################################################################################
            create head options [ register ] [ ..
################################################################################
*/
$option[] = '<a href="help.php">Hilfe/FAQ</a>';
$option[] = '<a href="search.php">Suche</a>';
$option[] = '<a href="memberlist.php">Memberlist</a>';
$option[] = '<a href="index.php">Home</a>';
// $option[] = '<a href="stats.php">Statistik</a>';
$option[] = '<a href="calendar.php">Kalender</a>';
$option[] = '<a href="team.php">Staff</a>';
if( 
$g_user['userisadmin'] )
{
    
$option[] = '<a href="./admin/" target="_blank">Admincenter</a>';
}

$options implode(' || '$option);

if( 
$g_user['userbanned'] == )
{
    
$r_ban thwb_query("SELECT banpubreason, banexpire FROM ".$pref."ban WHERE userid=$g_user[userid]");
    
$ban mysql_fetch_array($r_ban);
    
    if( 
$ban['banexpire'] > time() || $ban['banexpire'] == )
    {
        
$message "Sie sind gebannt<br><br>Grund: <i>" 
            
. ($ban[banpubreason] ? $ban[banpubreason] : "(Keine Angabe)") . "</i><br><br>Dieser Ban"
            
. ($ban[banexpire] ? (" ist gültig bis: " form_date($ban[banexpire]) . ".") : " ist permanent." )
            . 
"<br><br><br>Hinweis: Die Forumadministration behält sich das Recht vor,
Benutzer gegebenenfalls ohne Angabe eines Grundes
permanent vom Posten abzuhalten.
$style[smallfontend]";
        
        
message("Fehler"$message);
    }
    else
    {
        
thwb_query("UPDATE ".$pref."user SET userbanned=0 WHERE userid=$g_user[userid]");
        
thwb_query("DELETE FROM ".$pref."ban WHERE userid=$g_user[userid]");
    }
}




/*
################################################################################
            add debug messages to $DEBUG string
################################################################################
*/
if ( $g_user['userisadmin'] && $config['debugmode'] )
{
    
$DEBUG '<b>Debug Messages:</b><br>'.$DEBUG;
}

/*
################################################################################
            lastvisited stuff
################################################################################
*/
if( ereg("board.php"$PHP_SELF) )
{
    if( 
$g_user['userid'] != )
    {
        
$r_lastvisited thwb_query("SELECT lastvisitedtime FROM ".$pref."lastvisited WHERE userid=$g_user[userid] AND boardid='".intval($board['boardid'])."'");
            
$lastvisited mysql_fetch_array($r_lastvisited);
            
        if( !
$lastvisited['lastvisitedtime'] )
        {
            
// new user
            
thwb_query("INSERT INTO ".$pref."lastvisited (userid, boardid, lastvisitedtime) VALUES($g_user[userid]$board[boardid], " time() . ")");
            
$lastvisited 0;
        }
        else
        {
            
$lastvisited $lastvisited['lastvisitedtime'];
            
thwb_query("UPDATE ".$pref."lastvisited SET lastvisitedtime=" time() . " WHERE userid=$g_user[userid] AND boardid='".intval($board['boardid'])."'");
        }
    }
}


/*
################################################################################
            get parents ( threadid by postid  ..)
################################################################################
*/

if( isset($post['postid']) )
{
    
$post['postid'] = intval($post['postid']);
    
$r_post thwb_query("SELECT postid, threadid FROM ".$pref."post WHERE postid='$post[postid]'");
    if( 
mysql_num_rows($r_post) < )
    {
        
message("Fehler""Post existiert nicht");
    }
    
$post mysql_fetch_array($r_post);

    
$thread['threadid'] = $post['threadid'];
}

if( isset(
$thread['threadid']) )
{
    
$thread['threadid'] = intval($thread['threadid']);
    
$r_thread thwb_query("SELECT threadid, boardid, threadtopic, threadreplies, threadclosed
        FROM "
.$pref."thread WHERE threadid='$thread[threadid]'");
    if( 
mysql_num_rows($r_thread) < )
    {
        
message("Fehler""Thread existiert nicht");
    }
    
$thread mysql_fetch_array($r_thread);
    
    
$navigation[] = "<a class=\"bglink\" href=\"showtopic.php?threadid=$thread[threadid]&time=$time\">" parse_code($thread['threadtopic']) . "</a>";
    
$board['boardid'] = $thread['boardid'];
}

if( isset(
$board['boardid']) )
{
    
$board['boardid'] = intval($board['boardid']);
    
$r_board thwb_query("SELECT boardid, boardname, styleid, boardthreads, boarddisabled FROM ".$pref."board WHERE boardid=$board[boardid]");
    if( 
mysql_num_rows($r_board) < )
    {
        
message("Fehler""Board existiert nicht");
    }
    
$board mysql_fetch_array($r_board);
    
    
$navigation[] = "<a class=\"bglink\" href=\"board.php?boardid=$board[boardid]&time=$time\">$board[boardname]</a>";
}


/*
################################################################################
            get style
################################################################################
*/
if( $g_user['styleid'] )
{
    
$board['styleid'] = $g_user['styleid'];
}

if( 
$board['styleid'] == )
{
    
$r_style thwb_query("SELECT styletemplate, colorbg, color1, CellA, CellB, color4, colorbgfont, col_he_fo_font, color_err,
        col_link, col_link_v, col_link_hover, stdfont,
        boardimage, newtopicimage, border_col FROM
        "
.$pref."style WHERE styleisdefault=1");
}
else
{
    
$r_style thwb_query("SELECT styletemplate, colorbg, color1, CellA, CellB, color4, colorbgfont, col_he_fo_font, color_err,
        col_link, col_link_v, col_link_hover, stdfont,
        boardimage, newtopicimage, border_col FROM
        "
.$pref."style WHERE styleid=$board[styleid]");
}
$style mysql_fetch_array($r_style);

$style['smallfont'] = '<font face="' $style['stdfont'] . '" size="1">';
$style['smallfontend'] = '</font>';
$style['stdfont'] = '<font face="' $style['stdfont'] . '" size="2">';
$style['stdfontend'] = '</font>';


/*
################################################################################
Quicklinks[hack] By Morpheus
################################################################################
*/
$quicklinks '';
$t_quicklinks '';
if( 
$config['enable_quicklinks'] )
{
    
$TQuicklinks = new Template('./templates/' $style['styletemplate'] . '/quicklinks.html');

    
$r_qlink thwb_query("SELECT linkid, linkalt, linkcaption FROM ".$pref."qlink");
    while( 
$qlink mysql_fetch_array($r_qlink) )
    {
        
$quicklinks .= "<A HREF=\"qlinks.php?id=$qlink[linkid]\" title=\"$qlink[linkalt]\" target=_blank>[ $qlink[linkcaption] ]</a> ";
    }
    
    eval(
$TQuicklinks->GetTemplate("t_quicklinks"));
}



/*
################################################################################
            permissions
################################################################################
*/
if( $board['boardid'] )
{
    
$P = new Permission($g_user['groupids'], $board['boardid']);
    
requires_permissionP_VIEW );
    
}

/*
################################################################################
            create navigation path ( forum / board / thread .. )
################################################################################
*/
$navigation[] = "<a class=\"bglink\" href=\"index.php\">$config[board_name]</a>";
$navigation thwb_array_reverse($navigation);
while( list(
$key$val) = each($navigation) )
{
    
$navpath .= "$val &raquo; ";
}

/*
################################################################################
            static stuff
################################################################################
*/
$topicicon = array(
    
'fullalpha',
    
'smile',
    
'wink',
    
'angry',
    
'frown',
    
'biggrin',
    
'gumble',
    
'question',
    
'strange',
    
'rolleyes',
    
'oah',
    
'prefect'
);

/*
#################################################################################
            additional template stuff
#################################################################################
*/
if( file_exists('./templates/' $style['styletemplate'] . '/dynamic.inc.php') )
{
    @include(
'./templates/' $style['styletemplate'] . '/dynamic.inc.php');
}
?>