#! /usr/bin/perl
# reload.cgi
# -----------------------------------
# Copyright (C) 2000, Michael Stewart
# All Rights Reserved
# based on S8 Chat http://www.s8.org
# load the chat.setup file
require "chat.setup";
# If the offline.txt file exists, then the chat is in
# maintenance mode, and is closed. Output the message
# in the offline.txt and end.
if (-e "$path/offline.txt") {
open (OFFLINE, "$path/offline.txt");
@offline = The chatroom is closed right now for maintenance. The chatroom cannot load the required module cgi-lib.cgi. The chatroom cannot find the required module cgi-lib.cgi.
\n";
print "The chatroom administrator left the following message:\n";
foreach $offlineLine (@offline) {
print "$offlineLine";
}
print "";
print "
\n";
print "Chatroom version $ver Error Code 0 - Maintenance";
exit;
}
# Check for the cgi-lib, make sure it's readable and require it
if (-e "$path/cgi-lib.cgi") {
if (-r "$path/cgi-lib.cgi") {
require "$path/cgi-lib.cgi";
}
else {
print "Content-Type: text/html\n\n";
print "
\n";
print "This module is required for the chatroom to work correctly.
\n";
print "Please contact the chatroom administrator.
\n";
print "Chatroom version $ver Error Code 2 - cgi-lib Unreadable";
exit;
}
}
else {
print "Content-Type: text/html\n\n";
print "
\n";
print "This module is required for the chatroom to work correctly.
\n";
print "Please contact the chatroom administrator.
\n";
print "Chatroom version $ver Error Code 1 - Missing cgi-lib";
exit;
}
# Load the User Input into %in
&ReadParse();
# set defaults if varibles don't exist
unless ($in{'room'}) {
$room = "none";
}
else {
$room = $in{'room'};
}
if ($room eq "none") {
$room = "chat";
}
# load the chat.config file
open (CONFIG, "$path/chat.config");
@config =
\n";
print "Please enter the correct password in the pw box.";
print "
Chat Version: $ver - $copyinfo";
exit;
}
}
}
}
# if the room wasn't found, then it's been deleted
unless ($foundroom) {
print "Content-Type: text/html\n\n";
print "$bodytag\n";
print "I'm sorry, but the administrator has left this room, and it has been deleted.\n";
print "Click Here to goto a diffrent chat.\n";
print "You will be redirected there automaticly.\n";
print "\n";
print "
Chat Version: $ver - $copyinfo";
exit;
}
# see if it's a user-defined room, and process...
($roomleft, $roomright) = split(/\//, $room);
if ($roomleft eq "user") {
# make sure the user who created this has reloaded in the last 10 mins
$tt = localtime;
($d1, $d2, $d3, $d4, $d5, $d6) = split(/\s/, $tt);
if ($d3 ne "") {
$dday = "$d1";
$dmonth = "$d2";
$ddate = "$d3";
$dtime = "$d4";
$dyear = "$d5";
}
else {
$dday = "$d1";
$dmonth = "$d2";
$ddate = "$d4";
$dtime = "$d5";
$dyear = "$d6";
}
($dhh, $dmm, $dss) = split(/:/, $dtime);
open (ADMIN, "$path/$room.admin");
@admin =
Chat Version: $ver - $copyinfo";
exit;
}
}
if ($in{'admin'} eq $adminUser) {
open (ADMIN, ">$path/$room.admin");
print ADMIN "$tt\|$adminUser";
close ADMIN;
}
}
# load the chat header
open (HEADER, "$path/$room.header");
@header =
You cannot post to this room! You are banned!
\n\n"; } # output the rest of the chat foreach $chatLine (@chat) { $chatLine =~ s/\n//; ($name,$mail,$userUrl,$color,$text,$time,$IP) = split(/\|/, $chatLine); if ($color ne "") { print "$text
\n";
}
else {
print "
$text
\n";
}
($http,$www) = split(/:/, $userUrl);
if ($http eq "http") {
print "$name";
}
else {
print "$name";
}
unless ($mail eq "") {
print " - [$mail]
\n";
}
else {
print "
\n";
}
print "$time
\n";
print "IP: $IP