Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,557 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,919 people online right now. Registration is fast and FREE... Join Now!




Login System

 
Reply to this topicStart new topic

Login System, Someone wanted a login.

sam_benne
14 May, 2008 - 12:28 PM
Post #1

D.I.C Regular
Group Icon

Joined: 16 Jan, 2008
Posts: 298



Thanked: 1 times
Dream Kudos: 400
My Contributions
I have created a login that needs a text file with two words in it one on a line.

CODE

Private Sub Form_Load()
Dim MyName As String
Dim MyUName As String
Dim MyPass As String
Dim Response As Integer
Dim Saved_Name As String
Dim Saved_Pass As String
Dim Label2 As String


        Open "\vb\login system\login.txt" For Input As #1
         Line Input #1, Saved_Name
         Line Input #1, Saved_Pass
        Close #1
        
        
        nFileNum = FreeFile
  
Login_Name:
    MyName = InputBox("Please, enter Your name.", "Introduce yourself", "")
    If MyName = "" Then
     Response = MsgBox("To continue with logging on, you need to introduce yourself." & vbCrLf & "Do You wish to proceed with the programm?", vbCritical + vbYesNo, "Error")
     If Response = vbYes Then GoTo Login_Name
     If Response = vbNo Then
       MsgBox "We are sorry you do not wish to proceed." & vbCrLf & "We wish you a good day", vbInformation + vbOKOnly, "End"
       Label2 = MyName
       End
     End If
    End If


Login_UName:
MyUName = InputBox("Good day " & MojeIme & ", please, enter your user name.", "Login", "")
If MyUName = "" Then
Response = MsgBox("To continue with logging on, you need to enter username." & vbCrLf & "Do You wish to proceed with the programm?", vbCritical + vbYesNo, "Error")
If Response = vbYes Then GoTo Login_UName
If Response = vbNo Then
   MsgBox "We are sorry you do not wish to proceed." & vbCrLf & "We wish you a good day", vbInformation + vbOKOnly, "End"
   End
End If
End If

Login_Pass:
    MyPass = InputBox("Please, enter a password for user name " & MyUName & ".", "Password", "")
    If MyPass = "" Then
     Response = MsgBox("To continue with logging on, You need to enter your password." & vbCrLf & "Do You wish to proceed with the programm?", vbCritical + vbYesNo, "Error")
     If Response = vbYes Then GoTo Login_Pass
     If Response = vbNo Then
       MsgBox "We are sorry you do not wish to proceed." & vbCrLf & "We wish you a good day", vbInformation + vbOKOnly, "End"
       End
     End If
    End If
    
    If (Saved_Name = MyUName) And (Saved_Pass = MyPass) Then
MsgBox "Good day " & MyName & "." & vbCrLf & "Thank you for logging on.", vbInformation + vbOKOnly, "Welcome"
Else
MsgBox "We are sorry, username and/or password are not correct", vbCritical + vbOKOnly, "Error"
End
End If
End Sub

'This is Open Source. Created By Sam Bennett


User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 11:23PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month