Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script language="VBScript">
- Class Logins
- Public SpitOut
- Public Function ReadLogIns
- Const READ = 1
- Dim ObjFile
- set FSO = CreateObject("Scripting.FileSystemObject")
- cPath = InputBox("Please enter location of username/password .csv","File Location")
- If FSO.fileexists(cPath) then
- Set objReadFile = FSO.OpenTextFile(cPath, READ)
- Else
- Msgbox "Unable to find file! Did you include the file extension?",,"Error!"
- WScript.Quit
- End If
- Dim counter : counter = 0
- Dim myBigArray ()
- ReDim myBigArray(counter)
- Do Until objReadFile.AtEndofStream
- strLine = objReadFile.ReadLine()
- Dim myLittleArray : myLittleArray = Split (strLine,",")
- myBigArray (counter) = myLittleArray
- counter = counter + 1
- ReDim Preserve myBigArray(counter + 1)
- Loop
- objReadFile.Close
- ReDim Preserve myBigArray(counter - 1)
- Spitout = MyBigArray
- End Function
- End Class
- Class Login
- Public Data
- Private attempts
- Public Sub Class_Initialize()
- attempts = 3
- End Sub
- Public Default Function Init(s)
- attempts = s
- Set Init = Me
- End Function
- Public Function Go
- do while true
- dim user : user = InputBox("Enter your username","Enter Value")
- dim password : password = InputBox("Enter your password","Enter Value")
- For Each Data In MyLogins.SpitOut
- if Data(0) = user and Data(1) = password then
- Go = True
- Exit Function
- End If
- Next
- attempts = attempts - 1
- if attempts = 0 then
- Go = False
- Exit Function
- End If
- MsgBox "Invalid attempt. You have " & attempts & " attempts left", vbOKOnly, "Try again..."
- loop
- End Function
- End Class
- set myLogin = (new Login)(2)
- set myLogins = (new Logins)
- MyLogins.ReadLogins
- myLogin.Data = myLogins.SpitOut
- dim result : result = myLogin.Go
- if result then MsgBox "I'm in" else MsgBox "I'm out"
- </script>
- </job>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement