summaryrefslogtreecommitdiff
path: root/0.4.2/online.pl
blob: 57e1349f237f51d08ebebf6c23a8f1edf56cac9b (plain)
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
#!/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_checkid($alias);

# Onlinezeit zählen !
&read_file("data/online/users/$alias");
 my $oldstamp = <DATEI>;
close DATEI;
 if ($oldstamp > (time - 60)) {
  &read_file("data/user/counts/$alias.online");
   my $online = <DATEI>;
  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:" ),
 "<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&tmpid=$tmpid",
               -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;
 }
}