www.pudn.com > coolchat.zip > chat.pl


#!/usr/bin/perl 
 
require "e:/company/qzrb/cgi-bin/music/cgi/chat.cfg"; 
 
################################################### 
#The style config of the input string(Font size,face,color,Emote....) 
$Style_Config = "$chatdatadir/styleconfig.pl"; 
 
#If you put them blow the homedir, then you donot need to modify them 
$LOGOpath       ="$chatdatadir/login/"; 
$ChaTempFilePath="$chatdatadir/temp/"; 
 
#Donot need to modify below except the message and interface your do not prefer 
#Some config for chat you must modify some of the files 
#(There are some URL in the files need to be modified!) 
#Store the online user data 
$ChatUserListFile="$chatdatadir/userlist.dat"; 
 
#Store the online room info 
$ChatRoomListFile="$chatdatadir/roomlist.ROM"; 
 
#Store the online room info 
$ChatRootUserFile="$chatdatadir/RootUser.ROT"; 
 
#You must modify the URL in this file! 
$ChatJaveFile     = $ChatURLpath."javacode.js"; 
 
#User list detail info head file 
$ChatDetalHtml = "$chatdatadir/userlist.html"; 
 
#Right bottom frame html 
$RightBottomHtml = $ChatURLpath."newrightbottom.html"; 
 
$| = 1; 
 
#Some  
$chatInfo       = $CGIURLpath.$Chat_Script."?cv"; 
 
#Some Public Function 
$do_getlastmsgnum   = "$CGIfuncpath/chatgetlastmsg.pl"; 
$do_chatgetright    = "$CGIfuncpath/chatgetright.pl"; 
$do_chatcheckmaster = "$CGIfuncpath/chatmaster.pl"; 
$do_CheckIDIP       = "$CGIfuncpath/checkforbidipid.pl"; 
$do_finduser        = "$CGIfuncpath/finduser.pl"; 
$do_checkrand       = "$CGIfuncpath/checkrand.pl"; 
$do_basefun         = "$CGIfuncpath/basefun.pl"; 
 
#Some config for the filename 
$COUNTER         = ".CNT"; 
$DATA            = ".DAT"; 
$MSG             = ".MSG"; 
$AllMsgExt       = ".ALL"; 
$HEAD            = ".HAD"; 
$FOOT            = ".FOT"; 
$HTMLFilext      = ".html"; 
$CryKey          = "GY"; 
 
#The errormessage send to visitor. 
$ErrorMessage = "您输入的参数错误,请联系花无缺!"; 
 
#################### 
$space  = " "; 
$colon=":"; 
######################## 
 
#Start 
&main; 
exit 0; 
#End 
 
#The same as do, but can tell you some info about the wrong codes. 
sub MyDo   
{ 
	my($dostrin) = @_; 
	my($result) = (); 
	unless ($result = do $dostrin) 
        { 
            &somerror("couldn't parse $dostrin: $@","$ChatURLpath",1) if $@; 
            &somerror("couldn't do $dostrin: $!","$ChatURLpath",1)    unless defined $result; 
            &somerror("couldn't run $dostrin","$ChatURLpath",1)       unless $result; 
        } 
} 
 
sub   somerror 
{ 
       my($message,$url,$state) = @_; 
       $message=~s/\\/\\\\/g; 
       $message=~s/\"/\\\"/g; 
       $message=~s/\'/\\\'/g; 
       $message=~s/\n//g; 
 
       #&SetCookies(0,'User',$User_ID,'Key',$KeyNum,'Room',$RoomName,'Nick',$NickName,'Group',$UsrGroup) if($state eq 1); 
       $url = "javascript:history.back();" if($url eq ""); 
       print "Content-type: text/html\nPragma: no-cache\n"; 
       print qq~ 
       出错了! 
        
       

$message

返回...
~; exit; } sub main { #Check the referer's URL, if the url is not allow in the @referer list, then it will be forbided! MyDo $do_basefun; $total_qry_string=$ENV{'QUERY_STRING'}; ($doscript,$qrtstring)=split(/\&/,$total_qry_string,2); my $checkip = 0; $checkip = 1 if(($doscript eq "ne")||($doscript eq "cn")||($doscript eq "ko")||($doscript eq "sh")||($doscript eq "rt")); &check_url($checkip); %UserData = &GetCookies; &check_Cookie($doscript); if($doscript eq "ne") { MyDo "$CGIfuncpath/chatnewmsg.pl"; &chatnewmsg($qrtstring); } elsif($doscript eq "sh") { &chatshowmsg(); } elsif($doscript eq "rl") { MyDo "$CGIfuncpath/chatreloadonline.pl"; &chatreloadonline; } elsif($doscript eq "cn") { MyDo "$CGIfuncpath/chatonline.pl"; &chatonline; } elsif($doscript eq "ko") { MyDo "$CGIfuncpath/chatkeepactive.pl"; &chatkeepactive; } elsif($doscript eq "cp") { MyDo "$CGIfuncpath/chatpost.pl"; &Chat_post; } elsif($doscript eq "cg") { MyDo "$CGIfuncpath/chatlogin.pl"; &chatlogin; } elsif($doscript eq "cf") { MyDo "$CGIfuncpath/chatform.pl"; &chatform; } elsif($doscript eq "co") { MyDo "$CGIfuncpath/chatlogout.pl"; &Chat_logout; } elsif($doscript eq "lg") { MyDo "$CGIfuncpath/chatlog.pl"; &Chat_log; } elsif($doscript eq "cq") {#BroardCast MyDo "$CGIfuncpath/chatquemsg.pl"; &querymsg("$qrtstring"); } elsif($doscript eq "fr") { MyDo "$CGIfuncpath/chatframe.pl"; &sendframe; } elsif($doscript eq "cj") { MyDo "$CGIfuncpath/chatjoinroom.pl"; &joinroom; } elsif($doscript eq "cv") { MyDo "$CGIfuncpath/chatinfo.pl"; &chatinfomain("$qrtstring"); } elsif($doscript eq "rt") { MyDo "$CGIfuncpath/chatroomtitle.pl"; &senttitle; } elsif($doscript eq "cl") { MyDo "$CGIfuncpath/chatlist.pl"; &Chat_list; } elsif($doscript eq "cb") { MyDo "$CGIfuncpath/chatroomattrib.pl"; &Roomattrib; } elsif($doscript eq "cr") { MyDo "$CGIfuncpath/chatrennickname.pl"; &renickname; } elsif($doscript eq "ct") { MyDo "$CGIfuncpath/chatrentitle.pl"; &rentitle; } elsif($doscript eq "ck") { MyDo "$CGIfuncpath/chatkickout.pl"; &kickout; } elsif($doscript eq "ca") { MyDo "$CGIfuncpath/chatallowin.pl"; &allowin; } elsif($doscript eq "ci") { MyDo "$CGIfuncpath/chatdenyip.pl"; &chatdenyip; } elsif($doscript eq "ch") {#InviteFriend MyDo "$CGIfuncpath/chatinvite.pl"; &invitefriend; } elsif($doscript eq "cy") {#InviteFriend MyDo "$CGIfuncpath/chatcall.pl"; &call; } elsif($doscript eq "cm") {#InviteFriend MyDo "$CGIfuncpath/chatshowallmsg.pl"; &listallmsg($qrtstring); } elsif($doscript eq "cs") {#TransferRight MyDo "$CGIfuncpath/chatranright.pl"; &transright; } elsif($doscript eq "cw") {#BroardCast MyDo "$CGIfuncpath/chatbroadcast.pl"; &broadcast; } elsif($doscript eq "cx") {#BroardCast MyDo "$CGIfuncpath/chatmanager.pl"; &Manager_Main("$qrtstring"); } else { &somerror("$ErrorMessage","$ChatURLpath",1); } }