AutoPlay Media Studio 5.0 Knowledge Base

Adding Password Protection

Document ID: IR10097
The information in this article applies to:
  • AutoPlay Media Studio 5.0 Standard Edition
  • AutoPlay Media Studio 5.0 Professional Edition

SUMMARY

This article describes how to make your application password protected.

DISCUSSION

There are many instances requiring the user to be prompted for information that must not be visible on the screen, such as a password. In AutoPlay Media Studio 5.0 this is accomplished by using a Dialog.PasswordInput action.

As an example, we will prompt the user for a password at the start of your program, and compare it to a stored value (thereby limiting access to your program to only those who know the password).

  1. To accomplish this, insert the following script in your page's On Show event:
    -- the 'correct' password

    real_password = "password";



    -- prompt the user to enter a password

    user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);



    -- compare the user's password to the 'correct' password.

    -- If the user supplies the wrong password, exit the program.

    if real_password ~= user_password then

    Application.Exit();

    end
    This script pops up a dialog box requesting the password. Whatever the user types in this dialog box appears as *******. If the correct password is entered, the program runs normally. If any other password is entered, the program will close.

  2. Alternatively, you can have a 'list' of valid passwords. To accomplish this, store your valid passwords in a table (Pro Edition Only) by inserting the following script in your page's On Show event:
    --assume the user enters a bad password

    correct_password = false;



    -- the 'correct' password

    real_passwords = {"password", "password2", "3rdPassword"};



    -- prompt the user to enter a password

    user_password = Dialog.PasswordInput("Password", "Please enter the password: ", MB_ICONQUESTION);



    -- compare the user's password to the 'correct' password.

    for j in real_passwords do

    if real_passwords[j] == user_password then

    correct_password = true;

    end

    end



    --if the password was bad, exit

    if not correct_password then

    Application.Exit();

    end

    You can also store your password list in a text file, and when your application is run, populate a table with the contents of that text file.

MORE INFORMATION

For more information please see the following topics in the AutoPlay Media Studio 5.0 help file:

  • Program Reference | Actions | Dialog | Dialog.PasswordInput

KEYWORDS: AutoPlay Media Studio 5.0, Password, Protection, Security, Secure


Last reviewed: October 3, 2003
Copyright © 2003 Indigo Rose Corporation. All rights reserved.