CGI Procedures

user/validate.cgi

Procedure Model

Type:    (  )Web Page              ( X )CGI Script           (  )Shared Library      (  )System API

Name: user/validate.cgi

Assigned to:

Reference:

Description

This script takes the information from the user/apply.html form, verifies that all required data is present before attempting to create a new user request.

Implementation Skills

PERL, CGI, SQL

Parameter List

Membership_Class
User_FirstName
User_LastName
User_Initial
User_Salutation
User_Organization
User_Title
User_StreetAddress1
User_StreetAddress2
User_City
User_Province
User_Country
User_PostalCode
User_HomePhone
User_WorkPhone
User_Age
User_InitialPassword
Member_UserName (the requested username by the prospective member)
Upgrade_toPPP (check box: True=”1”)
Upgrade_toDB (check box: True=”1”)
Upgrade_toVirtualDomain (check box: True=”1”)
Upgrade_toSSL (check box: True=”1”)
Upgrade_toListserver (check box: True=”1”)
Upgrade_toAliases (user enters a number)
Upgrade_Quota1 (check box: True=”5”)
Upgrade_Quota2 (check box: True=”5”)
Upgrade_Quota3 (check box: True=”5”)
 

Called By:

user/apply.html

Can Call:

lib/uname_generate.pl
lib/uname_test.pl
lib/pw_check.pl

Function Description

  1. The script verifies that the user has supplied all required values. The procedure model for the user/apply.html page lists these requirements. They include: Membership_Class, User_FirstName, User_LastName, User_Salutation , User_StreetAddress1, User_City, User_Province, User_Country, User_PostalCode, User_Age, User_InitialPassword.
  2. If Membership_Class is “Institution” or “Individual”, the following additional fields must also be gathered: Member_UserName, Upgrade_toPPP, Upgrade_toDB, Upgrade_toVirtualDomain, Upgrade_toSSL, Upgrade_toListserver, Upgrade_toAliases, Upgrade_Quota1, Upgrade_Quota2, Upgrade_Quota3.
  3. If Membership_Class is “Institution” User_Organization, and User_Title are also required fields.
  4. If Membership_Class is “Registered”, then the library function “uname_generate.pl” is called to return the next sequential userid. Otherwise, the “uname_test.pl” is called to verify that the value supplied in the Member_UserName field is unique and valid. If uname_generate.pl or uname_test.pl returns an error, the script returns with error condition 1 below.
  5. The value of User_InitialPassword is tested with a call to “pwcheck.pl”. If the test fails, the script returns with error condition 1 below.
  6. The values from the form are inserted as a new record in the Database User table. In addition, the following additional fields are populated as follows:
    User_IsActive = “Pending”
    User_Since = current timestamp
    User_IsMember = “Y” if Membership_Class is “Individual” or “Institution”, otherwise User_Is_Member = “N”
    User_EnteredBy = Web Server’s ‘REMOTE_USER’ value
    Retrieve the value of User_Number from the new record
  7. If Membership_Class is ‘Registered’, proceed to step 14 below.
  8. If Membership_Class is not “Registered”, insert a new record in the Member table with the following values:
    User_Number = the User_Number of the just created User record in the User table
    Member_Type = ‘Inst’ or ‘Ind” depending on whether Membership_Class is ‘Institution’ or ‘Individual’ respectively
    Member_UserName = User_UserName
    Member_Since = User_Member_Since
    Member_EnteredBy = the Web Server’s REMOTE_USER value
  9. If Membership_Class is not ‘Registered’ and any of Upgrade_toPPP, Upgrade_toDB, Upgrade_toVirtualDomain, Upgrade_toSSL, Upgrade_toListserver, Upgrade_toAliases, Upgrade_Quota1, Upgrade_Quota2, Upgrade_Quota3 are True or not equal to ‘0’, create a new record in the Upgrade_Request table inserting these values into the record.
  10. Unless Membership_Class is ‘Registered’, insert a new record into the Invoice table with the following values:
    Invoice_Date is the current Timestamp
    Invoice_Medium = ‘Web’
    Invoice_EnteredBy = REMOTE_USER
    and retrieve the Invoice_Number of this new record
  11. Insert a new record in the Invoice_Item table with the current Invoice_Number and User_Number. If Membership_Class is ‘Institution’ then the Item_Description should say ‘Institutional Annual Membership’ and the Item_Amount is the value of the Sys_Inst_Mem_Price. Otherwise, the Item_Description should say ‘Individual Annual Membership’ and the Item_Amount is the value of the Sys_Ind_Mem_Price.
  12. For each of the upgrade options listed in step 9 above where the option is not 0 or is “False”, insert a new record in the Invoice_Item table with an appropriate description and the value of the option field multiplied by the corresponding value from the System Defaults table.
  13. Calculate the total cost of the Invoice by taking the sum of all Invoice_Item records for this particular Invoice_Number and put this value in the Invoice_Amount field for the corresponding Invoice.
  14. Display the User Acceptance agreement based on the contents of the accept.tmpl page created by the web designers. Users will be instructed to print out this form and send it with any required documentation to the office.
  15. If Membership_Class is not Registered, append the Invoice information to the User Acceptance agreement created above using the format supplied in the invoice.tmpl file.

 

Possible Exit Conditions and Return Values

  1. The user supplied Member_UserName is not valid or not unique. An error message informing the user of the nature of the problem is displayed on the returned HTML page and the form in the user/apply.html page is recreated and repopulated with the current values. The user is invited to pick a different UserName and resubmit the form.
  2. The user supplied Initial_Password is not valid or not sufficiently hard. An error message informing the user of the specific failure of the password is displayed on the returned HTML page and the form in the user/apply.html page is recreated and repopulated with the current values. The user is invited to pick a different InitialPassword and resubmit the form.

Sign Off by:

Project Manager & Membership Committee or Board Designate