|
-
Dec 30th, 2004, 12:40 AM
#1
Thread Starter
Frenzied Member
whats wrong with my functions? [resolved]
Okay, im not going to go into every aspect of the program but here goes:
I've written 2 functions on my serverside which checks a username list for a match n if it finds it then it goes to the 2nd function which then checks if the password in the other listbox matches whats in the database aswell.
now on my client end , its waiting to receive a "failed" , "1" ,or "2" string back... i know the problem lies in my loginCheck1 function. but say that the login fails due to incorrect username it sends failed twice and then a 1 because maybe the password matches..no clue how this happens seeing as how it shouldn't even go to loginCheck2 if check1 doesnt succeed.
VB Code:
Private Function loginCheck1()
Dim i As Integer
Dim userName As String
Dim IntList As Integer
userName = Text1 'the username attempting to login
For i = 0 To List2.ListCount - 1
If InStr(userName, List2.List(i)) Then ' check database list for username
'do whatever you need here.....if it finds the name
IntList = i
List3.Text = List3.List(IntList) 'get corresponding pass next to username
loginCheck2 ' send to logincheck2 function to check if password matches too
Exit For 'exit for if found
Else
'send back message saying incorrect username/password
server.senddata "failed"
End If
Next
End Function
Private Function loginCheck2()
Dim strLogin As String
Dim userPass As String
userPass = Text2
'check to see if the password matches whats in the database under that username
If List3.Text = userPass Then
'it matches, do stuff here
strLogin = "1"
server.SendData strLogin
List1.AddItem server.RemoteHostIP & " has logged in successfully! at: " & Now
Else
strLogin = "2"
server.SendData strLogin
End If
End Function
and heres the client end
VB Code:
Private Sub client_DataArrival(ByVal bytesTotal As Long)
Dim strLogin As String
' do stuff to verify if login was successful
client.GetData strLogin
Text1.Text = strLogin
If strLogin = "1" Then
MsgBox "You have logged in successfully! Welcome to the Valeo Chat System...", vbInformation, "Valeo System"
budlist.Show 'since they've logged in correctly, load buddylist lol =D
ElseIf strLogin = "2" Then
MsgBox "Sorry, but your login attempt has failed due to an incorrect username/password!", vbCritical, "Login Failed"
client.Close ' close connection to server
End If
End Sub
im sure im just not seeing something obvious though,
Last edited by ice_531; Dec 30th, 2004 at 01:51 AM.
:::`DISCLAIMER`:::
Do NOT take anything i have posted to be truthful in any way, shape or form.
Thank You!
--------------------------------
"Never heard about "hiking" poles. I usualy just grab a stick from the nature, and use that as a pole." - NoteMe
"Finaly I can look as gay as I want..." - NoteMe
Languages: VB6, BASIC, Java, C#. C++
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
|
Click Here to Expand Forum to Full Width
|