home *** CD-ROM | disk | FTP | other *** search
/ Complete Internet Archive / Complete Internet Archive.iso / Web Boards / WebForum_tar(2).Z / WebForum_tar(2) / WebForum / src / register.pl < prev    next >
Encoding:
Text File  |  1995-01-19  |  1.9 KB  |  70 lines

  1. #
  2. # This script registers a WebForum user in the database
  3. #
  4. # Copyright (C) 1994 Afzal Ballim
  5.  
  6. require "ABSWFBIN/LIBWEBFORUM.PL";
  7.  
  8. # read the input from the form.
  9. %in=&WFReadParse;
  10.  
  11. # check that all the necessary elements of the registration are there
  12. if ($in{"userid"} eq "" || $in{"userid"} =~ /[^A-Za-z0-9]/) {
  13.     &WFRegError(
  14.      "<h1>Userid not valid - only letters and numbers please</h1>\n");
  15. };
  16. if ($in{"password"} eq "" || $in{"password"} !~ $in{"verify"}) {
  17.     &WFRegError("<h1>Problem in entering password. Please redo.</h1>\n");
  18. };
  19. if ($in{"username"} eq "" || $in{"username"} !~ /[A-Z].*[A-Z]/) {
  20.     &WFRegError("<h1>You must supply us with your full name.</h1>\n");
  21. }  else {$db{"username"} = $in{"username"}};
  22. if ($in{"email"} eq "" || $in{"email"} !~ /.*@.*/) {
  23.     &WFRegError("<h1>You must supply a valid email address.</h1>\n");
  24. }  else {$db{"email"} = $in{"email"}};
  25.  
  26. $UserDB=&WFDBName($in{"userid"});
  27.  
  28. # has the userid already been taken, if not, create it
  29. if (-r $UserDB) {
  30.     &WFRegError(
  31.     "<h1>The userid you have picked already exists. 
  32.         Please pick another one.</h1>\n");
  33. }
  34.  
  35. # encrypt the password
  36. $db{"password"}=crypt($in{"password"},$in{"password"});
  37.  
  38. $db{"homeurl"}=$in{"homeurl"};
  39. $db{"numposts"}=0;
  40.  
  41. $db{"notes"}=$in{"notes"};
  42.  
  43. &WFWriteDBFile($in{"userid"},%db);
  44.  
  45. # okay, now tell them they are registered
  46. &WFHtmlHeader;
  47. print <<EOF;
  48. <h1>Done</h1>
  49. <p>
  50. Your details have been queued for handling by the WebMaster.  Your
  51. login should be enabled within 24 hours.
  52. EOF
  53.  
  54. sub WFRegError {
  55.     &WFHtmlHeader;
  56.     &WFError(@_);
  57.     if (&WFIncFile("ABSWFHTML/REGISTER.HTML",
  58.         "REGISTER_SCRIPT","URLWFBIN/STD_REGISTER.PL",
  59.         "UID","$in{userid}",
  60.         "PASSWD","$in{password}",
  61.         "VFY","$in{verify}",
  62.         "RNAME","$in{username}",
  63.         "EMAIL","$in{email}",
  64.         "HURL","$in{homeurl}")) {
  65.         exit;}
  66.     else {
  67.      print "<p>couldn't find the reference file.\n";
  68.     }
  69. }
  70.