#!/usr/bin/perl
########################################################################
################ Copyright (C)1998, Thomas Turn Jensen ################
################
http://www.archer.dk Mukke@archer.dk ################
########################################################################
################ Version of this script: 1.0 ################
########################################################################
# Settings - modify these for individual setup.
$Database = "/home/sites/mollerboy.dk/TestChat/chat.htm";
# Preparations
$|| = 1;
print "content-type: text/html\n\n";
$In = $ENV{QUERY_STRING}; # Get the input
@In = split(/&/,$In);
foreach $I (0 .. $#In)
{
$In[$I] =~ s/\+/ /g;
($key, $val) = split(/=/,$In[$I],2); # splits on the first =.
$key =~ s/%(..)/pack("c",hex($1))/ge;
$val =~ s/%(..)/pack("c",hex($1))/ge;
$In{$key} .= $val;
}
# %In Now holds all the parameters
open (FILE, "<$Database") or die("Server error occured when trying to read from Database: $!");
@Lines = <FILE>;
close (FILE);
foreach $Line (@Lines)
{
if ($Line = "<!-- bigin -->") {push @NewLines, $In{send}}
push @NewLines, $Line;
}
open (FILE, ">$Database") or die("Server error occured when trying to read from Database: $!");
print FILE @NewLines;
close (FILE);
print <<'EoP'
<HTML>
</HTML>
EoP
;