www.pudn.com > coolchat.zip > chatmsg.pl
#!/usr/bin/perl
$| = 1;
require "e:/company/qzrb/cgi-bin/music/cgi/chat.cfg";
$LOGOpath = "$chatdatadir/login/";
$MSG = ".MSG";
%UserData = &GetCookies;
&somerror("对不起, 请先打开您的浏览器的Cookie选项!","$ChatURLpath",1) if(($UserData{'User'} eq "")||($UserData{'Room'} eq "")||($UserData{'Key'} eq ""));
require "$CGIfuncpath/checkrand.pl";
&somerror("对不起, 你的在线数据出错了!","$ChatURLpath",1) if (&checkrand($UserData{'User'},$UserData{'Key'},$UserData{'Room'}) ne 0);
if($UserData{'Group'} eq 99)
{
require "$CGIfuncpath/chatgetright.pl";
($UserData{'Right'},$UserData{'Group'}) = &getright($UserData{'User'});
}
require "$CGIfuncpath/chatnewmsg.pl";
&chatnewmsg($ENV{'QUERY_STRING'});
exit;
sub GetCookies
{
my @cstuff = @_;
my ($cookie, $value, $char, %cookie);
my @Cdec = ('\+', '\%3A\%3A', '\%3D', '\%2C', '\%25', '\%2B', '\%26','\%3B');
my %Cdec = ('\+',' ','\%3A\%3A','::','\%3D','=','\%2C',',','\%25','%','\%2B','+','\%26','&','\%3B',';');
if ($ENV{'HTTP_COOKIE'})
{
foreach (split(/; /,$ENV{'HTTP_COOKIE'}))
{
($cookie,$value) = split(/=/);
foreach $char (@Cdec)
{
$cookie =~ s/$char/$Cdec{$char}/g;
$value =~ s/$char/$Cdec{$char}/g;
}
$cookie{$cookie} = $value;
}
}
return %cookie;
}
sub somerror
{
my($message,$url,$state) = @_;
$message=~s/\\/\\\\/g;
$message=~s/\"/\\\"/g;
$message=~s/\'/\\\'/g;
$message=~s/\n//g;
$url = "javascript:history.back();" if($url eq "");
print "Content-type: text/html\nPragma: no-cache\n";
print qq~
出错了!
$message
请返回...
~;
exit;
}