Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.22 KB | None | 0 0
  1. Public Class vBulletin
  2.     Inherits Forum
  3.     Public Sub New(ByVal url As String, ByVal username As String, _
  4.   ByVal password As String)
  5.   MyBase.New(url, url & "/login.php?do=login", username, "vbseo_loggedin", "yes")
  6.   MyBase.logindata = "vb_login_username=" + username + "&vb_login_password=" + password + _
  7.     "&cookieuser=1&s=&securitytoken=guest&do=login&vb_login_md5password=" + Md5String(password) + _
  8.     "&vb_login_md5password_utf=" + Md5String(password)
  9.     End Sub
  10.  
  11.     Public Overrides Function isLoggedIn(ByVal cookies As System.Net.CookieContainer) As Boolean
  12.   If Not IsNothing(cookies.GetCookies(New Uri(url)).Item(defaultCookieName)) Then
  13.     If cookies.GetCookies(New Uri(url)).Item(defaultCookieName).Value.Contains(defaultCookieSearch) Then
  14.     Return True
  15.     End If
  16.   End If
  17.   Return False
  18.     End Function
  19.  
  20.     Private Function Md5String(ByVal v As String) As String
  21.   Dim myProv As New System.Security.Cryptography.MD5CryptoServiceProvider
  22.   Dim b As Byte() = System.Text.Encoding.ASCII.GetBytes(v)
  23.   b = myProv.ComputeHash(b)
  24.   Dim str As String = ""
  25.   Dim i As Integer
  26.   For i = 0 To b.Length - 1
  27.     str = (str & b(i).ToString("x2").ToLower)
  28.   Next i
  29.   Return str
  30.     End Function
  31.  
  32. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement