Setting and Retrieving Usernames and Passwords with Cookies
Example
- Setting and Retrieving usernames and passwords with cookies in the
Members Only section of a web site.
MGI Tags
Steps
- Open each Members Only page in a text editor.
- Insert the useCookies, expireDate and expireTime parameters in the
mgiAuthenticateDB tag.
- Save each Members Only page.
- FTP the Members Only pages to the web server running MGI.
- Access a Members Only page with a browser.
Step 1: Open each Members Only page in a text editor.
- Open each Members Only page in a text editor that allows you to view
and modify the HTML.
Step 2: Insert the useCookies, expireDate and expireTime parameters
in the mgiAuthenticateDB tag.
- Insert the useCookies parameter, expireDate parameter, and expireTime
parameter in the mgiAuthenticateDB tag. In the useCookies parameter, enter
"Yes". In the expireDate parameter, enter the date that the cookie
will expire in the format mm-dd-yyyy. In the expireTime parameter, enter
the time that the cookie will expire (on the expiration date) in the format
hh:mm.
<mgiAuthenticateDB group="Member" useCookies="Yes"
expireDate="12-31-2000" expireTime="09:00">
Tip: To dynamically set the expireDate parameter, calculate the
date value relative to the current date using the mgiMath tag and different
formats of the mgiDate tag. Set the calculated date value in a page variable,
then embed the variable in the expireDate parameter. |
Step 3: Save each Members Only page.
- Save the changes you have made to each members only page.
Step 4: FTP the Members Only pages to the web server running MGI.
- Upload the members only pages from your local computer to the web server
using an FTP program.
Step 5: Access a Members Only page with a browser.
- Access any Members Only page with a web browser. A dialogue box requesting
your Username and Password is displayed. Enter a valid username and password.
If a valid username and password is entered, then an encrypted cookie containing
that information is set on your machine and the page is displayed. During
subsequent visits to the page, the username and password information is
automatically read from the cookie and the page is displayed. After the
cookie expires, a new cookie must be set.
|