|
-
Aug 22nd, 2000, 02:43 PM
#1
Thread Starter
New Member
I am needing a way to validate a password against stored passwords. I need the program to only ask the user for this password once. Can anyone give me some ideas? Thanks
-
Aug 22nd, 2000, 02:48 PM
#2
Monday Morning Lunatic
Why not just keep the password in a variable?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 22nd, 2000, 02:53 PM
#3
transcendental analytic
You could encrypt your password
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Aug 22nd, 2000, 02:57 PM
#4
Are you looking to work with an INI or the Registry? For both, make a value that tells you, something like:
INI:
Password=Yes
Registry:
HKEY_LOCAL_MACHINE\Software\MyApp\Data
Name Data
Password Yes
I am not sure about the Registry, but here's how to do it the INI way.
Code:
Public Declare Function GetPrivateProfileString Lib "kernel32" Alias _
"GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal _
lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString _
As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32" Alias _
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal _
lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) _
As Long
Public Function readini(strsection As String, strkey As String, strfullpath As String) As String
Dim strbuffer As String
Let strbuffer$ = String$(750, Chr$(0&))
Let readini$ = Left$(strbuffer$, GetPrivateProfileString(strsection$, ByVal LCase$(strkey$), "", strbuffer, Len(strbuffer), strfullpath$))
End Function
Public Sub writeini(strsection As String, strkey As String, strkeyvalue As String, strfullpath As String)
Call WritePrivateProfileString(strsection$, UCase$(strkey$), strkeyvalue$, strfullpath$)
End Sub
Usage:
x = readini("Myapp.ini", "Password", "C:\Windows\Myapp.ini")
If x = "Yes" Then
'Password stored
Else
i = Inputbox("Password?")
Call writeini("Myapp.ini", "PW", "" & i & "", "C:\Windows\Myapp.ini")
Call writeini("Myapp.ini", "Password", "Yes", "C:\Windows\Myapp.ini")
End If
[Edited by Matthew Gates on 08-22-2000 at 03:59 PM]
-
Aug 22nd, 2000, 03:03 PM
#5
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|