+ Reply to Thread
Results 1 to 21 of 21

storing username and password data in .txt file

  1. #1
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38

    storing username and password data in .txt file

    Hi,

    I was able to get some help a while ago and hoping for someone to reply as well. Any one have ideas how to create a userform which will be use for username and password input? I know how to create one but is there anyway that the username and password will be stored as .txt file instead of using worksheet to store the data?

    Regards,

    Burke

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258
    Hello Burke,

    Will you have a single or multiple users that you need to store data for? Will this be run from a shared workbook on a network?

    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi again Leith,

    Yup this will run in a shared network and will be used by multiple users. Thanks

    Regards,

    Burke

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    Why store such sensitive data in a text file with absolutely no protection? it seems quite ludicrous, the only possible reason seems to be for collecting the users data without their knowledge as to check a users details you will always have to check back to another file to verify, we all know that Excels security is poor but not as poor as what you are suggesting, you would be better off storing them in the workbook in an xlVeryHidden worksheet - depending which country your in i would guess iit's breaking the data protection act!
    Not all forums are the same - seek and you shall find

  5. #5
    Forum Contributor
    Join Date
    02-23-2006
    Location
    Near London, England
    MS-Off Ver
    Office 2003
    Posts
    770
    Another place I recently discovered for 'hiding' information like this is in the worksheet .CustomProperties in an XML type format.
    As far as I know there is no way for the user to directly access this data without using a macro to get the values, (but I may be wrong on that - I'm sure someone will say so if I am )

  6. #6
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi there Simon,

    Well you are definitely right on this one. I do know how to store data on worksheet but just for more learning, I would like to know how to store them using other form like in .txt file. Also, for protection purposes? the folder to which the data is being stored is already password protected. What I mean is that even though, users can access the excel file yet the folder where the .txt data will be stored is password protected and can only be access by local IC. I just thought of storing the data in .txt form since this file where it will be saved is password protected or cannot be accessed unless given some rights. I have tried storing password using worksheet but when you use open office application I found out that you can unhide hidden worksheet easily and moreso find out where the exact path of the password is stored. Not sure if every one is aware of it but I just recently discovered it. That's why I thought of storing data in .txt form and place this .txt form in a folder where only certain authorize people can access it.

    Regards,

    Burke

  7. #7
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    I haven'y used open office but an xlVeryHidden sheet is not the same as a hidden sheet, xlVeryHidden can only be made visible by code, have you tried it for a veyyhidden sheet?

  8. #8
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi there Simon,

    Yes, I did tried xlVeryHidden but when you open the excel file itself using open office calc application, it will show you the hidden sheet. Even vba codes which are password protected can be seen using open office calc application. That is why the only option I can think of in securing data is to store them in .txt form and save this .txt file in a restricted folder.

    Regards,

    Burke

  9. #9
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,468
    How will the program be able to access the restricted folder?

    If you are going to use a file I would suggest you use a binary file and use an algorithm to encode the username and password.
    Of course if they can see the code they can unravel the encoding.

    How about using a database to store the details?
    Cheers
    Andy
    www.andypope.info

  10. #10
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi there Andy,

    I dont know how to create the program to be save in.txt file. But isn't it there is a certain path where this data can be save right? Im not sure how to make it in a database form. Can you show me how?

    Regards,

    Burke

  11. #11
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi,

    Anyone have some ideas how to store data in .txt file?

    Regards,

    Burke

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,468
    You need to use the I/O commands in VBA.

    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi Andy,

    I appreciate your quick response. Where do I suppose to place that code? I have tried it and insert the code on the Command_button Click. It returns valeu but it populates the entire .txt file with the filename inside the code which is "burke" and "secret". I know I am missing something here. Can you please help me figure it out?

    regards,

    Burke

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,468
    The code simply illustrates the I/O of how to create a file, write to it. And how to open it and read it.

    Placing all the code in a button click will not be of much use.

    On the userform you need to collect the Username and password via textboxes.

    Then open the text file and read username and password. Compare this to the entered information. If match then allow the user to do what ever it is you are protecting them from.
    If not a match then check the next.

    If successfully proceed otherwise warn user of failure.
    Also keep tally of failures and when limit exceeded close.

    See attached based on previous code which create the pwd.txt file.
    Attached Files Attached Files

  15. #15
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi Andy,

    Thank you very much for helping me on this one. Correct me if I am wrong that this code:
    Please Login or Register  to view this content.
    is responsible for the creation of the username and password? If I am right, then how can this:
    Please Login or Register  to view this content.
    be modified to any username and password? I mean if I am to create a userform for the creation of new username and password, how can this be changed? Do I need to change it manually? Can this be done automatically that if the admin user created the username and password the .txt file will be updated as well? Sorry for giving you a hard time. I appreciate all your doings.

    Regards,

    Burke

  16. #16
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,468
    This bit will add more information to the file, creating it if it does not exist.

    Please Login or Register  to view this content.
    And rather than explicit text Burke and secret you would get the information from a userform or cells. If you use the userform example I just posted then instead of reading the file and comparing you would simple print the contents of textbox1 and textbox2.

  17. #17
    Registered User
    Join Date
    07-31-2008
    Location
    United States
    Posts
    38
    Hi Andy,

    Im not sure if I got your explanation right but are you saying that if like there is no existing Username and Password, then the default username and password from the sample you posted is Burke and secret right? What if I would like to reset the username and password, how can it be done that the stored data in the .txt file will be updated?

    Regards,

    burke

  18. #18
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,468
    The example code APPENDS username and password, so the file once created will continue to grow. Upon first open of the file, using the Append option, it will be created if it does not exist.

    I assumed you would want more that 1 persons details in this file, no?

    I you want to reset or remove user/pwd you will need to read and write the file. Handling the records as neccessary.
    Note that you can not read and write to the same filename using the current OPEN parameters. It is possible but requires alternate coding.

  19. #19
    Forum Contributor
    Join Date
    08-07-2008
    Location
    United States
    MS-Off Ver
    Microsoft Office 2003
    Posts
    362
    this seems to be more complicated than I thought
    Last edited by stoey; 08-22-2008 at 08:58 AM.

  20. #20
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,468
    For certain it is more straight forward when simply reading and writing cells but that's because you are more familiar with the syntax. And a spreadsheet makes for a more easily maintained repository.

    Once you understand the processes and syntax for doing file I/O it is no more difficult. That said the method is not much more secure that using a hidden worksheet.

  21. #21
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    burke, stoey? one in the same? please stick to one username per thread as it gets confusing!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. username and password login
    By dc123 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 12-17-2013, 08:38 AM
  2. Username and password
    By mitelkm in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-28-2007, 12:27 PM
  3. Input Box Prompt for password
    By pichai in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 12-12-2007, 08:44 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1