#!/usr/bin/perl -w # yChat - Copyright by Paul C. Bütow use CGI; # CGI-Modul laden $q = new CGI; require config; # config.pm in Dokument laden print $q->header(); # HTTP-Header erzeugen ##################################### ##WELCHE SUB MUß AUSGEFÜHRT WERDEN?## ##################################### if ($var eq "list_alias_html") { &list_alias_html; } elsif ($var eq "alias_html") { &alias_html; } elsif ($var eq "edit_profile_html") { &edit_html("edit_profile_html"); } elsif ($var eq "edit_options_html") { &edit_html("edit_options_html"); } elsif ($var eq "gb_html") { &secure_checkid($alias); &gb_html; } elsif ($var eq "post_gb") { &secure_checkid($alias); &post_gb; } elsif ($var eq "edit_profile") { &secure_checkid($alias); &edit("edit_profile"); } elsif ($var eq "edit_options") { &secure_checkid($alias); &edit("edit_options"); } elsif ($var eq "rm_gb_alias") { &secure_checkid($alias); &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 < ACHTUNG!
Du wolltest soeben einen leeren Eintrag posten. Bitte schreib zuerst einen Text und poste dann !

END } elsif ($message eq "post_ok") { print < Meldung:
Vielen Dank für Deinen Beitrag. Wenn Du willst, kannst Du jetzt gleich noch einen Eintrag posten ...

END } else { print < Falls Du Anregungen oder Verbesserungsvorschläge für die Community hast, dann poste doch einen kleinen Eintrag :-)
END } print <
END if (-e "data/guestbook") { open (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"; } if (-e "$tmpath") { &read_file("$tmpath"); my @datei = ; close DATEI; pop(@datei) if ($#datei > 99); my @newdatei = "
$alias schrieb am $day.$month.$year um $hours:$min:$sec ...
$msg
\n"; @newdatei = ("@newdatei", "@datei"); &write_file_new("$tmpath"); print DATEI @newdatei; close DATEI; } else { &write_file_new("$tmpath"); print DATEI "
$alias schrieb am $day.$month.$year um $hours:$min:$sec ...
$msg
\n"; close DATEI; } if ($id eq "y") { &gb_html("post_ok"); exit; } else { post_prv("$tmp","$alias hat soeben einen Pin in Dein Profil gehängt ... "); &alias_html; exit; } } sub rm_gb { # Gästebucheintrag entfernen $tmp = $alias; &read_file("data/user/gbooks/$alias"); my @gbfile = ; close DATEI; my @newgbfile = (); for($i=0; $i <= $#gbfile; $i++) { push(@newgbfile,$gbfile[$i]) if ($i != $id); } &write_file_new("data/user/gbooks/$alias"); print DATEI @newgbfile; close DATEI; &alias_html("rm_ok"); } sub list_alias_html { # Liste aller Benutzer &start_html("Alle Benutzer"); &list_dir("data/user/options"); my @liste = sort(@dir); my $nr = $#dir-1; print < Es sind z.Z. genau $nr Benutzernamen in der Datenbank vorhanden! (Sortiert nach #, A-Z, a-z)
END foreach(@liste) { if (-f "data/user/options/$_") { print $q->a( { -href=>"main2.pl?var=alias_html&alias=$alias&tmp=$_&tmpid=$tmpid" }, "$_"), " "; } } print < END } sub alias_html { # Anzeigen eines Benutzerprofils my $message = $_[0]; local $counter = undef; &read_file("data/user/counts/$tmp"); $counter = ; close DATEI; $counter++; &write_file_new("data/user/counts/$tmp"); print DATEI $counter."\n".$counter[1]; close DATEI; &start_html($tmp); print < Hier gehts zur Gesamtübersicht !

END if ($message eq "rm_ok") { print < Meldung:
Der von Dir gewählte Eintrag wurde erfolgreich gelöscht.

END } elsif ($message eq "post_empty") { print < ACHTUNG!
Du wolltest soeben einen leeren Eintrag posten. Bitte schreib zuerst einen Text und poste dann !
END } &read_file("data/user/profiles/$tmp"); @data = ; close DATEI; print < Dieses Profil wurde insgesamt schon $counter mal aufgerufen !

Alias: $tmp

Nachname: $data[0]

Vorname: $data[1]

Alter: $data[2]

Wohnort: $data[3]

E-Mail: $data[4]

ICQ-Nummer: $data[5]

Homepage: $data[6]

Weiteres:
$data[7]
Hier kannst Du $tmp eine Nachricht hinterlassen!

END if (-e "data/user/gbooks/$tmp") { open (DATEI,"; close DATEI; if ($alias ne $tmp) { print @datei; } else { print <
END for($i=0; $i <= $#datei; $i++) { print <
$datei[$i]
END } print <
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") { &read_file("data/user/options/$alias"); } elsif ($method eq "edit_profile_html") { &read_file("data/user/profiles/$alias"); } @data = ; close DATEI; if ($method eq "edit_options_html") { chomp($data[0]); if ($message eq "edit_options_ok") { print < open("main.pl?var=input_html&alias=$alias&room=$room&col=$col&secol=$secol&tmpid=$tmpid","input"); open("htdocs.pl?var=menu_html&alias=$alias&room=$room&col=$col&secol=$secol&tmpid=$tmpid","menu");
Hinweis:
Du hast soeben Deine Chat-Optionen erfolgreich editiert. Hier kannst Du Dein Profil erneuert editieren. Um weiterzuchatten einfach Fenster schliessen!

END } elsif ($message eq "edit_pw_wrong") { print < ACHTUNG!
Du hast soeben versucht, dein Passwort zu ändern. Jedoch stimmte die Erste Eingabe nicht mit der Zweiten überein. Bitte versuch es erneuert ...

END } else { print $q->div( "Hier kannst Du Deine Chat-Optionen editieren!" ), $q->hr; } print <
Dein Passwort (Gut merken !!)
Geb hier das Passwort erneuert ein:


Auswahl von Farbe 1
(Farbe Deines Nicks):
Auswahl von Farbe 2
(Farbe Deiner Nachrichten):

Beliebige Auswahl makieren und Farbe wählen. Um Deine Optionen abzuspeichern, auf "Daten ändern" klicken!

END &read_file("colors.sno"); @colors = ; close DATEI; print @colors; } elsif ($method eq "edit_profile_html") { if ($message eq "edit_profile_ok") { print < Hinweis:
Du hast soeben Dein Profil erfolgreich editiert. Hier kannst Du Dein Profil erneuert editieren:
END } else { print $q->div( "Hier kannst Du Dein Profil editieren!" ), $q->hr; } print <
Dein Nachname:

Dein Vorname:

Dein Alter:

Dein Wohnort:

Deine E-Mail Adresse:

Deine ICQ-Nummer:

Deine Homepage:

Weiteres:
END } print < END } sub edit { # Benutzerprofil od. Chat-Optionen abspeichern my $method = $_[0]; if ($method eq "edit_profile") { &write_file_new("data/user/profiles/$alias"); print DATEI $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 DATEI; &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; } &zeit; &post("($hours:$min:$sec) $alias hat seine Chateinstellungen geändert ..."); &write_file_new("data/user/options/$alias"); print DATEI $id."\n".$col."\n".$secol; close DATEI; &edit_html("edit_options_html","edit_options_ok"); } }