home *** CD-ROM | disk | FTP | other *** search
- #
- # This script registers a WebForum user in the database
- #
- # Copyright (C) 1994 Afzal Ballim
-
- require "ABSWFBIN/LIBWEBFORUM.PL";
-
- # read the input from the form.
- %in=&WFReadParse;
-
- # check that all the necessary elements of the registration are there
- if ($in{"userid"} eq "" || $in{"userid"} =~ /[^A-Za-z0-9]/) {
- &WFRegError(
- "<h1>Userid not valid - only letters and numbers please</h1>\n");
- };
- if ($in{"password"} eq "" || $in{"password"} !~ $in{"verify"}) {
- &WFRegError("<h1>Problem in entering password. Please redo.</h1>\n");
- };
- if ($in{"username"} eq "" || $in{"username"} !~ /[A-Z].*[A-Z]/) {
- &WFRegError("<h1>You must supply us with your full name.</h1>\n");
- } else {$db{"username"} = $in{"username"}};
- if ($in{"email"} eq "" || $in{"email"} !~ /.*@.*/) {
- &WFRegError("<h1>You must supply a valid email address.</h1>\n");
- } else {$db{"email"} = $in{"email"}};
-
- $UserDB=&WFDBName($in{"userid"});
-
- # has the userid already been taken, if not, create it
- if (-r $UserDB) {
- &WFRegError(
- "<h1>The userid you have picked already exists.
- Please pick another one.</h1>\n");
- }
-
- # encrypt the password
- $db{"password"}=crypt($in{"password"},$in{"password"});
-
- $db{"homeurl"}=$in{"homeurl"};
- $db{"numposts"}=0;
-
- $db{"notes"}=$in{"notes"};
-
- &WFWriteDBFile($in{"userid"},%db);
-
- # okay, now tell them they are registered
- &WFHtmlHeader;
- print <<EOF;
- <h1>Done</h1>
- <p>
- Your details have been queued for handling by the WebMaster. Your
- login should be enabled within 24 hours.
- EOF
-
- sub WFRegError {
- &WFHtmlHeader;
- &WFError(@_);
- if (&WFIncFile("ABSWFHTML/REGISTER.HTML",
- "REGISTER_SCRIPT","URLWFBIN/STD_REGISTER.PL",
- "UID","$in{userid}",
- "PASSWD","$in{password}",
- "VFY","$in{verify}",
- "RNAME","$in{username}",
- "EMAIL","$in{email}",
- "HURL","$in{homeurl}")) {
- exit;}
- else {
- print "<p>couldn't find the reference file.\n";
- }
- }
-