CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
Login Script

 



benchivers
Deleted

Jan 17, 2001, 8:13 AM

Post #1 of 3 (253 views)
Login Script Can't Post

Could someone please help me write a script for logging in. I want the username's and password's in a data file set out like this: username:password . If any one can help I would be really grateful!



Jasmine
Administrator

Jan 17, 2001, 12:03 PM

Post #2 of 3 (249 views)
Re: Login Script [In reply to] Can't Post

It would help to know what the program would be used for, but have you checked http://perlarchive.com/guide/Membership_Managers?



abockover
Deleted

Jan 20, 2001, 1:21 PM

Post #3 of 3 (238 views)
Re: Login Script [In reply to] Can't Post

The following code will open the user database file and search for $username:$password

It will then set $logged_in = 1;
From there, you can open a custom configuration file for the user (that could contain: first name, last name, age, etc...)

All of the values can be called like: $usr_config{'name'}
so you can print them out to make a custom user page.

open (USERS,"<users/users.db") or die $!;
while (<USERS>)
{
next unless /^\Q$username:$password\E/;
$logged_in = 1;
last;
}

if($logged_in)
{
open(UDB,"users/config/$username.cfg");
@ucfg = <UDB>;
close(UDB);

foreach $setting (@UDB)
{
chomp($setting);
($set_name, $set_value) = split(/ = /, $setting);
$usr_config{$set_name} = $set_value;
}
}

Hope it helps,

Aaron


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives