Results 1 to 5 of 5

Thread: password project questions!

  1. #1
    Guest

    Wink

    hi everyone.
    this is the first time i'm posting a question. i'm a beginner in VB and i'm doing a project for class. my partner and i are having trouble creating a password manager project. we have to check that there are both numberic # and alpha in a string. we don't know how to do this, with do until loop? and also how can we create a log file that logs every activity (i.e.whenever a user logs in)? I'd really appreciate if anyone can provide some hints or expertise. thank you.



  2. #2
    Guest
    Hello anitafajita,


    You can use something like the following to check for Char and numbers in a string.


    Code:
    Private Sub Command1_Click()
    
      Dim I As Integer, iNum As Integer, iAlfa As Integer
      Dim sData As String, sChar As String
      
      ' get a string from the textbox
      sData = Text1.Text
      
      ' loop thru the string
      For I = 1 To Len(sData)
        ' get the current pos
        sChar = Mid(sData, I, 1)
        ' check to see if we have a number
        If IsNumeric(sChar) Then
          iNum = iNum + 1
        ' check and see if we have a char
        ElseIf Asc(sChar) >= 41 And Asc(sChar) <= 90 Or _
               Asc(sChar) >= 97 And Asc(sChar) <= 122 Then
          iAlfa = iAlfa + 1
        End If
      Next I
      
      ' display what we found
      MsgBox "There are " & iNum & " Numbers." & vbCrLf & _
             "There are " & iAlfa & " Character .", vbInformation
             
    End Sub
    To create a log file you need to open a file and print to it. You could use something like this:

    Code:
    Public Sub SaveToDisk()
    
        Dim sFileName As String, sData As String
        Dim iFileNum As Integer
        
        ' set the file path up
        sFileName = App.Path & "\applog.txt"
        ' get a free file from the system
        iFileNum = FreeFile
        ' open the file
        Open sFileName For Append As iFileNum Len = gRecLen
        
        ' create the string to print
        sData = "The user Looged in " & format(Now, "mm/dd/yy")
        
        ' print the string to the file
        Print #iFileNum, sData
        ' close the file
        Close iFileNum
    
    End Sub
    You should also add your Error handeling in there also.

    Best of luck,

  3. #3
    Guest

    Wink Password Manager ?'s (Reply to RvA)

    hi roger or anyone who's reading this,
    thank you so much for your prompt reply and help. we did figure out how to check the password string with your help. about the text file log, i used your codes but it didn't work with gRecLen. do u know why? i don't know how to use it. another question we have if you can help us out is how do we block system administrator's record from the security administrator accessing it?(we're working with access) basically there are 3 kinds of users (sys admin, security admin, and user) and we have to make sure that security admin can only change its own password and the users'. does this make sense? when the security admin goes in the system, how do we make sure sys admin's record isn't shown.
    i hope i'm not confusing you. i'm so sorry to ask you so many questions...any help is appreciated. thank you again.

    anitafajita :+)

  4. #4
    Guest
    Hello,

    Sorry about the code for the file, I grabbed that section from a app I wrote some time ago that had a UDT that I used in the print statement. Below is that same code reworked with out the UDT in it.

    Code:
    Private Sub Command1_Click()
    
        Dim sFileName As String, sData As String
        Dim iFileNum As Integer
        
        ' set the file path up
        sFileName = App.Path & "\applog.txt"
        ' get a free file from the system
        iFileNum = FreeFile
        ' open the file
        Open sFileName For Append As iFileNum
        
        ' create the string to print
        sData = "The user Looged in " & Format(Now, "mm/dd/yy")
        
        ' print the string to the file
        Print #iFileNum, sData
        ' close the file
        Close iFileNum
    
    End Sub
    Now for your next question....

    I will have to ask you to reword that question simply because I'm not sure what you want to hide and from whom you want to hide it? Well maybe I got that much but I'm still a little fuzzy on what your tring to hide.




  5. #5
    Guest

    Talking

    Hi roger.
    ur reply was really fast..wow, thank u.
    ok ur idea is right but just to add in that system admin. can add new users, change and delete anything he/she wants to. security admin. can change his/her own password along w/ the users'. the users can only change their own password. sorry that i confused u.
    along with this problem, we also need to figure out how to make sure the system admin's record can never be deleted?
    hey you're helping me out more w/ VB than my professor...it is really cool...thanks!

    anitafajita :P

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