The mgiAuthenticateDB Tag

QueryUser Mode

Return to the mgiAuthenticateDB Main Menu

Tag Syntax

The QueryUser mode of mgiAuthenticateDB has two required parameters and three optional parameters. The tag form is:

<mgiAuthenticateDB mode="QueryUser" username="Name" 
odbcDatasource="Source Name" odbcUsername="Name" 

Required Parameters:

  • mode - The mode is the function that the mgiAuthenticateDB tag performs. In "queryUser" mode, the mgiAuthenticateDB tag checks the authentication database for the existence of the specified username in any group. If the username exists in any group, the value "Yes" is displayed. If the username does not exist, the value "No" is displayed.
  • username - The username is the unique login (i.e., name) to check. The username is case-sensitive.

Optional Parameters:

  • 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 queried from 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"}>

<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.


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


The queryUser mode of mgiAuthenticateDB checks the uniqueness of a username against existing usernames in the authentication database. In this example, users entered a desired username, password, and 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 using the addUser mode of mgiAuthenticateDB, 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]