Qbasicnews.com

Full Version: Making a member area
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
cna someone tell me in th simplist way how you can make a member area which is password protect and looks for the password in one file then a username in another
well, in perl that would be like so:

Code:
my @users, %passes;

open (FILE, "users.txt");
@users = <file>;
close (FILE);

open (FILE, "pass.txt");
  for $username (@users) {
    $passes{$username} = <file>;
  }
close(FILE);

# You insert your own routines to get form params

if ($form{'pass'} eq $passes{$form{'user'}}) {
  # pass is valid, display page
} else {
  # kick 'em out
}

of course, that leaves the problem of unencrypted passwords, yucky, multiple text files (a bad way to store things), and the problem of adding, deleting and editing users. You should use crypt or your own encrypting routine to encrypt the passwords, and store all member data in a single database.