I am also trying to redirect a user to an HTML page if a certain condition is met. I am using cgi.pm and when I try
the code you mentioned (included below) it gives me the error: Status: 302 Found Uri: Location: Content-type: text/html
my $q = new CGI;
print $q->redirect("http://busybody.w1.com/html/2010assignment.html");
Any ideas on what I am doing wrong?
Thanks-
Laura
My entire script is as follows:
#!/usr/local/bin/perl -w
# 2010b.pl
use CGI;
require ("cgi-lib.pl");
my $q = CGI->new();
print $q->header();
$studentid = $q->param('studentid');
$password = $q->param('password');
$CSC = $q->param('CSC');
$assignment = $q->param('assignment');
$file = $q->param('path');
if ($CSC eq "CSC2010") {
$openfile = "CSC2010.txt";
open (IN, "<$openfile") or die "Can't open $openfile\n";
$foundusername = false;
$foundpassword = false;
while ($line = <IN>) {
chomp($line);
my ($realstudentid,$realpassword) = split /\|/, $line;
if ($realstudentid eq $studentid){
$foundusername = true;
if ($realpassword eq $password){
$foundpassword = true;
print $q->redirect("http://busybody.w1.com/html/2010assignmen
+t.html\n\n");
exit;
}
}
}
if ($foundusername eq false ) {
print "username not found!<br>";
}
if ($foundpassword eq false) {
print "bad password!<br>";
}
}
|