#!/usr/bin/perl # Chatty Child - COPYRIGHT 2000 ############################################################# # COPYRIGHT NOTICE # Copyright 2000 by: Michael Bass All Rights Reserved. # # If you need help with this script or would like to report # any bugs please email: # info@tunedown.com # # Chatty Child - Fast, fun, full window chat! # # Michael Bass (c) # Bass Ackwards Productions # 2521 Keeland # Houston, Texas 77093 # (713) 694-7563 # # COPYRIGHT AND LICENSE AGREEMENT. # REDISTRIBUTION OF THIS SCRIPT OR ANY MODIFICATIONS # OF THIS SCRIPT IN ANY FORM IS STRICTLY PROHIBITED! # # There are no warranties expressed or implied of any # kind, and by using this program you agree to indemnify # Michael Bass, Bass Ackwards Productions, TuneDown.com # and Company from any and all liability that might arise # from it's use. In any and all cases liability shall not # exceed purchase price. # (c)2000 - Copyright by: # Michael Bass, Bass Ackwards Productions, TuneDown.com ############################################################# $|="1"; if ( ($^O eq 'MSWin32') || defined($ENV{'OS'}) ) { $Dir = "$ENV{'PATH_TRANSLATED'}"; $Dir =~ s/chat\.pl$//g; } else { $Dir = "$ENV{'SCRIPT_FILENAME'}"; $Dir =~ s/chat\.pl$//g; } push (@INC, "$Dir"); eval { $And = 'config.pl'; $Also = 'lang.lib'; require("$Dir$And"); require("$Dir$Also"); }; &parse; $name = $data{'name'}; &CleanInput unless $data{'message'} eq ""; if ($data{'action'} eq "ShowTopBar") { &MakeTopBar; } if ($data{'action'} eq "ShowSide") { &MakeSide; } if ($data{'action'} eq "ShowRight") { &MakeRight; } if ($data{'action'} eq "ShowBottom") { &MakeBottom; } if ($data{'action'} eq "ControlPanel") { &MakeControlPanel; } if ($data{'action'} eq "ShowExit") { &MakeExit; } if ($data{'all'} eq "$sendm") { &MakeMessages; } if ($data{'action'} eq "transfer") { &Transfer; } if ($data{'action'} eq "LogOut") { &Leave; } if ($data{'action'} eq "OUT") { &KO; } ################################################################# &Enter unless "$data{'name'}"; print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child ChattyChild exit; ############################################################# sub MakeTopBar { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child
$TopT
ChattyChild exit; } ############################################################# sub MakeSide { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child



ChattyChild exit; } ############################################################# sub MakeMessages { if ($data{'message'} eq "") { &MakeControlPanel; } else { $counter = 0; open (OLD, "$file"); @lines = ; chomp (@lines); close(OLD); while () { chomp (@lines = split(/:/)); $data{'message'} =~ (s/\n//g + s/\n//g); } open (NEW, ">$file"); print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "

$data{'name'}: $data{'message'}

\n"; for ($counter = 4; $counter < 15; $counter++) { print NEW "$lines[$counter]\n"; } print NEW "\n\\\n"; close(NEW); &MakeControlPanel unless ($data{'action'} eq "transfer"); } exit; } ############################################################# sub MakeRight { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child



ChattyChild exit; } ############################################################# sub MakeBottom { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child
   Chatty Child © 2000  $Report 
ChattyChild exit; } ############################################################# sub MakeExit { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child

 $Exit 

ChattyChild exit; } ############################################################## sub MakeControlPanel { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child
$Message
ChattyChild exit; } ############################################################# sub Enter { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child
$Welcome
$Chatty

$Playhouse
 

$t1

$EnterName $PressHere
$CloseWindow
 
Theme Chat © Copyright 2000
ChattyChild exit; } ############################################################# sub Transfer { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child
 $Transfer1

$Transfer2

       

$Transfer3

$CloseWindow
ChattyChild &MakeMessages; exit; } ############################################################# sub Leave { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child
$Chatty
$click
$Playhouse $LogOut


$ThankYou $name
 
$t2


$CloseWindow
 
Theme Chat © Copyright 2000
ChattyChild $counter = 0; open (OLD, "$file"); @lines = ; chomp (@lines); close(OLD); open (NEW, ">$file"); print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "

$data{'name'}: $out

\n"; for ($counter = 4; $counter < 15; $counter++) { print NEW "$lines[$counter]\n"; } print NEW "\n\\\n"; close(NEW); exit; } ############################################################# sub parse { read(STDIN, $input, $ENV{'CONTENT_LENGTH'}); $input = $ENV{'QUERY_STRING'} if $ENV{'QUERY_STRING'}; @pairs = split(/&/, $input); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $data{$name} = $value; } if ($bw eq 'Yes') { &bw_filter(%data); } } ############################################################# sub bw_filter { foreach $key (keys %data) { foreach $badword (@badwords) { if ($data{$key} =~ /\b$badword\b/i) { if ($data{'name'} =~ /\b$badword\b/i) { &Out; } if ($leave eq 'Yes'){ if ($data{'name'} =~ /\b$badword\b/i) { &Out; }else{ $data{$key} = $KO; &Out; } }else{ $data{$key} =~ s/\b$badword\b/$new_word/ig; } } } } } ############################################################# sub Out { $out = "chat.pl"; print "Content-type: text/html\n\n"; print <<"ChattyChild"; ChattyChild exit; } ############################################################# sub KO { print "Content-type: text/html\n\n"; print <<"ChattyChild"; Chatty Child
$Chatty
$click
$Playhouse$LogOut


$shame $name
 
$t4
$t3

$CloseWindow
 
Theme Chat © Copyright 2000
ChattyChild $counter = 0; open (OLD, "$file"); @lines = ; chomp (@lines); close(OLD); open (NEW, ">$file"); print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "\n"; print NEW "

$data{'name'}: $KO

\n"; for ($counter = 4; $counter < 15; $counter++) { print NEW "$lines[$counter]\n"; } print NEW "\n\\\n"; close(NEW); exit; } ############################################################# sub CleanInput { ## Disallow JavaScript $data{'message'} =~ s///ig unless $allow_javascript eq "Yes"; $data{'message'} =~ s/<\/SCRIPT\>//ig unless $allow_javascript eq "Yes"; ## Disallow Java Applets $data{'message'} =~ s///ig unless $allow_java eq "Yes"; $data{'message'} =~ s/<\/APPLET\>//ig unless $allow_java eq "Yes"; if ((length ($data{'message'}) > 50) && (($data{'message'}) !~ /\s/)){ $data{'message'} = ""; } $data{'message'} =~ s/<([^>]+)>//ig unless $allow_html eq "Yes"; $data{'message'} =~ s/<(IMG\s*SRC.*)>//ig unless $allow_images eq "0"; $data{'message'} =~ s/\n//g; $data{'message'} =~ s///ig; } ################################################################### # end of script #############################################################