Results 1 to 1 of 1
Related
-
form which contains the username and password Forum: PHP Forum
Replies: 0 -
simple dbase script Forum: Databases
Replies: 3 -
Cant find email script to send user password Forum: PHP Forum
Replies: 5
-
03-19-2007, 12:16 PM #1
Adding a username to simple password script
Hello,
I have a simple password script that works quite well. It asks for a password when logging in and depending on the password, directs the user to a specific page. I would like it to also ask for a username, but I'm not sure how to make it do that since I don't know how to write perl scripts. The script allows multiple passwords and I hope that adding the username would still allow this. Here is the code:
----------
Code:$correctpass = "sample"; $correcturl = "http://www.mydomain.com/private/"; $scriptlocation = "http://www.mydomain.com/cgi-bin/password.pl"; $loginurl = "http://www.mydomain.com/login.html"; # Read in form data &parse_form; $password = $input{'password'}; $function = $input{'function'}; if ($function eq "login") { if ($password eq $correctpass) { &goto_url; } &badpassword; } sub badpassword { print "Location: $loginurl\n\n"; } sub goto_url { print "Location: $correcturl\n\n"; } sub parse_form { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); if (length($buffer) < 5) { $buffer = $ENV{QUERY_STRING}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $input{$name} = $value; } }
If anyone can help I would really appreciate it! Thank you.
-PudgiPodLast edited by DeadMeatGF; 03-19-2007 at 12:52 PM. Reason: Added Code tags
Cloudjiffy- PaaS for Developers
10-05-2020, 12:30 AM in Web Hosting Forum