From 630af0ed6c0af69c7df2e45aef7a87722a3c00c0 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 6 Apr 2013 13:14:47 +0200 Subject: tagging ychat-perl-legacy --- 0.4.3a/online.pl | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 0.4.3a/online.pl (limited to '0.4.3a/online.pl') diff --git a/0.4.3a/online.pl b/0.4.3a/online.pl new file mode 100644 index 0000000..b77f845 --- /dev/null +++ b/0.4.3a/online.pl @@ -0,0 +1,71 @@ +#!/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; + } +} \ No newline at end of file -- cgit v1.2.3