Covey
Creator of EliteSwitch
I posted this program in community general, back in late Jan 11'.
It's sort of a pointless program, but what it does is rolls through every page of a thread and does the following;
- Counts the amount of banned users
- Counts the amount of posts by banned users
- Lists the banned users names
Download the source code below:
http://rapidshare.com/files/450690701/BannedUsers.zip
Note
It will not work on a thread that is only 1 page, i've made it display a messagebox abusing you for being lazy if you try that
I also predict it will work on all forums that use the same version of vBulletin as Sythe, but i could be wrong. (not been tested)
----------------------
I will post the source via clipboard in this post for those who just want to browse the code and not download it.
You will need the following controls:
- Textbox called 'txtURL'
- Textbox called 'txtDisplay'
- Listbox called 'lstNames'
- Button called 'cbStart'
Make sure your form is called 'Form1'
Code below:
It's sort of a pointless program, but what it does is rolls through every page of a thread and does the following;
- Counts the amount of banned users
- Counts the amount of posts by banned users
- Lists the banned users names
Download the source code below:
http://rapidshare.com/files/450690701/BannedUsers.zip
Note
It will not work on a thread that is only 1 page, i've made it display a messagebox abusing you for being lazy if you try that
I also predict it will work on all forums that use the same version of vBulletin as Sythe, but i could be wrong. (not been tested)
----------------------
I will post the source via clipboard in this post for those who just want to browse the code and not download it.
You will need the following controls:
- Textbox called 'txtURL'
- Textbox called 'txtDisplay'
- Listbox called 'lstNames'
- Button called 'cbStart'
Make sure your form is called 'Form1'
Code below:
Code:
Public Class Form1
Private strUrl As String
Private intPages As Integer
Private strThread As String
Private intCountMain As Integer
Private blnComplete As Boolean
Private blnClose As Boolean = False
Private intPostCount As Integer
Private intBanned As Integer
Private Sub cbStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbStart.Click
Try
If InStr(LCase(txtURL.Text), "&page=") Then
MsgBox("Please trim off the &page=[NUMBER] from the Thread URL.", MsgBoxStyle.Information, "Trim URL")
Exit Sub
End If
lstNames.Items.Clear()
txtDisplay.Clear()
intPostCount = 0
intBanned = 0
blnComplete = False
If txtURL.Text = "" Then
Exit Sub
End If
Me.Text = "Banned Users - Downloading Thread..."
txtURL.Enabled = False
cbStart.Enabled = False
strUrl = txtURL.Text
downloaddata()
Catch err As Exception
MsgBox(err.Message)
End Try
End Sub
Private Sub downloaddata()
Try
Using wcDownload As New Net.WebClient
AddHandler wcDownload.DownloadStringCompleted, AddressOf wcDownload_DownloadStringCompleted
wcDownload.Headers.Add("User-Agent", "GET / HTTP 1.1)")
wcDownload.DownloadStringAsync(New Uri(strUrl))
End Using
Catch err As Exception
MsgBox(err.Message)
End Try
End Sub
Private Sub wcDownload_DownloadStringCompleted(ByVal sender As Object, ByVal e As System.Net.DownloadStringCompletedEventArgs)
Try
Dim posPo(1) As Integer
Dim strHtml As String = e.Result
Dim i As Integer
posPo(0) = InStr(LCase(strHtml), "<title>") + 7
posPo(1) = InStr(posPo(0), LCase(strHtml), " - sythe.org forums")
strThread = Mid(strHtml, posPo(0), posPo(1) - posPo(0))
Me.Text = "BannedUsers - " & strThread
posPo(0) = InStr(LCase(strHtml), ">page 1 of ") + 11
If posPo(0) = 11 Then
MsgBox("I was lazy and couldn't be fucked making this little exception." & vbNewLine & "It seems there is only 1 page of your thread, don't be a lazy cunt and just count the banned users yourself ;)" & vbNewLine & vbNewLine & "Love you forever" & vbNewLine & "~Covey")
txtURL.Text = ""
cbStart_Click(sender, e)
cbStart.Enabled = True
blnComplete = True
blnClose = True
txtURL.Enabled = True
Me.Text = "Banned Users"
Exit Sub
End If
posPo(1) = InStr(posPo(0), LCase(strHtml), "</td>")
intPages = CInt(Mid(strHtml, posPo(0), posPo(1) - posPo(0)))
txtDisplay.Text = "Thread title: " & strThread & vbNewLine & "Amount of pages: " & intPages
posPo(0) = 1
For i = 1 To 30
posPo(0) = InStr(posPo(0), LCase(strHtml), " *banned*")
If posPo(0) = 0 Then
Exit For
End If
posPo(1) = InStrRev(LCase(strHtml), """>", posPo(0)) + 2
AddUser(Mid(strHtml, posPo(1), posPo(0) - posPo(1)))
intPostCount = intPostCount + 1
posPo(0) = posPo(0) + 8
Next
For intCount = 2 To intPages
If blnClose = True Then
Exit For
End If
intCountMain = intCount
blnComplete = False
Using wcDownload2 As New Net.WebClient
txtDisplay.Text = "Thread title: " & strThread & vbNewLine & "Amount of pages: " & intPages & vbNewLine & _
vbNewLine & "Downloading page " & intCount & " of " & intPages & "..." & vbNewLine & _
"Posts by Banned users: " & intPostCount & vbNewLine & "Banned users: " & intBanned
AddHandler wcDownload2.DownloadStringCompleted, AddressOf wcDownload2_DownloadStringCompleted
wcDownload2.Headers.Add("User-Agent", "GET / HTTP 1.1)")
wcDownload2.DownloadStringAsync(New Uri(strUrl & "&page=" & intCount))
End Using
Do While blnComplete = False
Dim sw As New Stopwatch
sw.Start()
Do While sw.ElapsedMilliseconds < 50
Application.DoEvents()
Loop
sw.Stop()
Loop
Next
cbStart.Enabled = True
txtURL.Enabled = True
If blnClose = True Then
Me.Close()
End If
Catch err As Exception
MsgBox(err.Message)
End Try
End Sub
Private Sub wcDownload2_DownloadStringCompleted(ByVal sender As Object, ByVal e As System.Net.DownloadStringCompletedEventArgs)
Try
Dim posPo(1) As Integer
Dim strHtml As String = e.Result
Dim i As Integer
posPo(0) = 1
For i = 1 To 30
posPo(0) = InStr(posPo(0), LCase(strHtml), " *banned*")
If posPo(0) = 0 Then
Exit For
End If
posPo(1) = InStrRev(LCase(strHtml), """>", posPo(0)) + 2
AddUser(Mid(strHtml, posPo(1), posPo(0) - posPo(1)))
intPostCount = intPostCount + 1
posPo(0) = posPo(0) + 8
Next
blnComplete = True
If intCountMain = intPages Then
txtDisplay.Text = txtDisplay.Text & vbNewLine & vbNewLine & "Complete!"
End If
Catch err As Exception
MsgBox(err.Message)
End Try
End Sub
Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
If blnClose = False Then
If blnComplete = False Then
blnClose = True
txtDisplay.Text = txtDisplay.Text & vbNewLine & vbNewLine & "Preparing to Exit..."
e.Cancel = True
End If
End If
End Sub
Private Sub AddUser(ByVal strName As String)
Dim i As Integer
For i = 0 To lstNames.Items.Count - 1
If LCase(strName) = LCase(lstNames.Items(i)) Then
Exit Sub
End If
Next
lstNames.Items.Add(strName)
intBanned = intBanned + 1
End Sub
End Class

