Computing.Net > Forums > Programming > what's wrong with this code?

what's wrong with this code?

Reply to Message Icon

Original Message
Name: ben
Date: November 8, 2003 at 01:33:53 Pacific
Subject: what's wrong with this code?
OS: win98Se
CPU/Ram: pentium III, 512 MB
Comment:

Can anyone spot anything wrong with this code? It wont compile for some reason.

Private Sub Form_Load()
Open "InfoL.txt" For Input As #1
Input #1, txtLogin.Text
Close #1
Open "InfoP.txt" For Input As #2
Input #2, txtPassword.Text
Close #2
End Sub

Private Sub Command1_Click()
If chkInfo = Checked Then
Open "InfoL.txt" For Output As #1
Print #1, txtLogin.Text
Close #1
Open "InfoP.txt" For Output As #2
Print #2, txtPassword.Text
Close #2
ElseIf chkInfo = Unchecked Then
Open "InfoL.txt" For Output As #1
Print #1, ""
Close #1
Open "InfoP.txt" For Output As #2
Print #2, ""
Close #2
End If
end sub



Report Offensive Message For Removal


Response Number 1
Name: davour
Date: November 8, 2003 at 06:02:25 Pacific
Reply: (edit)

Open "InfoL.txt"

-- The compiler doesnt recognise this path, its right because its a file name not a path.. where is infol.txt? on c:\ if so put c:\infoL.txt

is it in a subdirectory of c:\ (like text's)
if so

its c:\texts\infoL.txt


Report Offensive Follow Up For Removal

Response Number 2
Name: ben
Date: November 8, 2003 at 17:34:23 Pacific
Reply: (edit)

InfoL and InfoP are text files which store the contents of 2 text boxes. In this case txtLogin and txtPassword.

Could I save those files relative to the app I'm making? I dont really want to put it in a easy place to find the files for security purposes. Could I make the files hidden somehow?


Report Offensive Follow Up For Removal

Response Number 3
Name: Stuart
Date: November 8, 2003 at 18:39:28 Pacific
Reply: (edit)

Saving a password in plain text is never a good idea. No matter how well you think you have hidden it, somebody will find it. Its just to easy.

You need to encrypt the password with a one way system. That is once the password is encrypted, it cannot be decrypted - not without a lot of work.

To use the password you perform the same encryption on the password entered and compare the result with the saved encrypted version.

Have a look at this web site. It has an MD5 encryption DLL written for VB. Its fairly simple to use but will hide your password from all but the most detrmined of hackers.

http://userpages.umbc.edu/~mabzug1/cs/md5/md5.html

Stuart


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: what's wrong with this code?

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software




Have you ever used OpenOffice?

Yes, as my main suite.
Yes, occationally.
Yes, but only once.
No, never.


View Results

Poll Finishes In 5 Days.
Discuss in The Lounge