The mgiCreditBank Tag

Tag Behavior

Use the mgiCreditBank tag to store and manage online credits purchased by a user.


Tag Syntax

The mgiCreditBank tag has eight modes. Each mode has different required and optional parameters. The modes of mgiCreditBank are:

  • increment - Increments a user's account by a specified number of credits.
  • decrement - Decrements a user's account by a specified number of credits.
  • decrementAndRedirect - Decrements a user's account by a specified number of credits and redirects to a file.
  • queryCredits - Displays the number of credits in a user's account.
  • queryUser - Queries the credit bank database for the existence of a user.
  • addUser - Adds a new user to the credit bank database.
  • deleteUser - Deletes a user from the credit bank database.
  • admin - Creates a web-based interface to manage credit bank users.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

Increment Mode

The increment mode of the mgiCreditBank tag has three required parameters and three optional parameters. The tag form is:

<mgiCreditBank mode="increment" username="Name" 
amount="Integer" odbcDatasource="Source Name" 
odbcUsername="Name" odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "increment" mode, the mgiCreditBank tag increments a user's account by a specified amount of credit.
  • username - The username is the name of the user's account where the credit is applied.
  • amount - The amount is the number of credits to apply to the user's account.

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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

Decrement Mode

The decrement mode of the mgiCreditBank tag has four required parameters and three optional parameters. The tag form is:

<mgiCreditBank mode="decrement" username="Name" 
amount="Integer" group="Name" odbcDatasource="Source Name" 
odbcUsername="Name" odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "decrement" mode, the mgiCreditBank tag subtracts a specified number of credits from a user's account.
  • username - The username is the name of the user's account where the credit is subtracted.
  • amount - The amount is the number of credits to subtracted from the user's account.
  • group - The group is the name of the group that is allowed to access the information that the credits are used to purchase.

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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

DecrementAndRedirect Mode

The decrementAndRedirect mode of the mgiCreditBank tag has seven required parameters and three optional parameters. The tag form is:

<mgiCreditBank mode="decrementAndRedirect" 
username="Name" amount="Integer" group="Name" 
allowedURL="URL" deniedURL="URL" unknownAccountURL="URL"
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "decrementAndRedirect" mode, the mgiCreditBank tag subtracts a specified number of credits from a user's account and redirects the user to a specified file.
  • username - The username is the name of the user's account where the credit is subtracted.
  • amount - The amount is the number of credits to subtracted from the user's account.
  • group - The group is the name of the group that is allowed to access the information that the credits are used to purchase.
  • allowedURL - The allowedURL is absolute or relative path to the file where users are redirected when their account is successfully decremented in the DecrementAndRedirect mode.
  • deniedURL - The deniedURL is is the absolute or relative path to the file where users are redirected when an account cannot be successfully decremented (i.e., the user does not have enough credits) in the DecrementAndRedirect mode.
  • unknownAccountURL - The unknownAccountURL is is the absolute or relative path to the file where users are redirected when a user name does not exist in the DecrementAndRedirect mode

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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

QueryCredits Mode

The queryCredits mode of the mgiCreditBank tag has two required parameters and three optional parameters. The tag form is:

<mgiCreditBank mode="queryCredits" username="Name" 
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "queryCredits" mode, the mgiCreditBank tag displays the number of credits in a user's account.
  • username - The username is the name of the user's account that is queried.

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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

QueryUser Mode

The queryUser mode of the mgiCreditBank tag has two required parameters and three optional parameters. The tag form is:

<mgiCreditBank mode="queryUser" username="Name" 
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "queryUser" mode, the mgiCreditBank tag check the credit bank database for the existence of the specified username in any group. If the username exists, the value "Yes" is displayed. If the username does not exist, then the value "No" is displayed.
  • username - The username is the name of the user's account that is queried.

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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

AddUser Mode

The addUser mode of the mgiCreditBank tag has four required parameters and three optional parameters. The tag form is:

<mgiCreditBank mode="addUser" username="Name" 
amount="Integer" group="Name" odbcDatasource="Source Name" 
odbcUsername="Name" odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "addUser" mode, the mgiCreditBank tag add a new username to the credit bank database with the specified credit and specified group.
  • username - The username is the name of the user's account to create.
  • amount - The amount is the number of credits to set in the user's account.
  • group - The group is the name of the access group that the user belongs to.

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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

DeleteUser Mode

The deleteUser mode of the mgiCreditBank tag has two required parameters and three optional parameters. The tag form is:

<mgiCreditBank mode="deleteUser" username="Name" 
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "deleteUser" mode, the mgiCreditBank tag deletes an existing user from the credit bank database.
  • username - The username is the name of the user's account to delete.

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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage

Admin Mode

The admin mode of the mgiCreditBank tag has one required parameters and four optional parameters. The tag form is:

<mgiCreditBank mode="admin" displayLimit="Integer"
odbcDatasource="Source Name" odbcUsername="Name" 
odbcPassword="Password">

Required Parameters:

  • mode - The mode is the function that the mgiCreditBank tag performs. In "deleteUser" mode, the mgiCreditBank tag deletes an existing user from the credit bank database.

Optional Parameters:

  • displayLimit - The displayLimit is the maximum number of usernames displayed per screen in the administration interface. The default value is 10. The maximum value of the displayLimit parameter is 25.
  • 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, credit bank 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.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage


Example Usage and Output

<mgiCreditBank mode="decrementAndRedirect" amount="5"
group="subscribers" username={mgiRequest name="Username"} 
allowedURL="http://www.domain.com/allowed.mgi" 
deniedURL="http://www.domain.com/denied.mgi" 
unknownAccountURL="http://www.domain.com/unknownaccount.mgi">

In this example, a user's credit bank account is decremented 5 credits each time they access the page. If the user's account contains at least 5 credits, they are redirected to the allowed.mgi file. If the user's account contains less than 5 credits, they are redirected to denied.mgi. If the user name does not exist in the credit bank database, they are redirected to unknownaccount.mgi.

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage


Suggested Usage

  • Subscriber-Based Downloads
  • Fee-Based Downloads

Return to the mgiCreditBank Mode Menu | Examples and Output | Suggested Usage


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


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