P
Patrick Hartman
Hi, I am creating a login form that redirects the user to a different
page after they are authenticated. It is redirecting them, always
opens up the new page in a seperate browser window/tab and leaves the
login form open.
I was hoping to have it perform the redirect in the same browser
window that they are using to login. Is this possible?
#!/usr/bin/perl -w
use strict;
use CGI;
# make cgi object
my $cgi = CGI->new;
# if the page was posted
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
# form data we will authenticate
my ($username,$password) = ($cgi->param('username'),$cgi-
# ... do that ...
# redirect them where they need to go
print $cgi->redirect(-uri => 'http://localhost/stats/sales-
comparison', -status => 301);
}
I also tried doing it without CGI by just sending a location header,
but that did the same thing:
#!/usr/bin/perl -w
use strict;
# if the page was posted
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
# form data we will authenticate
my ($username,$password) = ($cgi->param('username'),$cgi-
# ... do that ...
# redirect them where they need to go
print "Location: http://localhost/stats/sales-comparison\n\n";
}
Any suggestions or tips would be appreciated.
Patrick
page after they are authenticated. It is redirecting them, always
opens up the new page in a seperate browser window/tab and leaves the
login form open.
I was hoping to have it perform the redirect in the same browser
window that they are using to login. Is this possible?
#!/usr/bin/perl -w
use strict;
use CGI;
# make cgi object
my $cgi = CGI->new;
# if the page was posted
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
# form data we will authenticate
my ($username,$password) = ($cgi->param('username'),$cgi-
param('password'));
# ... do that ...
# redirect them where they need to go
print $cgi->redirect(-uri => 'http://localhost/stats/sales-
comparison', -status => 301);
}
I also tried doing it without CGI by just sending a location header,
but that did the same thing:
#!/usr/bin/perl -w
use strict;
# if the page was posted
if ($ENV{'REQUEST_METHOD'} eq 'POST')
{
# form data we will authenticate
my ($username,$password) = ($cgi->param('username'),$cgi-
param('password'));
# ... do that ...
# redirect them where they need to go
print "Location: http://localhost/stats/sales-comparison\n\n";
}
Any suggestions or tips would be appreciated.
Patrick