Results 1 to 5 of 5

Thread: Need help with password validation

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    4

    Cool

    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

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    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.

  4. #4
    Guest
    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]

  5. #5
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    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
  •  



Click Here to Expand Forum to Full Width