Thanks Charles as I will read this article

Jonathon

----- Original Message ----- From: "Charles Yeomans" <[EMAIL PROTECTED]>
To: "REALbasic NUG" <[email protected]>
Sent: Tuesday, May 02, 2006 5:54 PM
Subject: Re: PASSWORD PROTECTED data in Text file saved how?



On May 2, 2006, at 6:08 PM, Jonathon Bevar wrote:

Ok I figured it out myself.

 // Read User/Password Code from text file
 Dim strin As TextInputStream
 Dim f As FolderItem
 Dim userName, userPassword1, userPassword2 as String
 f = GetFolderItem("PatientLog_UPC.ini")
 If f.exists and f <> Nil  then
   strin = f.OpenAsTextFile
   userName = strin.ReadLine
   userPassword2 = strin.ReadLine
   strin.Close
 end if
 userPassword1 = MD5(uPassword.text)
 if uName.text = userName and userPassword1= userPassword2 then
   self.Close
   Logged.ShowModal
 else
MsgBox("The User's Name and/or Password are NOT listed as users on this system. Either re-try entering the User Name and Password or create a NEW User." + EndOfLine+ EndOfLine + "Please press 'OK' to continue...")
 end

And it works great.

It won't if f.OpenAsTextFile fails; instead you'll get a NilObjectException. I posted some code that fixed this earlier. You might also find my little article on how to read a text file useful <http://www.declaresub.com/Articles/ReadTextFile.html>.

Charles Yeomans
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>




--
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date: 5/1/2006




--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.385 / Virus Database: 268.5.1/328 - Release Date: 5/1/2006

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to