Reading in browser cookie script > sub getcookies{ $cookies = $ENV{'HTTP_COOKIE'}; @allcookies = split(/;\s*/,$cookies); foreach $i (@allcookies){ ($name,$value) = split(/\s*=\s*/,$i); $cookie{$name}=$value; } } PAge to read target URL INTO PAGE > sub gethtml { open (DATA,"text file DB location"); @DB=; close (DATA); foreach $rec (@DB){ chomp($rec); ($token,$file)=split(/\t/,$rec); if ($input{'target'} eq $token) { $url = $file; } } open (HTML, "$url"); @PAGE=; close (HTML); } Read in user data and check for valid username/password pair >>>>> sub idcheck { open (DATA,"<$DATABASE"); @DB=; close (DATA); $valid = 0; foreach $rec (@DB){ chomp($rec); ($username,$password,$name,$email,$degree)=split(/\t/,$rec); $username = uc $username; $input{'user'} = uc $input{'user'}; if (($input{'user'} eq $username) && ($input{'pass'} eq $password)) { $valid = 1; if ($input{'user'} eq "0") { $valid = 0; } } } return $valid; } >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PArsing the form data >>>>> sub parseform { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); $buffer =~ tr/+/ /; @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } return %FORM; } if (&idcheck) { &gethtml; print "Content-type:text/html\n"; print "Set-Cookie: User=OK; domain=domain name; \n\n"; print @PAGE; exit; } else { &getcookies; if ($cookie{'User'} eq "OK") { &gethtml; print "Content-type: text/html\n\n"; print @PAGE; exit; }