Advertisement
dcomicboy

blah

Nov 3rd, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.01 KB | None | 0 0
  1. Imports System.Security.Cryptography
  2. Imports System.Text
  3. Imports System.Net
  4. Imports System.IO
  5. Module vbloginsystem
  6. Public Function vbLogin(ByVal Username As String, ByVal Password As String)
  7. Password = MD5(Password)
  8. Dim valid As Boolean = False
  9. Dim data As String = "vb_login_username=" & Username & "&vb_login_password=&s=&do=login&vb_login_md5password=" & Password & "&vb_login_md5password_utf=" & Password
  10. Try
  11. Dim request As HttpWebRequest = WebRequest.Create("http://www.intgamers.net/forum/login.php?do=login")
  12. request.Method = WebRequestMethods.Http.Post
  13. request.ContentType = "application/x-www-form-urlencoded"
  14. request.UserAgent = "-- vBulletin Vaidation --"
  15. request.ContentLength = data.Length
  16. Dim rStream As New StreamWriter(request.GetRequestStream)
  17. rStream.Write(data)
  18. rStream.Flush()
  19. rStream.Close()
  20. Dim response As HttpWebResponse = request.GetResponse
  21. Dim resReader As New StreamReader(response.GetResponseStream)
  22. Dim str As String = resReader.ReadToEnd
  23. If str.Contains("Thank you for logging in") Then
  24. valid = True
  25. Else
  26. valid = False
  27. End If
  28. response.Close()
  29. Catch ex As Exception
  30. MessageBox.Show(ex.Message, "Error intgamers.net - Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
  31. End Try
  32. Return valid
  33. End Function
  34. Public Function MD5(ByVal number As String) As String
  35. Dim ASCIIenc As New ASCIIEncoding
  36. Dim strReturn As String = String.Empty
  37. Dim ByteSourceText() As Byte = ASCIIenc.GetBytes(number)
  38. Dim Md5Hash As New MD5CryptoServiceProvider
  39. Dim ByteHash() As Byte = MD5Hash.ComputeHash(ByteSourceText)
  40. For Each b As Byte In ByteHash
  41. strReturn &= b.ToString("x2")
  42. Next
  43. Return strReturn
  44. End Function
  45. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement