#!/usr/bin/perl # This Script and the readme may only be given away "as is", unmodified # and complete. The Script is Freeware. # Created and Copyright by Ralf Gueldemeister # on 25.12.98 require "./config.cgi"; require "./shared.cgi"; require "./$messages_dir/chat.cgi"; require "./$messages_dir/shared.cgi"; require "./$html_dir/welcome.cgi"; require "./$html_dir/chat.cgi"; require "./$html_dir/user_error.cgi"; # Main Part - DON'T CHANGE ANYTHING HERE! # ####################### &action; exit; sub action { if (not $qs) { &welcome; } elsif ($query{'action'} eq "chat") { &chat; } else { &error; } } sub welcome { # Welcome page &welcome_html; } sub chat { &checkpass; &chat_html_header; my (@msgfile, @messages, $row); my $n = 0; if ($use_dbi) { } else { if (-e "$data_dir/$data_msg") { open (MSGFILE, "<$data_dir/$data_msg") || &error("::open $data_dir/$data_msg failed::"); } else { &create_file("$data_dir/$data_msg"); open (MSGFILE, "<$data_dir/$data_msg"); } while () { chomp; push (@msgfile, [split(/;;/)]); } close MSGFILE; @msgfile = reverse @msgfile; foreach $row (@msgfile) { if ($$row[2] =~ /^(\Q$query{'name'}\E)?$/i) { push (@messages, $row); $n++; last if ($n >= $message_limit); } } } if (not $query{'new_msg_on_top'}) { @messages = reverse(@messages); } foreach $row (@messages) { if ($$row[0] eq "action") { if ($$row[3] eq "loginsound" && $query{'ls'}) { if ($$row[4] + 1.5*$query{'updatefrequency'} > $timestamp) { print ""; } } } else { print "$$row[3]
\n" } } &chat_html_footer; &saprocess($query{'name'}); } # END Main Part # ##############################