Property lists and passwords
February 7, 1999
by Pat McClellan
Dear Multimedia Handyman,
I am to present the user with a field into which they must type a predetermined password. There are almost 200 different passwords allowed. Each password corresponds to a different Sales Representative with a phone number. Upon entering a proper password the user is allowed to see the custom information throughout the presentation.
I was wondering what you would recomend as resources and or extras... to accomplish this task. Is there a fairly easy solution to this problem?
Unsigned
Dear unsigned,
I can tell from your lack of signature that security is a big concern at your company. I don't think you'll need any xtras for this, although if you had a huge group of people with passwords and corresponding data, you might consider using a database xtra such as V12. So, let's talk about passwords.
When you're trying to figure out the best way to set up passwords, you need to think about your objectives. For example, are you only trying to make sure that each person who signs on is authorized to do so? If that's the case, then everyone could use the same password, since only authorized people would be given the password. In this example, there's no need to have unique passwords for each person. You could simply save the password as a global variable and check the user's input against it.
In your case, it seems that you want to use the password not only as a limit to access, but also as an index for custom data. By that, I mean that the password that is entered is an index which prompts the Director movie to display certain data. Other people without that password would not be able to access that same data. For this purpose, you'll simply need to build a big property list with the passwords as indices, and the custom data as the value. You don't say how much or what format the custom data is, but if it doesn't easily fit into a Lingo list, then you can substitute a "pointer". For example, if the custom data is a graphic cast member, then the list will not contain the graphic, but will simply contain the name of the cast member. Or the "pointer" could simply be the name of another list of data.
You say that each password corresponds to a different sales rep with a phone number. I'm imagining something like "JSmith5494609". This suggests to me that it's not a very secure system, since any one of the 200 sales reps should be able to figure out another sales rep's password pretty easily. However, by using the telephone number, that pretty much assures that each password will be unique. This is a critical point when using a property list. There can be only one instance of each "index" or password. Subsequent use of a duplicate password would overwrite the data that was originally set.
So, you're going to end up with a very long property list. Something like this:
gList= [#jsmith3121234: "This is John Smith's data.",#bjones9283748: ¬ "This is Bob Jones' data.",#vdante4235867: "This is Victor Dante's data.",...]
This is only 3 entries, and as you can see, it's already a typo nightmare waiting to happen. With 200 entries, you're really going to drive yourself crazy trying to keep all of the list syntax straight. That gives me an opportunity to talk about Lingo Utilities -- little handlers and utilities that you create during authoring to help you. For me, creating my first Lingo Utility handler marked a step up in the level of my programming sophistication.
By Lingo Utility, I'm referring to any handler or behavior that you create to help you author your program faster or smarter. The utility won't actually appear in the final program, but rather, it's just to help you along the way.
In this case, I built a little Property List Builder with allows you to enter the property name (index) and the data for that property (value). When you push the button, a script executes which dumps the input into a field member, using the correct syntax for a property list. This example assumes that you're entering string data for the value -- so it inserts the quote marks. Even though the shockwave example above shows you the field being built, this utility isn't really meant to be a shockwave movie. Download this *.dir file and run it in Director. (Mac or PC) Then, when you've finished entering all your data, copy the text from field member "myList" and paste it into the script in your movie.
You may have to change the script on the Add to List button. That's where the input text gets formatted and written to the field. Change it to suit your specific needs.
Utilities like this one will save you a lot of time in the long run. Creating this one took about 5-10 minutes, but it will save you a lot more than 10 minutes when you have to enter 200 passwords & data. Plus, you have the added benefit of automating the process and validating the data as it's entered. For example, in a property list, the property name (index) can't have a space. In the Shockwave above, try entering a password that has a space in it. The script I used checks to make sure that there are no spaces in the property name. You could add similar validation checks to the other field. This way, you'll catch your typos before they make it into your code.
Good luck with your password program, and I hope you'll start to look for opportunities to make your own utilites in the future.
Copyright 1997-2024, Director Online. Article content copyright by respective authors.