11-13-2013 11:30 AM
I have to make a program for an automated storage. In this program it is necessary to log in with your name and password. How can I make such a program?
Is there a way to search for the right name-password combination in a .txt file?
I really look forward to an answer.
11-13-2013 11:45 AM
I think the answer depends on how secure you want it to be.
To keep it simple, you might just save the usernamd/password combinations in a text file. But just make sure to encrypt them.
Of course, someone could just delete that file and you are in trouble!
11-13-2013 11:48 AM
When assumed that nobody deleted that file. How can I make Labview search for the right combination? Do I have to use an array ore something?
11-13-2013 11:51 AM
When you say different users, you meant there will be more than 1 user with unique password for each particular users.Then for large scale of deployment, I guess that best way is to have the program check the user name and password in a database if they are valid.
11-13-2013 11:54 AM
You need to read the file
You need to search for the user if it exists
You need to check with that user name, does the password match
If you allow user name to change the password, then there is more things you will need to take care
11-13-2013 11:57 AM
It is not necacerry to change the password.
Are there any function blocks for doing those actions? I'm not that familliar with Labview.
11-13-2013 12:38 PM
Sounds like you need to learn the basics before you do anything:
http://www.ni.com/academic/students/learn-labview/
And yes, arrays are involved.
11-13-2013 01:22 PM
Without encryption, everything you need can be accomplished with blocks from the File I/O pallete, the Array pallete, and the String Pallete.
11-13-2013 01:53 PM - edited 11-13-2013 01:53 PM
i would start by storing your multiple "username/password" in a 2D string file, read the 2D file and seperate into 1D usernames and passwords...do a 1D search on the arrays and compare if the element position matches, beware that the default index is -1, you need a # greater than/equal to 0 for a match.
11-13-2013 02:07 PM - edited 11-13-2013 02:09 PM
It requires a bit more understanding of the underlying file structure, but I'd suggest using configuration files (.ini) to store username-password as key-value combinations. This way you can query a username directly using the configuration file API rather than searching.
Any obfuscation or encryption would use nearly identical logic. Makes for a much cleaner code and scales better- you could even store users as sections rather than keys and track any amount of user-specific data (in this case, you'd use a "Password" or similar key under the user's section). There are a large number of config file examples available on ni.com with a bit of searching.
Regards,