|
-
May 22nd, 2003, 04:52 PM
#21
ya, correct, i am in vb class right now, and i showed my teacher this thread and he agrees with my awnser, its right
-
May 23rd, 2003, 02:31 PM
#22
Delta4ce: You cannot decompile executable files and expect to be presented with the Visual Basic code, otherwise what's to stop everyone decompiling Windows and stealing stuff from it?
Sure, you can disassemble an executable, but that won't help you much if you want to learn VB.
-
May 23rd, 2003, 04:53 PM
#23
thats not what i am talking about, i was talking about his database problem, i know u can't decompile exe's and get the vb u want !! i wasn't talkin about that.
-
May 23rd, 2003, 05:21 PM
#24
Ok, this is un-secure and crappy coding but I just slapped some stuff together so you can figure out how it works, wouldn't want you to fail your class. By the way VB isnt my thing so theres probably I better way, but nothing came to mind. This logs some stuff in the DB about failed attempts etc.
Globals:
Public MyConnect As New ADODB.Connection 'For Queries
Public MyRecordset As New ADODB.Recordset 'For Queries
Public cmd As New ADODB.Command
Public Const ConnectString = "provider=Microsoft.Jet.OLEDB.4.0; data source=SomeAccessDB.mdb"
Public LogonTries As Integer
Some login form:
Private Sub Command3_Click(Index As Integer)
Dim Tries As Integer, EventNumber As Single
Dim User As String, Pin As Single
Pin = 0
If LogonTries < 3 Then
User = Text1
Pin = Val(Text2)
'*** Grab Event Number (If there isn't one set to 0)
cmd.CommandText = "SELECT EventNo FROM Loginout"
MyRecordset.Open cmd, , adOpenDynamic, adLockBatchOptimistic
If MyRecordset.EOF Or MyRecordset.BOF Then
EventNumber = 0
Else
MyRecordset.MoveLast
EventNumber = MyRecordset!EventNo + 1
End If
MyRecordset.Close
' ***
' *** Now See if Customer Exists with that PIN
cmd.CommandText = "SELECT * FROM Customers WHERE CustID = " & Chr(34) & User & Chr(34) & " AND CustPIN = " & Pin
MyRecordset.Open cmd, , adOpenDynamic, adLockBatchOptimistic
' *** Is there a record?
If MyRecordset.EOF Or MyRecordset.BOF Then
LogonTries = LogonTries + 1
Debug.Print "Invalid Login"
MyConnect.BeginTrans
MyConnect.Execute "INSERT INTO Loginout (EventNo,EventType,EventID,EventDate) values (" & EventNumber & "," & Chr(34) & "Invalid Log-in " & Chr(34) & "," & Pin & "," & Date & ")"
EventNumber = EventNumber + 1
' Increment Event
MyRecordset.UpdateBatch
MyConnect.CommitTrans
MyRecordset.Close
Text1.Text = ""
Text2.Text = ""
FailLogon.Show
Else
Debug.Print "ID accepted"
MyConnect.BeginTrans
MyConnect.Execute "INSERT INTO Loginout (EventNo,EventType,EventID,EventDate) values (" & EventNumber & "," & Chr(34) & "ID Accpeted " & Chr(34) & "," & Pin & "," & Date & ")"
EventNumber = EventNumber + 1
'Increment Event
MyRecordset.UpdateBatch
MyConnect.CommitTrans
MyRecordset.Close
' *** This means we've logged in succesfully
ActiveUserID = User 'Set Global Variable to keep track of User
Inquiry.Show
End If
'**** LoginTries has exceded 3
Else
cmd.CommandText = "SELECT EventNo FROM Loginout"
MyRecordset.Open cmd, , adOpenDynamic, adLockBatchOptimistic
If MyRecordset.EOF Or MyRecordset.BOF Then
EventNumber = 0
Else
MyRecordset.MoveLast
EventNumber = MyRecordset!EventNo + 1
End If
MyConnect.BeginTrans
MyConnect.Execute "INSERT INTO Loginout (EventNo,EventType,EventID,EventDate) values (" & EventNumber & "," & Chr(34) & "Log-in Attempts Exceded" & Chr(34) & "," & Pin & "," & Date & ")"
MyRecordset.UpdateBatch
MyConnect.CommitTrans
MyRecordset.Close
' *** Account Lock Out msg and Exit program
MsgBox ("Attempts Exceded")
Dim AForm As Form
For Each AForm In Forms
Unload AForm
Next
End
End If
End Sub
Private Sub Form_Load()
Set MyConnect = New Connection
With MyConnect
.ConnectionTimeout = 10
.Open ConnectString
End With
cmd.ActiveConnection = MyConnect
End Sub
If you cant figure it out from this, I cant help you. Hope this helps you out.
-Maestr0
\"If computers are to become smart enough to design their own successors, initiating a process that will lead to God-like omniscience after a number of ever swifter passages from one generation of computers to the next, someone is going to have to write the software that gets the process going, and humans have given absolutely no evidence of being able to write such software.\" -Jaron Lanier
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
|
|