C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\webboard\reply.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
<?php
/* $Id: reply.php,v 1.3 2003/01/01 12:13:54 dkreuer 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.

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

*/

include "./inc/header.inc.php";


function 
prevent_guestspam()
{
    global 
$config$pref$REMOTE_ADDR;

    
$r_post thwb_query("SELECT posttime FROM ".$pref."post WHERE postip = '".$REMOTE_ADDR."' ORDER BY posttime DESC");
    
$post mysql_fetch_array($r_post);
    if ( 
time() - $config['postdelay'] < $post['posttime'] )
    {
        
message("Fehler""Sie können nur alle $config[postdelay] Sekunden einen neuen Post erstellen.");
    }
}

// http://www.securiteam.com/securitynews/5FP0C204KE.html
$post['posttext'] = $HTTP_POST_VARS['post']['posttext'];

if( 
$g_user['userid'] == && !$P->has_permissionP_REPLY ) )
{
    
$navpath .= "Neue Antwort";
    
message('Fehler''Sie m&uuml;ssen registriert sein, um Beitr&auml;ge erstellen zu k&ouml;nnen');
}

requires_permissionP_REPLY );

unset(
$msg);

if( (
time() - $config['postdelay'] < $g_user['userlastpost']) && !$P->has_permissionP_NOFLOODPROT ) )
{
    
$navpath .= "Neue Antwort";
    
message("Fehler""Sie können nur alle $config[postdelay] Sekunden einen neuen Post erstellen.");
}

// ANTI Guest Spamm
if ( $g_user['userid'] == && $P->has_permissionP_REPLY ) )
{
    
prevent_guestspam();
}

$teststring parse_code(preparse_code($post['posttext']), 1, ($config['imageslevel'] ? 1), $post['postcode'], $post['postsmilies']);

if( 
strlen(strip_tags($teststring)) < $config['message_minlength'] )
{
    
$msg .= "Der Text ist zu kurz<br>";
}
if( 
strlen(strip_tags($teststring)) > $config['message_maxlength'] )
{
    
$msg .= "Der Text ist zu lang<br>";
}

// andere error messages l&ouml;schen, nur diese
if( $thread['threadclosed'] == )
{
    
$msg "Dieser Thread ist leider geschlossen, es k&ouml;nnen keine weiteren Antworten erstellt werden.";
}

if( 
strlen($msg) > )
{
    
$navpath .= "Neue Antwort";
    
message("Fehler""Es sind leider folgende Fehler aufgetreten:<br><br><font color='$style[color_err]'>$msg</font>");
}

$ctime time();

if( 
$g_user['userid'] == && $P->has_permissionP_REPLY ) )
{
    
// check username
    
check_username($post['postguestname']);

    
// override notify
    
$post['postemailnotify'] = 0;

    
$g_user['username'] = $config['guestprefix'] . $post['postguestname'];
    
$post['postguestname'] = $config['guestprefix'] . addslashes($post['postguestname']);
}
else
{
    
$post['postguestname'] = '';
}

if( 
$config["usebwordprot"] >= BWORD_POST )
{
    
$post["posttext"] = check_banned($post["posttext"]);
}

if ( 
$config['auto_close'] > )
{
    
thwb_query("UPDATE  " $pref "thread SET threadclosed = '1' WHERE threadtime < '" . ( time() - ( ( $config['auto_close']+) * 86400 ) ) . "'");
}

if ( 
$config['auto_delete'] > )
{
    
thwb_query("DELETE FROM " $pref "thread WHERE threadtime < " . ( time() - ( $config['auto_delete'] * 86400 ) ) . "");
}


// neue nachricht posten
thwb_query("INSERT INTO ".$pref."post (posttime, posttext, userid, threadid, postemailnotify, postsmilies, postcode, postip, postguestname)
    VALUES('
$ctime',
    '" 
addslashes(preparse_code($post['posttext'])) . "',
    '
$g_user[userid]',
    '
$thread[threadid]',
    '" 
. ($post['postemailnotify'] ? 0) . "',
    '" 
. ($post['postsmilies'] ? 0) . "',
    '" 
. ($post['postcode'] ? 0) . "',
    '"
.addslashes($REMOTE_ADDR)."',
    '" 
$post['postguestname'] . "')");

// Replys um 1 erh&ouml;hen in der board datenbank
thwb_query("UPDATE ".$pref."board SET
    boardlastpost='
$ctime',
    boardposts=boardposts+1,
    boardlastpostby='" 
addslashes($g_user['username']) . "',
    boardthreadtopic='" 
addslashes($thread['threadtopic']) . "',
    boardthreadid=
$thread[threadid] WHERE boardid='$board[boardid]'");

if( 
$g_user['userid'] )
{    
    
// Den postings wert des postenden users erh&ouml;hen
    
thwb_query("UPDATE ".$pref."user SET userlastpost=$ctime, userposts=userposts+1 WHERE userid='$g_user[userid]'");
}

// Replys um 1 erh&ouml;hen in der topic datenbank + time aktualisieren
thwb_query("UPDATE ".$pref."thread SET threadtime='$ctime', threadreplies=threadreplies+1,
    threadlastreplyby='" 
addslashes($g_user['username']) . "' WHERE threadid='$thread[threadid]'");

// email zeug
if( $config['use_email'] )
{
    
$TRegmail = new Template("./templates/mail/newreply.mail");

    
$r_email thwb_query("SELECT DISTINCT
        user.useremail as useremail, thread.threadtopic as threadtopic
    FROM
        "
.$pref."post as post, ".$pref."user as user, ".$pref."thread as thread
    WHERE
        thread.threadid=
$thread[threadid] AND
        post.threadid=
$thread[threadid] AND
        post.userid=user.userid AND
        post.postemailnotify=1 AND
        user.userid<>
$g_user[userid]");
    
    while( 
$email mysql_fetch_array($r_email) )
    {
        
$text '';
        eval(
$TRegmail->GetTemplate("text"));

        @
mail($email[useremail], $config[board_name] . " - Neue Antwort"$text"From: $config[board_admin]");
    }
}

header("Location: showtopic.php?threadid=$thread[threadid]&time=$time&pagenum=lastpage");

?>