summaryrefslogtreecommitdiff
path: root/0.2.6a/online.pl
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2013-04-06 13:14:47 +0200
committerPaul Buetow <paul@buetow.org>2013-04-06 13:14:47 +0200
commit630af0ed6c0af69c7df2e45aef7a87722a3c00c0 (patch)
treead76f850278b090f7e5c26561035d19c320400cc /0.2.6a/online.pl
parent2860b03f00e48264ed15c132ad90b240ebe6070b (diff)
tagging ychat-perl-legacyychat-perl-legacy
Diffstat (limited to '0.2.6a/online.pl')
-rw-r--r--0.2.6a/online.pl56
1 files changed, 56 insertions, 0 deletions
diff --git a/0.2.6a/online.pl b/0.2.6a/online.pl
new file mode 100644
index 0000000..cdc0d43
--- /dev/null
+++ b/0.2.6a/online.pl
@@ -0,0 +1,56 @@
+#!/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
+
+&secure_checkip($alias);
+&start_html("Online","online");
+&online($alias,$room);
+&list_dir("data/online/rooms/".$room);
+print
+ $q->div( "$room:" ),
+ "<font size=1 color=ffffef face=arial>";
+ foreach $online (@dir) {
+ if (-f "data/online/rooms/$room/$online") {
+ print
+ $q->a( { -href=>"main2.pl?var=alias_html&alias=$alias&tmp=$online",
+ -target=>"$online" }, "$online"), $q->br;
+ }
+ }
+print
+ "</font>",
+ $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 (-e "data/online/rooms/$room") { # Falls Raum nicht existiert anlegen
+ } else {
+ &write_file_new("data/online/rstat/$room"); # Raumbesetzerstatus setzen
+ print DATEI "0\n\n$alias\n";
+ close DATEI;
+ mkdir "data/online/rooms/$room", 0777;
+ }
+ &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 = <DATEI>;
+ close DATEI;
+ if ($provetime < (time - 30)) {
+ &write_file_new("data/online/prove");
+ print DATEI time;
+ close DATEI;
+ &rm_alias("data/online/users");
+ &rm_rooms;
+ }
+}