#!/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 $alias = $q->param("alias"); $tmpid = $q->param("tmpid"); $room = $q->param("room"); &secure_checkid($alias); # Onlinezeit zählen ! &read_file("data/online/users/$alias"); my $oldstamp = ; close DATEI; if ($oldstamp > (time - 60)) { &read_file("data/user/counts/$alias.online"); my $online = ; close DATEI; my $total = (time-$oldstamp+$online); &write_file_new("data/user/counts/$alias.online"); print DATEI $total; close DATEI; } ##### ENDE &start_html("Online","online"); &online($alias,$room); &list_dir("data/online/rooms/".$room); print $q->div( "$room:" ), ""; foreach $online (@dir) { if (-f "data/online/rooms/$room/$online") { print $q->a( { -href=>"main2.pl?var=alias_html&alias=$alias&tmp=$online&tmpid=$tmpid", -target=>"$online" }, "$online"), $q->br; } } print "", $q->end_html; sub online { # Benutzer in die Onlineliste hinzufügen bzw. erneuern my ($alias,$room) = @_; &write_file_new("data/online/users/$alias"); print DATEI time; close DATEI; if (-f "data/online/rooms/$room") { } else { mkdir "data/online/rooms/$room", 0777; } if (-f "data/online/rstat/$room") { } else { &write_file_new("data/online/rstat/$room"); # Raumbesetzerstatus setzen print DATEI "0\n\n$alias\n"; close DATEI; } &write_file_new("data/online/rooms/$room/$alias"); print DATEI time; close DATEI; &read_file("data/online/prove"); # Räume und Chatter auf Existenz überprüfen my $provetime = ; close DATEI; if ($provetime < (time - 30)) { &check_online; } }