The mgiAuthenticateDB Tag

AddUser Mode

Return to the mgiAuthenticateDB Main Menu

Tag Syntax

The AddUser mode of mgiAuthenticateDB has three required parameters and nine optional parameters. The tag form is:

<mgiAuthenticateDB mode="AddUser" username="Name" 
password="Code" group="Name" emailAddress="Email" 
startDate="Date" endDate="Date" startTime="Time" 
endTime="Time" odbcDatasource="Source Name" 
odbcUsername="Name" odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiAuthenticateDB tag performs. In "addUser" mode, the mgiAuthenticateDB tag adds a new user's authentication information to the authentication database.
  • username - The username is the user's authorized login (i.e., name). The username is case-sensitive and must be unique across all groups. The username can consist of letters, numbers, multiple words, spaces and ASCII characters.
  • password - The password is the user's authorized security code. The password is case-sensitive and can consist of letters, numbers, multiple words, spaces and ASCII characters. A secure password should contain at least 8 characters and include both numbers and letters.

Optional Parameters:

  • group - The group is the name of the user group that the user belongs to. To add the user to multiple groups enter a comma-delimited list of group names (e.g., "admin, member"). Group names are case-sensitive.
  • emailAddress - The emailAddress is the user's email address. Using the sendPassword mode of mgiAuthenticateDB, the user's password will be mailed to this email address.
  • startDate - The startDate is the first day access to the page is allowed with a valid username and password. The syntax of the date must be a julian day (see the mgiJulianDay tag). The startDate parameter can be used in conjunction with the endDate parameter to specify a definite time frame when access to a page is allowed or the startDate parameter can be entered alone to specify a start date for access without an expiration. If the startDate parameter is not included, the page can be accessed immediately with a valid username and password.
  • endDate - The endDate is the last day access to the page is allowed with a valid username and password. The syntax of the date must be a julian day (see the mgiJulianDay tag). The endDate parameter can be used in conjunction with the startDate parameter to specify a definite time frame when access to a page is allowed or entered alone to specify an expiration for access with an immediate start date. If the endDate parameter is not included, the page can be accessed any time after the specified start date.
  • startTime - The startTime is the time that the user's username and password are valid on the specified start date. The syntax of the time must be military format (i.e., hhmm). If the startTime parameter is not included, the user's username and password are valid at midnight on the specified start date.
  • endTime - The endTime is the time that user's username and password are no longer valid on the specified end date. The syntax of the time must be military format (i.e., hhmm). If the endTime parameter is not included, the user's username and password are no longer valid after 11:59 PM on the specified end date.
  • odbcDatasource (NT only) - The odbcDatasource is the name of datasource on the server that provides access information for an external ODBC database. If the odbcDatasource parameter is included, authentication information will be stored in the specified ODBC database rather than the internal MGI database. Inquire with the server administrator for additional information about the use of ODBC databases. If you include the odbcDatasource parameter, the odbcUsername and odbcPassword parameters are required.
  • odbcUsername (NT only) - The odbcUsername is the username required to access the ODBC datasource. The odbcUsername parameter is required if you include the odbcDatasource parameter.
  • odbcPassword (NT only) - The odbcPassword is the code required to access the ODBC datasource. The odbcPassword parameter is required if you include the odbcDatasource parameter.


Example Usage and Output

<mgiSet name="QueryResult">
<mgiAuthenticateDB mode="queryUser" 
username={mgiPostArgument name="Username"}>
</mgiSet>

<mgiIf lhs={mgiGet name="QueryResult"} 
relationship="equals" rhs="No">

<mgiAuthenticateDB mode="AddUser" 
username={mgiPostArgument name="Username"} 
password={mgiPostArgument name="Password"} group="Subscriber" 
emailAddress={mgiPostArgument name="Email"}>

Thank you.  Your username and password are now active.

<mgiElse>

Error: Your username already exists.  Please use the 
"Back" button on your browser and choose another username.

</mgiIf>

The addUser mode of mgiAuthenticateDB is useful for adding new users from a form submission. In this example, users entered a desired username, password, amd email address in a form that posts to the page containing these mgiAuthenticateDB tags. The username is first verified to insure that it is unique using the queryUser mode of mgiAuthenticateDB. If it is unique, the username is added to the authentication database, otherwise an error message is displayed.

Return to the mgiAuthenticateDB Main Menu


[Understanding MGI Menu] [Using MGI Menu] [Referencing MGI Menu]


[MGI Guides Main Menu] [User Guide Main Menu]