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
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
|
#!/usr/bin/perl -w
# yChat - Copyright by Paul C. Bütow
use CGI;
$q = new CGI;
require config;
print
$q->header();
#####################################
##WELCHE SUB MUß AUSGEFÜHRT WERDEN?##
#####################################
$var = $q->param("var");
if ($var eq "list_alias_html") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
&list_alias_html;
} elsif ($var eq "alias_html") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
$tmp = $q->param("tmp");
&alias_html;
} elsif ($var eq "edit_profile_html") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
$room = $q->param("room");
&edit_html("edit_profile_html");
} elsif ($var eq "edit_options_html") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
$room = $q->param("room");
$col = $q->param("col");
$secol = $q->param("secol");
&edit_html("edit_options_html");
} elsif ($var eq "gb_html") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
&gb_html;
} elsif ($var eq "post_gb") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
&secure_checkid($alias);
$msg = $q->param("msg");
$tmp = $q->param("tmp");
$id = $q->param("id");
&post_gb;
} elsif ($var eq "edit_profile") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
$room = $q->param("room");
&secure_checkid($alias);
&edit("edit_profile");
} elsif ($var eq "edit_options") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
&secure_checkid($alias);
$tmp = $q->param("tmp");
$id = $q->param("id");
$room = $q->param("room");
$col = $q->param("col");
$secol = $q->param("secol");
&edit("edit_options");
} elsif ($var eq "rm_gb_alias") {
$alias = $q->param("alias");
$tmpid = $q->param("tmpid");
&secure_checkid($alias);
$tmp = $q->param("tmp");
$id = $q->param("id");
&rm_gb;
} else {
&error("Parameter fehlt");
}
###########################
##HAUPTTEIL DIESER DATEI:##
###########################
sub gb_html { # Das Benutzerboard/Gästebuch.
my $message = $_[0];
&start_html("Benutzerboard");
if ($message eq "post_empty") {
print <<END;
<div class=b>
ACHTUNG!
</div>
<div>
Du wolltest soeben einen leeren Eintrag posten. Bitte schreib
<i>
zuerst
</i>
einen Text und poste
<u>dann</u>
!
</div>
<hr>
END
} elsif ($message eq "post_ok") {
print <<END;
<div class=b>
Meldung:
</div>
<div>
Vielen Dank für Deinen Beitrag. Wenn Du willst, kannst Du jetzt gleich noch einen Eintrag posten ...
</div>
<hr>
END
} else {
print <<END;
<div>
Falls Du Anregungen oder Verbesserungsvorschläge für die Community hast, dann poste doch einen kleinen Eintrag :-)
</div>
<hr>
END
}
print <<END;
<form action="main2.pl">
<input type="hidden" name="var" value="post_gb">
<input type="hidden" name="alias" value="$alias">
<input type="hidden" name="tmpid" value="$tmpid">
<input type="hidden" name="tmp" value="guestbook">
<input type="hidden" name="id" value="y">
<input size="40" name="msg">
<font color="ffffff">
<input type="submit" value="Hinterlassen ...">
</font>
</form>
<hr>
END
if (-e "data/guestbook") {
open (DATEI,"<data/guestbook") || &error("Konnte dat/guestbook nicht öffnen");
@datei = <DATEI>;
close DATEI;
print
$q->div(@datei);
}
print
$q->end_html;
}
sub post_gb { # Wenn etwas in ein Gästebuch eingetragen wird
&zeit;
if ($msg eq "") {
if ($id eq "y") { # Überprüfen, ob Benutzerboard- oder Privatgästebuch
&gb_html("post_empty");
} else {
&alias_html("post_empty");
}
exit;
}
$msg =~ s#<#<\;#g;
my $tmpath = "";
if ($id eq "y") {
$tmpath = "data/guestbook";
} else {
$tmpath = "data/user/gbooks/$tmp";
}
open(GB,"$tmpath");
my @gb = <GB>;
close GB;
pop(@gb) if ($#gb > 99);
my @newdatei = "<br><b>$alias schrieb am $day.$month.$year um $hours:$min:$sec ...</b><br>$msg<br>\n";
push(@newdatei,@gb);
open(GB,">$tmpath");
print GB @newdatei;
close GB;
if ($id eq "y") {
&gb_html("post_ok");
exit;
} else {
post_prv("$tmp","<font size=2 color=ffffff><a href=\"main2.pl?alias=$alias&var=alias_html&tmp=$tmp&tmpid=$tmpid\" target=\"_new\">$alias</a> hat soeben einen Pin in <a href=\"main2.pl?alias=$alias&var=alias_html&tmp=$tmp&tmpid=$tmpid\" target=\"_new\">Dein Profil</a> gehängt ... </font>");
&alias_html;
exit;
}
}
sub rm_gb { # Gästebucheintrag entfernen
open(GB,"<data/user/gbooks/$alias");
my @gbfile = <GB>;
close GB;
my @newgbfile = ();
for ($i=0; $i <= $#gbfile; $i++) {
push(@newgbfile,$gbfile[$i]) if ($i != $id);
}
open(GB,">data/user/gbooks/$alias");
print GB @newgbfile;
close GB;
&alias_html("rm_ok");
}
sub list_alias_html { # Liste aller Benutzer
&start_html("Alle Benutzer");
opendir(REGISTERED,"data/user/options");
my @users = readdir(REGISTERED);
closedir(REGISTERED);
my @liste = sort(@users);
my $nr = $#users-1;
print <<END;
<div>
Es sind z.Z. genau $nr Benutzernamen in der Datenbank vorhanden! (Sortiert nach #, A-Z, a-z)
</div>
<hr>
<div>
END
foreach(@liste) {
if (-f "data/user/options/$_") {
print
$q->a( { -href=>"main2.pl?var=alias_html&alias=$alias&tmp=$_&tmpid=$tmpid" },
"$_"),
" ";
}
}
print <<END;
</div>
</body>
</html>
END
}
sub alias_html { # Anzeigen eines Benutzerprofils
my $message = $_[0];
open(COUNTS,"<data/user/counts/$tmp");
local $counter = <COUNTS>;
close COUNTS;
$counter++;
open(COUNTS,">data/user/counts/$tmp");
print COUNTS $counter;
close COUNTS;
&start_html($tmp);
print <<END;
<div>
<a href="htdocs.pl?var=werda_html&alias=$alias&tmpid=$tmpid">Hier</a>
gehts zur Gesamtübersicht !
</div>
<hr>
END
if ($message eq "rm_ok") {
print <<END;
<div class=b>
Meldung:
</div>
<div>
Der von Dir gewählte Eintrag wurde erfolgreich gelöscht.
</div>
<hr>
END
} elsif ($message eq "post_empty") {
print <<END;
<div class=b>
ACHTUNG!
</div>
<div>
Du wolltest soeben einen leeren Eintrag posten. Bitte schreib
<i>
zuerst
</u>
einen Text und poste
<u>dann</u>
!
<hr>
END
}
open(PROFILE,"<data/user/profiles/$tmp");
@data = <PROFILE>;
close PROFILE;
print <<END;
<div>
Dieses Profil wurde insgesamt schon $counter mal aufgerufen !
<br>
<br>
Alias: $tmp
<br>
<br>
Nachname: $data[0]
<br>
<br>
Vorname: $data[1]
<br>
<br>
Alter: $data[2]
<br>
<br>
Wohnort: $data[3]
<br>
<br>
E-Mail:
<a href="mailto:$data[4]">$data[4]</a>
<br>
<br>
ICQ-Nummer: $data[5]
<br>
<br>
Homepage:
<a href="$data[6]" target="_new">$data[6]</a>
<br>
<br>
Weiteres:
<br>
$data[7]
<hr>
Hier kannst Du $tmp eine Nachricht hinterlassen!
<form action="main2.pl">
<input type="hidden" name="var" value="post_gb">
<input type="hidden" name="alias" value="$alias">
<input type="hidden" name="tmpid" value="$tmpid">
<input type="hidden" name="tmp" value="$tmp">
<input type="text" size="40" name="msg">
<font color="ffffff">
<input type="submit" value="Hinterlassen ...">
</font>
</form>
<hr>
END
if (-e "data/user/gbooks/$tmp") {
open (DATEI,"<data/user/gbooks/$tmp") || &error("Konnte data/user/gbooks/$tmp nicht öffnen");
@datei = <DATEI>;
close DATEI;
if ($alias ne $tmp) {
print @datei;
} else {
print <<END;
<table>
<form action="main2.pl">
<input type="hidden" name="var" value="rm_gb_alias">
<input type="hidden" name="alias" value="$alias">
<input type="hidden" name="tmpid" value="$tmpid">
<input type="hidden" name="tmp" value="$tmp">
END
for($i=0; $i <= $#datei; $i++) {
print <<END;
<tr>
<td>
<input type="radio" name="id" value="$i">
</td>
<td>
<div class=q>
$datei[$i]
</div>
</td>
</tr>
END
}
print <<END;
</table>
<table>
<tr>
<td>
<font color=ffffff>
<input type="submit" value="Makierten Eintrag löschen">
</font>
</td>
<td>
<font color=ffffff>
<input type="reset" value="Makierung rückgängig machen">
</font>
</td>
</tr>
</table>
</form>
END
}
}
print
$q->end_html;
}
sub edit_html { # Chat-Optionen / Benutzerprofil editieren
my ($method,$message) = @_;
&start_html("Benutzerprofil ändern");
if ($method eq "edit_options_html") {
open(DATEI,"<data/user/options/$alias");
} elsif ($method eq "edit_profile_html") {
open(DATEI,"<data/user/profiles/$alias");
}
@data = <DATEI>;
close DATEI;
if ($method eq "edit_options_html") {
chomp($data[0]);
if ($message eq "edit_options_ok") {
print <<END;
<script language="JavaScript">
open("main.pl?var=change_colors&alias=$alias&col=$col&secol=$secol&tmpid=$tmpid","reload");
open("htdocs.pl?var=menu_html&alias=$alias&room=$room&col=$col&secol=$secol&tmpid=$tmpid","menu");
</script>
<div class=b>
Hinweis:
</div>
<div>
Du hast soeben Deine Chat-Optionen erfolgreich editiert. Hier kannst Du Dein Profil erneuert editieren. Um
weiterzuchatten einfach Fenster schliessen!
</div>
<hr>
END
} elsif ($message eq "edit_pw_wrong") {
print <<END;
<div class=b>
ACHTUNG!
</div>
<div>
Du hast soeben versucht, dein Passwort zu ändern. Jedoch stimmte die Erste Eingabe nicht mit der Zweiten überein.
Bitte versuch es erneuert ...
</div>
<hr>
END
} else {
print
$q->div( "Hier kannst Du Deine Chat-Optionen editieren!" ),
$q->hr;
}
print <<END;
<script lang="javascript" type="text/javascript">
<!--
function radioWert(rObj) {
for (var i=0; i<rObj.length; i++) if (rObj[i].checked) return rObj[i].value;
return false;
}
function insertcode( code ) {
document.optionen.elements[radioWert(document.optionen.eingabe)].value = code;
}
//-->
</script>
<form name="optionen" action="main2.pl">
<input type="hidden" name="var" value="edit_options">
<table>
<tr>
<td>
<div>
Dein Passwort
<font color=ffa500>
(Gut merken !!)
</font>
<br>
<input type="password" name="id" value="$data[0]">
</div>
</td>
<td width=20>
</td>
<td>
<div>
Geb hier das Passwort erneuert ein:
<br>
<input type="password" name="tmp" value="$data[0]">
</div>
</td>
</tr>
</table>
<br>
<br>
<table>
<tr>
<td>
<div>
<input type="radio" name="eingabe" value="col" checked>
Auswahl von Farbe 1
<br>
(Farbe Deines Nicks):
<br>
<input name="col" size="6" maxlength="6" value="$data[1]">
</div>
</td>
<td width=20>
</td>
<td>
<div>
<input type="radio" name="eingabe" value="secol">
Auswahl von Farbe 2
<br>
(Farbe Deiner Nachrichten):
<br>
<input name="secol" size="6" maxlength="6" value="$data[2]">
</div>
</td>
</tr>
</table>
<br>
<div>
Beliebige Auswahl makieren und Farbe wählen. Um Deine Optionen abzuspeichern,
auf "Daten ändern" klicken!
</div>
<br>
END
open(COLORS,"<colors.sno");
@colors = <COLORS>;
close COLORS;
print @colors;
} elsif ($method eq "edit_profile_html") {
if ($message eq "edit_profile_ok") {
print <<END;
<div class=b>
Hinweis:
</div>
<div>
Du hast soeben Dein Profil erfolgreich editiert. Hier kannst Du Dein Profil erneuert editieren:
<hr>
END
} else {
print
$q->div( "Hier kannst Du Dein Profil editieren!" ),
$q->hr;
}
print <<END;
<form action="main2.pl">
<input type="hidden" name="var" value="edit_profile">
<div>
Dein Nachname:
<br>
<input name="nachname" value="$data[0]">
</div>
<br>
<div>
Dein Vorname:
<br>
<input name="vorname" value="$data[1]">
</div>
<br>
<div>
Dein Alter:
<br>
<input name="alter" value="$data[2]">
</div>
<br>
<div>
Dein Wohnort:
<br>
<input name="wohnort" value="$data[3]">
</div>
<br>
<div>
Deine E-Mail Adresse:
<br>
<input name="email" value="$data[4]">
</div>
<br>
<div>
Deine ICQ-Nummer:
<br>
<input name="icq" value="$data[5]">
</div>
<br>
<div>
Deine Homepage:
<br>
<input name="homepage" value="$data[6]">
</div>
<br>
<div>
Weiteres:
<br>
<textarea rows="5" cols="40"name="weiteres" wrap="virtual">$data[7]</textarea>
</div>
END
}
print <<END;
<hr>
<font color=ffffff>
<input type="hidden" name="alias" value="$alias">
<input type="hidden" name="tmpid" value="$tmpid">
<input type="hidden" name="room" value="$room">
<input type="submit" value="Daten ändern ...">
</font>
</form>
</body>
</html>
END
}
sub edit { # Benutzerprofil od. Chat-Optionen abspeichern
my $method = $_[0];
&zeit;
if ($method eq "edit_profile") {
&post($room,"<i><font color=ffffff>($hours:$min:$sec)</font> <font color=ffa500>$alias hat sein Profil geändert ...</font></i>");
open(PROFILE,">data/user/profiles/$alias");
print PROFILE $q->param('nachname')."\n".$q->param('vorname')."\n".$q->param('alter')."\n".$q->param('wohnort')."\n".$q->param('email')."\n".$q->param('icq')."\n".$q->param('homepage')."\n".$q->param('weiteres');
close PROFILE;
&edit_html("edit_profile_html","edit_profile_ok");
} elsif ($method eq "edit_options") {
if ($id ne $tmp) {
&edit_html("edit_options_html","edit_pw_wrong");
exit;
}
&post($room,"<i><font color=ffffff>($hours:$min:$sec)</font> <font color=$col>$alias</font> <font color=$secol> hat seine Chateinstellungen geändert ...</font></i>");
open(OPTIONS,">data/user/options/$alias");
print OPTIONS $id."\n".$col."\n".$secol;
close OPTIONS;
&edit_html("edit_options_html","edit_options_ok");
}
}
|