Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

password redirect

Status
Not open for further replies.

iralh

Programmer
Sep 20, 2001
12
0
0
US
I need some help on redirecting a user to a url after the enter the correct password. My current script is a simple conditional (security isn't an issue in this case) that sends users a link to the page they need. I would like to bypass the extra page. Any ideas?

Thanks
 
Place the following line in the <head> section of the HTML output that currently has the link. (You could also change that page to say the user is being redirected) Just change mywebpage.html to the page you're forwarding them to, and the number 5 to how many seconds you'd like the browser to wait before redirecting.

<meta http-equiv=&quot;refresh&quot; content=&quot;5;URL=mywebpage.html&quot;>

 
Following code will take the password from a form and redirect them to the secret page if the password is correct. This code has no security but since it's not an issue, then the following code will help you out.

#!/usr/bin/perl -w

read(STDIN, $input, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $input);
foreach $pair (@pairs) {

($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack(&quot;C&quot;, hex($1))/eg;
$value =~ s/<!--(.|\n)*-->//g;
$FORM{$name} = $value;
}

print &quot;Content-type: text/html\n\n&quot;;

$pass_data = $FORM{'password'};
$pass = &quot;password&quot;;

if ($pass_data eq $pass) {
print &quot;Location: &quot;;
}else{
print &quot;Location: &quot;;
}






There is no Knowledge, That is not power.
Age: 16
E-mail: projectnet01@yahoo.com
School: Coral Springs High (Company:(not done yet) :)
Status: Currently working with C++ for game developing.
-Aaron
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top