Hallo,
ik ben bezig een gastenboekje te klussen op de site van mijn huis. Nou heb ik dit al vaker gedaan en dat ging altijd goed.
Alleen nu krijg ik het niet voor elkaar. Er verschijnt gewoon geen bericht op die pagina.
Het lijkt erop dat het script wel wordt uitgevoerd, maar niet wordt weggeschreven naar de file. Ik heb toch de chmod op 666 gezet.
Weet iemand misschien wat ik fout doe / vergeten ben
dit is de site http://jvb31.jvb.tudelft.nl/twopack/jvb51/prikbord.html
en dit is mijn gastenboek.pl
b.v.d.
ik ben bezig een gastenboekje te klussen op de site van mijn huis. Nou heb ik dit al vaker gedaan en dat ging altijd goed.
Alleen nu krijg ik het niet voor elkaar. Er verschijnt gewoon geen bericht op die pagina.
Het lijkt erop dat het script wel wordt uitgevoerd, maar niet wordt weggeschreven naar de file. Ik heb toch de chmod op 666 gezet.
Weet iemand misschien wat ik fout doe / vergeten ben
dit is de site http://jvb31.jvb.tudelft.nl/twopack/jvb51/prikbord.html
en dit is mijn gastenboek.pl
code:
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
| #!c:/program files/sambar51/perl.exe
#######################################################################
# FlexBook Version 1.02 #
# Copyright 1998 by Matt Riffle All Rights Reserved. #
# Initial Full Release: 7/4/98 This Release: 2/20/99 #
# Riffnet Scripts Archive http://scripts.riffnet.com/ #
#######################################################################
# 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. #
# #
# This program is distributed in the hope that it will be useful, #
# but WITHOUT ANY WARRANTY; without even the implied warranty of #
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
# GNU General Public License for more details. It is included in #
# this distribution in the file "license.txt". #
# #
# You should have received a copy of the GNU General Public License #
# along with this program; if not, write to the Free Software #
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA #
# 02111-1307, USA. #
#######################################################################
#### Variables -- Set Accordingly
# This is the full path to your guestbook html file. Be sure
# that it is writable by the web server. In UNIX, that can
# be done with `chmod 666 gbook.html` where gbook.html is the
# name of your guestbook page.
$gbook = "c:/http-root/twopack/jvb51/prikbord.html";
# This is the full path to the entry template file. For each
# variable in the form, use [varname] where you want it to
# appear in the template. To add environmental variables add a $,
# as in [$HTTP_USER_AGENT]. Another useful environmental variable
# is [$REMOTE_HOST]. [date] is a special variable that adds a date
# stamp to the entry, and [time] is a timestamp.
$template = "c:/http-root/twopack/jvb51/template.txt";
# This is the URL of the page you want displayed after a
# submission is entered. If it is set to "", a generic
# thank-you page is generated.
$success = "http://jvb31.jvb.tudelft.nl/twopack/jvb51/succes.html";
# If this variable is set to 1, new entries are added to the top of the
# list. If not, they are added at the bottom.
$add_at_top = 1;
# maximum number of lines in a message.
$max_lines_in_msg = 7;
# If you place "bad words" in this array, the guestbook will
# replace occurrences of them with ****. This, to some degree, helps
# keep foul language out of your guestbook. Comment it out if you don't
# want any filtering.
@badwords = ("gosh","shucks","darn");
# This array contains the form fields that must be filled in before the
# entry can be added. Set it to ("") if no particular form field *has*
# to be entered.
@required = ("name","subject");
# This array contains the IP addresses which are banned from using the
# site. To log IP addresses in your entries, use the special tag
# [$REMOTE_ADDR] in your template (See the README file for more info.)
# Set it to () if no one should be banned.
@banned = ();
# If this variable is set to 1, all html tags will be stripped from the
# submissions. This prevents people from including huge images or other
# such things in their entries.
$ban_html = 0;
# If your system can use "flock" for file-locking, set this variable to
# 1. Otherwise, set it to 0.
$filelock = 1;
# If this variable is set to 1, you will receive e-mailed confirmation
# each time someone adds to the guestbook.
$mail_you = 0;
# This is the path to "sendmail" on your system. On most UNIX
# systems, you can use 'which sendmail' or 'whereis sendmail'
# to find out the path. If you didn't set mail_you
# equal to 1, you don't need to set this at all.
$mailer = "/usr/sbin/sendmail";
# This is the e-mail address to send mail to, if you set $mail_you
# equal to one. Be sure to put a \ before the @, as in
# "mattr\@cgiscripts.net"
$adminaddr = "twopack\@go.to";
###### Do Not Edit Below This Line ######
## Actions
# Check Security
&secure;
# Organize Input
&parse_form;
# Check Required Fields
&check_for_required;
# Add Entry
&add_entry;
# Mail Admin if Needed
if (($mail_you) && ($adminaddr)) {
&mail_admin;
}
# Report Success
&report_success;
## Subroutines
sub secure {
if (@banned) {
my($ban);
foreach $ban (@banned) {
if ($ENV{'REMOTE_HOST'} =~ /^$ban/) { &error("BANNED"); }
}
}
}
sub parse_form {
# Die if method is "GET"
if ($ENV{'QUERY_METHOD'} eq "GET") {
&error("GET");
}
my($ind,$value,$badword);
# Get the input
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
# Split the name-value pairs
@couples = split(/&/, $buffer);
foreach $one (@couples) {
($ind, $value) = split(/=/, $one);
# Un-Webify plus signs and %-encoding
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
# Kill Bad Words
foreach $badword (@badwords) {
$value =~ s/$badword/****/ig;
}
# Strip HTML
if ($ban_html == 1) {
$value =~ s/<([^>]|\n)*>//g;
}
# edited: change newlines into <br>'s, so they will show.
$value =~ s/(\n)/<br>/ig;
#edited: count lines in msg, allow only $max_lines_in_msg
$linecnt = ($value =~ s/<br>/<br>/ig);
if ($linecnt > $max_lines_in_msg) { &error("LENGTH"); }
$TAG{$ind} = $value;
}
}
sub check_for_required {
if (@required) {
foreach $req (@required) {
if (!$TAG{$req}) { push (@missing,$req); }
}
}
if (@missing) { &error("MISSING"); }
}
sub add_entry {
# Create Date Stamp
my($date,$min,$hour,$day,$month,$year,$weekday,$ampm,$zero,@weekdays,@months);
(undef, $min, $hour, $day, $month, $year, $weekday) = localtime(time);
@weekdays = ("Sunday","Monday","Tuesday","Wednesday",
"Thursday","Friday","Saturday");
@months = ("January","February","March","April","May","June","July",
"August","September","October","November","December");
# Dates correct through 2097 :)
if ($year > 97) { $year += 1900; } else { $year += 2000; }
# Fix Time
if ($min < 10) { $zero = "0"; } else { $zero = ""; }
$time = "$hour:$zero$min $ampm";
$date = "$weekdays[$weekday], $months[$month] $day, $year";
# Parse Template and push data to @out array
open (IN,$template) || &error("TMPL");
while (<IN>) {
# Handle special date tag
$_ =~ s/\\[date\]/$date/ig;
# Handle special time tag
$_ =~ s/\\[time\]/$time/ig;
# Handle Environment Variables
$_ =~ s/\\[\$([^\]]*)\]/$ENV{$1}/ig;
# Handle form input tags
$_ =~ s/\\[([^\]]*)\]/$TAG{$1}/ig;
push (@out,$_);
}
close(IN);
# Open guestbook and get entries
open (GUEST,$gbook) || &error("GBR");
# This should be more efficient, really
@lines = <GUEST>;
close (GUEST);
# Write New Guestbook File
open (NEW,">$gbook") || &error("GBW");
if ($filelock) { flock(NEW,2); } # Lock File
foreach $line (@lines) {
if ($line =~ /\<\!--enter--\>/) {
if ($add_at_top) { print NEW "<!--enter-->\n\n"; }
foreach $entry (@out) { print NEW $entry; }
if (!$add_at_top) { print NEW "<!--enter-->\n\n"; }
} else { print NEW $line; }
}
if ($filelock) { flock(NEW,8); } # Unlock File
close (NEW);
}
sub mail_admin {
open (MAIL, "|$mailer -oi -t $adminaddr") || &error("MAIL");
print MAIL "From: $adminaddr\n";
print MAIL "Subject: Guestbook Entry\n\n";
print MAIL "The following entry was added to the guestbook:\n\n";
foreach $line (@out) {
print MAIL "$line";
}
close (MAIL);
}
sub report_success {
if ($success) {
print "Location: $success \n\n";
} else {
print "Content-type: text/html \n\n";
print "<html><body bgcolor='#ffffff'>\n";
print "<h1>Thank you for adding to the guestbook!</h1>";
print "Use your back button to return, and reload to see your entry";
print "</body></html>\n";
}
exit;
}
sub error {
my %ERR;
$ERR{"LENGTH"} = "Sorry dude(tte), your message is too long, it can be 10 lines max.
Use your browser's back button and go fix it!";
$ERR{"BANNED"} = "Sorry, but this subnet has been banned, because
the guestbook was abused by a previous user. Please contact the
site administrator for more information";
$ERR{"MISSING"} = "Some required form fields were not filled out.
Please use your back button to back up and fill in the missing
fields";
$ERR{"GET"} = "The script must be called with the POST method.";
$ERR{"TMPL"} = "An error occurred while accessing the template file.
If this persists, please contact the site administrator.";
$ERR{"GBR"} = "An error occurred while reading the guestbook file.
If this persists, please contact the site administrator.";
$ERR{"GBW"} = "An error occurred while writing the guestbook file.
If this persists, please contact the site administrator.";
$ERR{"MAIL"} = "An error occurred while sending mail to the site
administrator. If this persists, please let them know.";
my $emsg = $ERR{$_[0]};
if (!$emsg) {
$emsg = "The script has suffered an unknown error.";
}
print "Content-type: text/html", "\n\n";
print "<html><body bgcolor='#000000' text='#ffffff' link='#ffff00'>\n";
print "<h1>JvB 51 foutje.</h1>\n";
print "$emsg";
print "</body></html>";
exit;
} |
b.v.d.