Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Collections.Specialized, System.Net, System.Text, System.Security.Cryptography, System.IO
- 'VXS Funktions
- Public Class Serverpending
- Dim values As New NameValueCollection
- Dim client As New WebClient
- Dim networkconnection As Boolean = False
- Dim VXSTEAMSERVER As String = My.Settings.mainserver
- Public Confignames As String = (CurDir() & "\temp\act.vxs")
- Public Confignames2 As String = (CurDir() & "\temp\req.vxs")
- Sub checknetwork()
- If My.Computer.Network.IsAvailable = True Then
- networkconnection = True
- Else
- networkconnection = False
- End If
- End Sub
- Sub login(ByVal username As String, ByVal userpassword As String)
- If networkconnection = True Then
- Serverbusy = True
- Try
- values.Clear()
- values.Add("u", username)
- values.Add("pw", MD5StringHash(userpassword))
- Dim result() As Byte = client.UploadValues(VXSTEAMSERVER & "_login.php?", "POST", values)
- Dim resultstring As String = System.Text.Encoding.ASCII.GetString(result) '0=true
- If resultstring.Contains("login=0") = True Then '1=false
- Try
- values.Clear()
- values.Add("u", username)
- values.Add("on", "1")
- Dim onli() As Byte = client.UploadValues(VXSTEAMSERVER & "_oncheck.php?", "POST", values)
- Dim onlistring As String = System.Text.Encoding.ASCII.GetString(result) '0=true
- Dim id() As String = onlistring.Split("/")
- useridlog = id(0)
- Catch b As Exception
- MsgBox("Timeout to server while trying set your online status.", MsgBoxStyle.OkOnly, "Error 100")
- End Try
- loginfinal = True
- ElseIf resultstring.Contains("login=1") = True Then
- MsgBox("Incorrect Login! Check your login and try again.", MsgBoxStyle.OkOnly, "Error 200")
- End If 'Connection Error?
- Catch e As Exception
- MsgBox("Server is not online or have trouble to handle your request. Try again later!", MsgBoxStyle.OkOnly, "Error 101")
- End Try
- Serverbusy = False
- Else
- MsgBox("There are a problem with your connection. Check your connection and try again", MsgBoxStyle.OkOnly, "Error 201")
- End If
- End Sub
- Public Function MD5StringHash(ByVal strString As String) As String
- Dim MD5 As New MD5CryptoServiceProvider
- Dim Data As Byte()
- Dim Result As Byte()
- Dim Res As String = ""
- Dim Tmp As String = ""
- Data = Encoding.ASCII.GetBytes(strString)
- Result = MD5.ComputeHash(Data)
- For i As Integer = 0 To Result.Length - 1
- Tmp = Hex(Result(i))
- If Len(Tmp) = 1 Then Tmp = "0" & Tmp
- Res += Tmp
- Next
- Return Res
- End Function
- Sub signup(ByVal username As String, ByVal password As String, ByVal email As String)
- If networkconnection = True Then
- Try
- Serverbusy = True
- values.Clear()
- values.Add("u", username)
- values.Add("pw", MD5StringHash(password))
- values.Add("e", email)
- values.Add("o", "1")
- Dim result() As Byte = client.UploadValues(VXSTEAMSERVER & "_register.php?", "POST", values)
- Dim resultstring As String = System.Text.Encoding.ASCII.GetString(result)
- If resultstring.Contains("Account created") = True Then
- MsgBox("Your account: " & username & vbCrLf & "Your Password: " & password)
- final = True
- ElseIf resultstring.Contains("There is already an account to your IP") = True Then
- MsgBox("There is already an account to your IP! Contact Forum for more Infos.", MsgBoxStyle.OkOnly, "Error 202")
- End If
- Catch koko As Exception
- MsgBox("Server is not online or have trouble to handle your request. Try again later!", MsgBoxStyle.OkOnly, "Error 101")
- End Try
- Serverbusy = False
- Else
- MsgBox("There are a problem with your connection. Check your connection and try again", MsgBoxStyle.OkOnly, "Error 201")
- End If
- End Sub
- Sub checkusername(ByVal username As String)
- If networkconnection = True Then
- Try
- Serverbusy = True
- values.Clear()
- values.Add("u", username)
- values.Add("o", "0")
- Dim result() As Byte = client.UploadValues(VXSTEAMSERVER & "_register.php?", "POST", values)
- Dim resultstring As String = System.Text.Encoding.ASCII.GetString(result) '1+ / 0-
- If resultstring.Contains("username=1") = True Then
- user = "1"
- ElseIf resultstring.Contains("username=0") = True Then
- user = "0"
- End If
- Catch ea As Exception
- MsgBox("Server is not online or have trouble to handle your request. Try again later!", MsgBoxStyle.OkOnly, "Error 101")
- End Try
- Serverbusy = False
- Else
- MsgBox("There are a problem with your connection. Check your connection and try again", MsgBoxStyle.OkOnly, "Error 201")
- End If
- End Sub
- Sub playnewgame(ByVal gamename As String, ByVal gameid As String, ByVal user As String)
- If networkconnection = True Then
- Try
- Serverbusy = True
- values.Clear()
- values.Add("u", user)
- values.Add("id", gameid)
- values.Add("game", gamename)
- client.UploadValues(VXSTEAMSERVER & "_game.php?", "POST", values)
- Catch b As Exception
- End Try
- Serverbusy = False
- End If
- End Sub
- Sub buddyrefresh(ByVal user As String)
- Try
- Serverbusy = True
- values.Clear()
- values.Add("u", user)
- Dim getbu() As Byte = client.UploadValues(VXSTEAMSERVER & "/_buddylist.php?", "POST", values)
- Dim onoff As String = System.Text.Encoding.ASCII.GetString(getbu)
- If IO.File.Exists(Confignames) = True Then
- Dim myWriter As New IO.StreamWriter(Confignames)
- myWriter.Flush()
- myWriter.Write(onoff.Replace("#", vbCrLf))
- myWriter.Close()
- Else
- IO.File.Create(Confignames)
- Dim myWriter As New IO.StreamWriter(Confignames)
- myWriter.Flush()
- myWriter.Write(onoff.Replace("#", vbCrLf))
- myWriter.Close()
- End If
- Catch b As Exception
- End Try
- Serverbusy = False
- End Sub
- Sub addbuddy(ByVal buddy As String, ByVal user As String)
- Try
- Serverbusy = True
- values.Clear()
- values.Add("u", buddy)
- values.Add("o", "0")
- Dim result() As Byte = client.UploadValues(VXSTEAMSERVER & "_register.php?", "POST", values)
- Dim resultstring As String = System.Text.Encoding.ASCII.GetString(result) '1+ / 0-
- If resultstring.Contains("username=0") = True Then
- values.Clear()
- values.Add("b", buddy)
- values.Add("u", user)
- values.Add("r", "1")
- Dim aresult() As Byte = client.UploadValues(VXSTEAMSERVER & "_buddyrequestout.php?", "POST", values)
- Dim resultstringb As String = System.Text.Encoding.ASCII.GetString(aresult)
- If resultstringb.Contains("ok") Then
- MsgBox("A friendrequest was sendet to " & buddy & "!", MsgBoxStyle.OkOnly, "OK!")
- newbud = True
- ElseIf resultstringb.Contains("3") Then
- MsgBox(buddy & " ignores you!", MsgBoxStyle.OkOnly, "OK!")
- End If
- ElseIf resultstring.Contains("username=1") = True Then
- MsgBox(buddy & " was not found!", MsgBoxStyle.OkOnly, "Fail!")
- End If
- Catch ea As Exception
- MsgBox("Server is not online or have trouble to handle your request. Try again later!", MsgBoxStyle.OkOnly, "Error 101")
- End Try
- Serverbusy = False
- End Sub
- Sub logout(ByVal user As String)
- Try
- Serverbusy = True
- values.Clear()
- values.Add("u", user)
- values.Add("on", "0")
- Dim onli() As Byte = client.UploadValues(VXSTEAMSERVER & "_oncheck.php?", "POST", values)
- Catch b As Exception
- MsgBox("Timeout to server while trying set your online status.", MsgBoxStyle.OkOnly, "Error 100")
- End Try
- Serverbusy = False
- End Sub
- Sub msg(ByVal fromusr As String, ByVal tousr As String, ByVal message As String, ByVal prop As String)
- If networkconnection = True Then
- Serverbusy = True
- values.Clear()
- values.Add("from", fromusr)
- values.Add("to", tousr)
- values.Add("msg", message)
- values.Add("o", prop)
- Try
- Dim result() As Byte = client.UploadValues(VXSTEAMSERVER & "_messenger.php?", "POST", values)
- Dim resultstring As String = System.Text.Encoding.ASCII.GetString(result) '1+ / 0-
- MsgBox(resultstring)
- Catch ea As Exception
- MsgBox("Server is not online or have trouble to handle your request. Try again later!", MsgBoxStyle.OkOnly, "Error 101")
- End Try
- Serverbusy = False
- Else
- MsgBox("There are a problem with your connection. Check your connection and try again", MsgBoxStyle.OkOnly, "Error 201")
- End If
- End Sub
- Sub anothermsg(ByVal buddy As String)
- If networkconnection = True Then
- Serverbusy = True
- values.Add("bud", buddy)
- Try
- Dim result() As Byte = client.UploadValues(VXSTEAMSERVER & "_chat.php?", "POST", values)
- Dim resultstring As String = System.Text.Encoding.ASCII.GetString(result) '1+ / 0-
- ipvia = resultstring
- Catch ea As Exception
- MsgBox("Server is not online or have trouble to handle your request. Try again later!", MsgBoxStyle.OkOnly, "Error 101")
- End Try
- Serverbusy = False
- Else
- MsgBox("There are a problem with your connection. Check your connection and try again", MsgBoxStyle.OkOnly, "Error 201")
- End If
- End Sub
- Sub getusrpic(ByVal buddy As String)
- Try
- Dim ImageInBytes() As Byte = client.DownloadData(VXSTEAMSERVER & "avatar/" & buddy & ".jpg")
- Dim ImageStream As New IO.MemoryStream(ImageInBytes)
- usrpic = New System.Drawing.Bitmap(ImageStream)
- Catch f As Exception
- End Try
- End Sub '/avatar/ on root, jpg files 75x75 px! or use stretch in usrpicbox.pro
- Sub newuserpic(ByVal pic As Drawing.Image)
- End Sub
- Sub getrequests(ByVal user As String)
- Try
- Serverbusy = True
- values.Clear()
- values.Add("u", user)
- Dim getbu() As Byte = client.UploadValues(VXSTEAMSERVER & "/_buddyrequestin.php?", "POST", values)
- Dim onoff As String = System.Text.Encoding.ASCII.GetString(getbu)
- MsgBox(onoff)
- If IO.File.Exists(Confignames2) = True Then
- Dim myWriter As New IO.StreamWriter(Confignames2)
- myWriter.Flush()
- myWriter.Write(onoff.Replace("#", vbCrLf))
- myWriter.Close()
- Else
- IO.File.Create(Confignames2)
- Dim myWriter As New IO.StreamWriter(Confignames2)
- myWriter.Flush()
- myWriter.Write(onoff.Replace("#", vbCrLf))
- myWriter.Close()
- End If
- Catch b As Exception
- End Try
- Serverbusy = False
- End Sub
- Property newbud As Boolean = False
- Property game As String
- Property gameidc As String
- Property online As Boolean
- Property user As String
- Property userid As String
- Property loginfinal As Boolean = False
- Property final As Boolean = False
- Property Serverbusy As Boolean = False
- Property useridlog As String
- '--------For TCP Chat only!-----------
- Property ipvia As String
- '--------End of TCP-------
- Property usrpic As Drawing.Image
- Property buddys As String
- End Class 'Serverresponse Handler
Add Comment
Please, Sign In to add comment