How do you call passwords from a txt file to check with the entered password to allow access. I hope that makes sense.

I have Attached A Zip File, That includes A VB Project that authenticates a username and password from a textfile. This project does just that. In order to make the password file a bit more secure (Than what I have done here) would be to encrypt the password that is in the file. Then, when the user enters their username and password, the program would encrypt the username and password (that was entered by the user) with the exact same method as that in the password file. If the encrypted password that the user typed, is the same as the encrypted password in the file, then they have authenticated correctly (assuming the usernames are the same also).

A Quick overview of how this program works is basically like this. The user enters a username and password, which is stored in a couple of respective variables (and complains if they leave the fields blank). Then It opens the password file. Inside of the password file, are usernames and passwords (right now, in plain text) in the format of: username : password (spaces around : added here to bypass the smiley)
Then The program reads from the password file, line by line, and splits the username and password from the file into an array. So the username from the file is stored in element 0 of the array, while the password is element 1. Then, it compares element 0 of the array (username in the file) to what the user typed for their username in our form. It does the same with element 1 and the password, and if successful, sets a flag variable to true (this was set to false earlier). After the closing of the file, we check the flag variable. If it's true, the user authenticated correctly. If it's false, they failed to authenticate.

The attached Zip file, is line by line commented, and should you have any further questions... just ask.

Hi I tried to run this code but it ives me an error at this line..

Open PTextPass For Input As #1


May I please knwo why ??

Thanks a ton
pujki

Most likely because the file refered to by the variable PTextPass probably does not exist on your system. In the form load event, you'll see that PTextPass is refered to by app.path and then ptextfile.dat. If the file DOES exist on your system, then there is no reason that line should error out. I have just downloaded the file onto a clean system (with a fresh install of VB) and it has worked flawlessly.

Hi

thanks for your help..! it did work out. I am now trying to create an applciation in vb 6.0 which when open will list all the contents that i have itin a txt file. basically these are like person details hence there are many ppl. details and i separate them using a pipe | .. when these are dislayed in the vb form i would like to view any person details by giving them a no. say when i give as open case 1. then i want some of its details to be displayed eg. just the name and address ina particular format in another form and i have few more text box which when entered should automatically be saved again in that text file in the same persons row....I hope so i am clear to u..I am not that familiar with vb. I just need your help ..can u please advice me how i can do this.....??

thank you very much
pujki

Hi

I am attaching a zip file which contains some code to play with reading and writing to a text file. When you update it will not replace the line but add as a new line. Hope it helps.

Marikanna

Success is a Journey, not a Destination

Thanks a lot!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.