#!/usr/bin/perl # # csChatRBox 1.1 - 052102 # $basepath = '.'; # Some Windows based servers required the following. # push(@INC,"$basepath"); ##################################################################### # # # Copyright © 1999-2002 CGISCRIPT.NET - All Rights Reserved # # # ##################################################################### # # # THIS COPYRIGHT INFORMATION MUST REMAIN INTACT # # AND MAY NOT BE MODIFIED IN ANY WAY # # # ##################################################################### # # When you downloaded this script you agreed to accept the terms # of this Agreement. This Agreement is a legal contract, which # specifies the terms of the license and warranty limitation between # you and CGISCRIPT.NET. You should carefully read the following # terms and conditions before installing or using this software. # Unless you have a different license agreement obtained from # CGISCRIPT.NET, installation or use of this software indicates # your acceptance of the license and warranty limitation terms # contained in this Agreement. If you do not agree to the terms of this # Agreement, promptly delete and destroy all copies of the Software. # # Versions of the Software # Only one copy of the registered version of CGISCRIPT.NET # may used on one web site. # # License to Redistribute # Distributing the software and/or documentation with other products # (commercial or otherwise) or by other than electronic means without # CGISCRIPT.NET's prior written permission is forbidden. # All rights to the CGISCRIPT.NET software and documentation not expressly # granted under this Agreement are reserved to CGISCRIPT.NET. # # Disclaimer of Warranty # THIS SOFTWARE AND ACCOMPANYING DOCUMENTATION ARE PROVIDED "AS IS" AND # WITHOUT WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR ANY OTHER # WARRANTIES WHETHER EXPRESSED OR IMPLIED. BECAUSE OF THE VARIOUS HARDWARE # AND SOFTWARE ENVIRONMENTS INTO WHICH CGISCRIPT.NET MAY BE USED, NO WARRANTY # OF FITNESS FOR A PARTICULAR PURPOSE IS OFFERED. THE USER MUST ASSUME THE # ENTIRE RISK OF USING THIS PROGRAM. ANY LIABILITY OF CGISCRIPT.NET WILL BE # LIMITED EXCLUSIVELY TO PRODUCT REPLACEMENT OR REFUND OF PURCHASE PRICE. # IN NO CASE SHALL CGISCRIPT.NET BE LIABLE FOR ANY INCIDENTAL, SPECIAL OR # CONSEQUENTIAL DAMAGES OR LOSS, INCLUDING, WITHOUT LIMITATION, LOST PROFITS # OR THE INABILITY TO USE EQUIPMENT OR ACCESS DATA, WHETHER SUCH DAMAGES ARE # BASED UPON A BREACH OF EXPRESS OR IMPLIED WARRANTIES, BREACH OF CONTRACT, # NEGLIGENCE, STRICT TORT, OR ANY OTHER LEGAL THEORY. THIS IS TRUE EVEN IF # CGISCRIPT.NET IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN NO CASE WILL # CGISCRIPT.NET' LIABILITY EXCEED THE AMOUNT OF THE LICENSE FEE ACTUALLY PAID # BY LICENSEE TO CGISCRIPT.NET. # # Credits: # Andy Angrick - Programmer - angrick@cgiscript.net # Mike Barone - Design - mbarone@cgiscript.net # # For information about this script or other scripts see # http://www.cgiscript.net # # Thank you for trying out our script. # If you have any suggestions or ideas for a new innovative script # please direct them to suggest@cgiscript.net. Thanks. # ######################################################################## # Config Variables # ######################################################################## (! -e "$basepath/setup.cgi")?($nosetup=1):(require("$basepath/setup.cgi")); $flock=1; ######################################################################## # End Config Variables # ######################################################################## require("$basepath/libs.cgi"); $in{'cgiurl'} = $cgiurl.'/csChatRBox.cgi'; (!$htmlpath)&&($htmlpath=$cgipath); (!$htmlurl)&&($htmlurl=$cgiurl); $in{'htmlurl'} = $htmlurl; $in{'cinfo'} = qq|
Powered
by csChat - © 2000,2001 CGIScript.net
|;
$| = 1;
eval { &main; };
if ($@) {
&cgierr("fatal error: $@");
}
exit;
sub main{
&getdata();
($in{'command'} eq 'cnm')&&(&CheckNewMessages);
print "Content-type: text/html\n";
($in{'command'} eq '')&&($nosetup)&&(print "\n")&&(&Setup);
($in{'command'} eq 'login')&&(print "\n")&&(&Login);
($in{'command'} eq '')&&(print "\n")&&(&Login);
($in{'command'} eq 'lo')&&(&LogOut);
($in{'command'} eq 'savesetup')&&(print "\n")&&(($nosetup)?(&SaveSetup):(&PError("Error. Permission denied.")));
&GetLogin;
($in{'command'} eq 'pm')&&(&PostMessage);
print "\n";
($in{'command'} eq 'ss')&&(&StartSession);
($in{'command'} eq 'sh')&&(&ShowHeader);
($in{'command'} eq 'sf')&&(&ShowFooter);
($in{'command'} eq 'sm')&&(&ViewMessage);
($in{'command'} eq 'vm')&&(&ViewMessage);
}
sub CheckNewMessages{
print "Content-type: image/gif\n";
@s = stat("$htmlpath/msgfile.cgi");
&GetCookies;
&FindOnline;
if(($s[9] != $cookie{'CHATLOG'})||($uol)){
print "Set-cookie: CHATMESS=1; path=/\n";
print "Set-cookie: CHATLOG=$s[9]; path=/\n\n";
}
else{
print "Set-cookie: CHATMESS=0; path=/\n\n";
}
exit;
}
sub LogOut{
print "Set-cookie: CHATUSER= ;path=/\n";
print "Set-cookie: CHATCOLOR= ;path=/\n";
print "Set-cookie: CHATLOG= ;path=/\n\n";
$in{'UserName'} = $ENV{'REMOTE_USER'};
&PageOut("$htmlpath/t_chat_login.htm");
exit;
}
sub ShowHeader{
$in{'m'} = 'Enters Chat';
&WriteToChat;
&PageOut("$htmlpath/t_chat_header.htm");
exit;
}
sub ShowFooter{
$in{'refresh'} = 1000 * $refresh;
&PageOut("$htmlpath/t_chat_footer.htm");
exit;
}
sub StartSession{
&PageOut("$htmlpath/t_index.htm");
exit;
}
sub ViewMessage{
&FindOnline;
open(MSG,"<$htmlpath/msgfile.cgi");
($flock)&&(flock(MSG,2));
while( Definitions: \$cgiurl = Full URL to the csChatRBox DIRECTORY \n|;
open(MSG,"<$htmlpath/msgfile.cgi");
while($u: $in{'m'}
Please verify the information and modify if needed:
\$cgipath = Full PATH to the csChatRBox DIRECTORY
\$
Normal Installation Instructions:
In most cases, the script is already configured. Click 'Save'. If the setup portion of the script cannot find your sites variables automatically, you will might have to enter those in the above text area.
CGI-BIN Installation Instructions:
If your hosting service will not let you run scripts outside your cgi-bin directory, then follow these procedures:
Copy the csChatRBox.cgi and libs.cgi files to a directory in your cgi-bin directory, making sure they are chmod'd to 755. For example, you could create a /cgi-bin/csChatRBox/ directory and place csChatRBox.cgi and libs.cgi in this directory.
Create a directory outside your cgi-bin directory and copy all the remaining files and subdirectories there. For example, you could create a /cgi-script/csChatRBox and place the files there.
Run csChatRBox.cgi from your webbrowser to initiate the auto-setup. This will create the setup.cgi file. And if you see this screen, this is where you are in the installation process.
Edit the above variables (or manually edit
setup.cgi) to the following:
\$cgiurl = URL to the csChatRBox directory INSIDE your cgi-bin directory (where
the script is installed).
\$cgipath = FULL PATH to the csChatRBox directory INSIDE your cgi-bin directory
(where the script is installed).
ADD THE FOLLOWING VARIABLES TO THE ABOVE CONFIGURATION OR MANUALLY EDIT
setup.cgi:
\$htmlurl = FULL URL to the csChatRBox directory OUTSIDE your cgi-bin
directory (where the remaining files where installed)
\$htmlpath = FULL PATH to the csChatRBox directory OUTSIDE your cgi-bin
directory (where the remaining files where installed)
For Example, your new setup.cgi file might look something like this:
\$cgiurl='http://www.cgiscript.net/cgi-bin/csChatRBox';
\$cgipath='/www/vhosts/cgiscript.net/cgi-bin/csChatRBox';
\$htmlurl='http://www.cgiscript.net/cgi-script/csChatRBox';
\$htmlpath='/www/vhosts/cgiscript.net/cgi-script/csChatRBox';
(note: the '1' at the end is to prevent errors from perl if \$password was left empty)
If you have any problems of questions, please feel free to contact contact\@cgiscript.net
EOF exit; } sub SaveSetup{ (-e "$basepath/setup.cgi")&&(&PError("Error. Access Denied")); $in{'setup'} =~ s/\r*\n/\n/g; open(SETUP,">setup.cgi"); print SETUP $in{'setup'}; print SETUP "\n"; close SETUP; print <<"EOF"; EOF exit; }