I might have suggested doing authentication a little bit differently, as it appears that you are using a plain text file with unencrypted username/password data. But if you just want to redirect based on what you've got and you're not extremely concerned about security in this instance, this should work.
#!/usr/bin/perl use CGI qw/:standard/; my $q = new CGI; my $username = param(USERNAME); my $password = param(PASSWORD); open(FILE, "data.txt") || die "The database could not be opened"; while(<FILE>) { @data = split(/\n/); foreach $entry (@data) { ($name, $pass) = split(/,/, $entry); if($name eq "$username") { $userverified = 1; if ($pass eq "$password") { $passwordverified = 1; } } } } close(FILE); if ($userverified && $passwordverified) { &accessgranted; } elsif ($userverified && !$passwordverified) { &wrongpassword; } else { &accessdenied; } sub accessgranted { $q->redirect('http://www.whatever.com'); } sub wrongpassword { print header; print "<TITLE>Access Denied</TITLE>"; print "<FONT FACE=Arial SIZE=2 COLOR=Red><STRONG>"; print "You entered an invalid password.<br> "; print "Access has been denied.</STRONG></FONT>"; exit; } sub accessdenied { print header; print "<TITLE>Access Denied</TITLE>"; print "<FONT FACE=Arial SIZE=3 COLOR=Red><STRONG>"; print "You were denied access to this server."; print "</STRONG></FONT>"; exit; } # Scot R. # inSite --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.372 / Virus Database: 207 - Release Date: 6/20/2002 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]