Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System.Text
- Imports System.Net
- Imports System.Security.Cryptography
- Imports System.IO
- Module vbloginsystem
- Public Function Login(ByVal Username As String, ByVal Password As String)
- Password = MD5(Password)
- Dim valid As Boolean = False
- Dim data As String = "vb_login_username=" & Username & "&vb_login_password=&s=&do=login&vb_login_md5password=" & Password & "&vb_login_md5password_utf=" & Password
- Try
- Dim request As HttpWebRequest = WebRequest.Create("http://yoursite.net/login.php?do=login")
- request.Method = WebRequestMethods.Http.Post
- request.ContentType = "application/x-www-form-urlencoded"
- request.UserAgent = "-- vBulletin Vaidation --"
- request.ContentLength = data.Length
- Dim rStream As New StreamWriter(request.GetRequestStream)
- rStream.Write(data)
- rStream.Flush()
- rStream.Close()
- Dim response As HttpWebResponse = request.GetResponse
- Dim resReader As New StreamReader(response.GetResponseStream)
- Dim str As String = resReader.ReadToEnd
- If str.Contains("Thank you for logging in") Then
- valid = True
- MsgBox("Login Successful!", vbOKOnly + vbExclamation, "Message")
- Else
- MsgBox("Login Failed!, Please try again.", vbOKOnly + vbExclamation, "Message")
- End If
- response.Close()
- Catch ex As Exception
- MessageBox.Show(ex.Message, "Error login.php Login!", MessageBoxButtons.OK, MessageBoxIcon.Error)
- End Try
- Return valid
- End Function
- Public Function MD5(ByVal number As String) As String
- Dim ASCIIenc As New ASCIIEncoding
- Dim strReturn As String = String.Empty
- Dim ByteSourceText() As Byte = ASCIIenc.GetBytes(number)
- Dim Md5Hash As New MD5CryptoServiceProvider
- Dim ByteHash() As Byte = Md5Hash.ComputeHash(ByteSourceText)
- For Each b As Byte In ByteHash
- strReturn &= b.ToString("x2")
- Next
- Return strReturn
- End Function
- End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement