use Tie::IxHash; my $columns = 50; use Text::Wrap qw( wrap $columns ); require SDBM_File; my %chat; my %chatorder; my @words = (); my $chat = "list.dbm"; # location of database my $file = "count.txt"; # location of count file my $url = "http://sulfericacid.perlmonk.org/chat/chatgood.pl"; my $imagedir = "http://sulfericacid.perlmonk.org/chat/images"; # location of image directory (emoticons) tie %chat, "Tie::IxHash"; tie %chatorder, "Tie::IxHash"; tie %chat, 'SDBM_File', $chat, O_CREAT | O_RDWR, 0644; if ( !tied %chat ) { print "database unsuccessful $!.\n"; } $|=1; # maybe this will help page refreshing my $js=""; # # Time to keep accurate logs # my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); print header, start_html; my $num; foreach (keys (%chat)) { $num++; } print "DB keys: $num"; my $name = param('name'); my $message = param('message'); my $cnt; if (param) { if ($name) { if ($message) { open( LOG, "$file" ); # open count log for ID $cnt = ; close(LOG); $cnt++; open( LOG, "> $file" ); print LOG $cnt; close(LOG); $name =~ s/"; } } else { print "Name was missing, data not sent.
"; } } print "(chat logs)"; print "the local time is $hour:$min:$sec"; print start_table; print Tr(td({-height=>'5', width=>'700', bgcolor=>'#BBCCEE'},"ChatterBox version 1.0 $hour:$min:$sec" )); print Tr(td({-height=>'5', width=>'700', bgcolor=>'#BBCCEE'},"")); my $add; foreach (reverse keys (%chat)) { $add++; if ($add <= 10) { $chatorder{$_} = $chat{$_}; } } foreach (reverse keys (%chatorder)) { my ( $name, $message, $time ) = split /::/, $chatorder{$_}; $name =~ s/$_/****/g for @words; # say goodbye to swear words $message =~ s/$_/****/g for @words; # say goodbye to swear words $message =~ s/:\)/\/g; # happy emoticon $message =~ s/:\(/\/g; # sad emoticon $message =~ s/:p/\/g; # tongue emoticon $message =~ s/:P/\/g; # tongue1 emoticon $message =~ s/:o/\/g; # oh emoticon $message =~ s/:O/\/g; # oh1 emoticon $message =~ s/\*hug\*/\/g; # hug emoticon $message =~ s/\*flower\*/\/g; # flower emoticon $message =~ s/\*wink\*/\/g; # wink emoticon $message =~ s/\*devil\*/\/g;# devil emoticon $message =~ s/\*love\*/\/g; # love emoticon $message =~ s/\*sleep\*/\/g;# sleep emoticon $message =~ s/\*conf\*/\/g;# sleep emoticon $message = wrap('', '', $message); print Tr(td({-width=>'700'},"<$name @ $time>$message")), } print Tr(td({-height=>'5', width=>'700', bgcolor=>'#BBCCEE'},"")); print Tr(td({-height=>'5', width=>'700', bgcolor=>'#BBCCEE'},"

http://sulfericacid.perlmonk.org" )); print start_form(-action=>$url), table( Tr( td("Name: "), td( textfield( -name => 'name', -size => 40 ) ) ), Tr( td("Message: "), td( textfield( -name => 'message', -size => 100, -force=>1, ) ) ), Tr( td(), td(submit('send'), $js), ), end_form(), hr(), );