Post: [VB.NET] NGU Log-In System for your tool
04-10-2011, 05:57 PM #1
IVThaKiller
Gym leader
(adsbygoogle = window.adsbygoogle || []).push({}); Here is a log-in system I quickly made for some one working on a NGU Log-In system type of thing. Pleas give credit if you use it:

    Public Class NGULogIn

' ----------------------------------------------------
' | Website Log-In System |
' | By: IVThaKiller |
' ----------------------------------------------------

Dim vbTwoLine As String = vbNewLine + vbNewLine

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If My.Computer.Network.Ping("216.245.214.2") = True Then

Me.Enabled = False
Me.Text = "Loading..."

LogInWebBrowser.Navigate("NextGenUpdate.com")
LogInWebBrowser.ScriptErrorsSuppressed = True

LoadingTimer.Interval = "1000"
Loading.Interval = "5000"
Loading.Start()

ElseIf My.Computer.Network.Ping("216.245.214.2") = False Then

MsgBox("Error communicating with NGU servers! These could be few of the reasons:" + vbTwoLine + " - Your internet is down." + vbNewLine + " - NGU servers are down." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try again.", MsgBoxStyle.Critical, Title:="Error - Communication Error")
End

End If


End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogInButton.Click
LogInButtonForm()
End Sub

Private Sub LoadingTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadingTimer.Tick

If LogInWebBrowser.Document.GetElementById("vb_login_username") Is Nothing Then

Else
LoadingTimer.Stop()
MsgBox("Error login! These could be few of the reasons:" + vbTwoLine + " - Error log-in." + vbNewLine + " - Internet error." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try it again.", MsgBoxStyle.Critical, Title:="Error - Log In Error")
LogInButton.Enabled = True
End If

End Sub

Private Sub Loading_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Loading.Tick


If LogInWebBrowser.Document.GetElementById("vb_login_username") Is Nothing Then

Else
Me.Enabled = True
End If

Me.Text = "NextGenUpdate LogIn System"
Me.Enabled = True
Loading.Stop()

End Sub

Private Sub Username_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Username.Enter
LogInButtonForm()
End Sub

Private Sub Password_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Password.Enter
LogInButtonForm()
End Sub

Public Sub LogInButtonForm()
LogInLabel.Text = LogInLabel.Text + 1

If LogInLabel.Text = "5" Then

Username.Enabled = False
Password.Enabled = False
MsgBox("Pleas wait 15 minutes. You have tried to Log-In to much times." + vbTwoLine + "This is NGU protocal. Sorry.", MsgBoxStyle.Exclamation, Title:="Error - 15 minutes Error. ")

Else

LogInWebBrowser.Document.GetElementById("vb_login_username").SetAttribute("value", Username.Text)
LogInWebBrowser.Document.GetElementById("vb_login_password").SetAttribute("value", Password.Text)
LogInWebBrowser.Document.GetElementById("cookieuser").InvokeMember("click")

Dim allelements As HtmlElementCollection = LogInWebBrowser.Document.All
For Each webpageelement As HtmlElement In allelements

If webpageelement.GetAttribute("value") = "Log in" Then
webpageelement.InvokeMember("click")
End If

Next

LoadingTimer.Start()
LogInButton.Enabled = False

End If
End Sub
End Class


What you will need:
Originally posted by another user
- 2 timers with these names:
  • LoadingTimer
  • Loading


- 1 Label with this name:
  • LogInLabel


- 1 WebBrowser with this name:
  • LogInWebBrowser


- 2 TextBox with these names:
  • Username
  • Password


What will be set to invisible:
  • WebBrowser
  • Label


This is what will occur in specific situations:
Originally posted by another user

  • Internet Error = Message
  • NGU Server Error = Message
  • Log-In Error = Message
  • To much try to LogIn = Message


Here is the coding if you want one just for your site:

    Public Class LogInSystem

' ----------------------------------------------------
' | Website Log-In System |
' | By: IVThaKiller |
' ----------------------------------------------------

Dim SiteIP As String = "" ' Your site IP.
Dim SiteURL As String = "" ' Your site.
Dim SiteName As String = "" ' Your site name.

Dim UsernameLogInID As String = "vb_login_username" ' Your site username login ID. The one inputed is vBulletin default.
Dim PasswordLogInID As String = "vb_login_password" ' Your site password login ID. The one inputed is vBulletin default.
Dim CookieLogID As String = "cookieuser" ' Your site 'Save Password' login ID. The one inputed is vBulletin default.
Dim LogInValue As String = "Log in" ' Your site 'Log In' button value. The one inputed is vBulletin default.

Dim AttemptNumber As String = "5" ' Your site attempt times. 5 is usually default. Do NOT leave this blank.

Dim vbTwoLine As String = vbNewLine + vbNewLine

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If My.Computer.Network.Ping(SiteIP) = True Then

Me.Enabled = False
Me.Text = "Loading..."

LogInWebBrowser.Navigate(SiteURL)
LogInWebBrowser.ScriptErrorsSuppressed = True

LoadingTimer.Interval = "1000"
Loading.Interval = "5000"
Loading.Start()

ElseIf My.Computer.Network.Ping(SiteIP) = False Then

MsgBox("Error communicating with NGU servers! These could be few of the reasons:" + vbTwoLine + " - Your internet is down." + vbNewLine + " - " + SiteName + " servers are down." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try again.", MsgBoxStyle.Critical, Title:="Error - Communication Error")
End

End If


End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogInButton.Click
LogInButtonForm()
End Sub

Private Sub LoadingTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadingTimer.Tick

If LogInWebBrowser.Document.GetElementById(UsernameLogInID) Is Nothing Then

Else

LoadingTimer.Stop()
MsgBox("Error login! These could be few of the reasons:" + vbTwoLine + " - Error log-in." + vbNewLine + " - Internet error." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try it again.", MsgBoxStyle.Critical, Title:="Error - Log In Error")
LogInButton.Enabled = True

End If

Me.Text = SiteName + " LogIn System"

End Sub

Private Sub Loading_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Loading.Tick


If LogInWebBrowser.Document.GetElementById(UsernameLogInID) Is Nothing Then ' -------------- If you are all ready log-in, what the program will do.

MsgBox("You are all ready log-in.", MsgBoxStyle.Information, Title:="Error - All ready log-in.")
Me.Enabled = False
End

Else
Me.Enabled = True
End If

Loading.Stop()

End Sub

Private Sub Username_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Username.Enter
LogInButtonForm()
End Sub

Private Sub Password_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Password.Enter
LogInButtonForm()
End Sub

Public Sub LogInButtonForm()
LogInLabel.Text = LogInLabel.Text + 1

If LogInLabel.Text = AttemptNumber Then

Username.Enabled = False
Password.Enabled = False
MsgBox("Pleas wait " + AttemptNumber + " minutes. You have tried to Log-In to much times." + vbTwoLine + "This is " + SiteName + " protocal. Sorry.", MsgBoxStyle.Exclamation, Title:="Error - 15 minutes Error. ")

Else

LogInWebBrowser.Document.GetElementById(UsernameLogInID).SetAttribute("value", Username.Text)
LogInWebBrowser.Document.GetElementById(PasswordLogInID).SetAttribute("value", Password.Text)
LogInWebBrowser.Document.GetElementById(CookieLogID).InvokeMember("click")

Dim allelements As HtmlElementCollection = LogInWebBrowser.Document.All
For Each webpageelement As HtmlElement In allelements

If webpageelement.GetAttribute("value") = LogInValue Then
webpageelement.InvokeMember("click")
End If

Next

LoadingTimer.Start()
LogInButton.Enabled = False

End If
End Sub
End Class
Last edited by IVThaKiller ; 04-10-2011 at 06:19 PM.

The following 2 users say thank you to IVThaKiller for this useful post:

ImTrippinHoes, RedHair
04-10-2011, 05:58 PM #2
Rawad
Do a barrel roll!
Thanks for sharing this.
Last edited by Rawad ; 04-10-2011 at 05:58 PM. Reason: spelling error
04-12-2011, 02:09 AM #3
RedHair
Pokemon Trainer
Originally posted by IVThaKiller View Post
Here is a log-in system I quickly made for some one working on a NGU Log-In system type of thing. Pleas give credit if you use it:

    Public Class NGULogIn

' ----------------------------------------------------
' | Website Log-In System |
' | By: IVThaKiller |
' ----------------------------------------------------

Dim vbTwoLine As String = vbNewLine + vbNewLine

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If My.Computer.Network.Ping("216.245.214.2") = True Then

Me.Enabled = False
Me.Text = "Loading..."

LogInWebBrowser.Navigate("NextGenUpdate.com")
LogInWebBrowser.ScriptErrorsSuppressed = True

LoadingTimer.Interval = "1000"
Loading.Interval = "5000"
Loading.Start()

ElseIf My.Computer.Network.Ping("216.245.214.2") = False Then

MsgBox("Error communicating with NGU servers! These could be few of the reasons:" + vbTwoLine + " - Your internet is down." + vbNewLine + " - NGU servers are down." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try again.", MsgBoxStyle.Critical, Title:="Error - Communication Error")
End

End If


End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogInButton.Click
LogInButtonForm()
End Sub

Private Sub LoadingTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadingTimer.Tick

If LogInWebBrowser.Document.GetElementById("vb_login_username") Is Nothing Then

Else
LoadingTimer.Stop()
MsgBox("Error login! These could be few of the reasons:" + vbTwoLine + " - Error log-in." + vbNewLine + " - Internet error." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try it again.", MsgBoxStyle.Critical, Title:="Error - Log In Error")
LogInButton.Enabled = True
End If

End Sub

Private Sub Loading_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Loading.Tick


If LogInWebBrowser.Document.GetElementById("vb_login_username") Is Nothing Then

Else
Me.Enabled = True
End If

Me.Text = "NextGenUpdate LogIn System"
Me.Enabled = True
Loading.Stop()

End Sub

Private Sub Username_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Username.Enter
LogInButtonForm()
End Sub

Private Sub Password_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Password.Enter
LogInButtonForm()
End Sub

Public Sub LogInButtonForm()
LogInLabel.Text = LogInLabel.Text + 1

If LogInLabel.Text = "5" Then

Username.Enabled = False
Password.Enabled = False
MsgBox("Pleas wait 15 minutes. You have tried to Log-In to much times." + vbTwoLine + "This is NGU protocal. Sorry.", MsgBoxStyle.Exclamation, Title:="Error - 15 minutes Error. ")

Else

LogInWebBrowser.Document.GetElementById("vb_login_username").SetAttribute("value", Username.Text)
LogInWebBrowser.Document.GetElementById("vb_login_password").SetAttribute("value", Password.Text)
LogInWebBrowser.Document.GetElementById("cookieuser").InvokeMember("click")

Dim allelements As HtmlElementCollection = LogInWebBrowser.Document.All
For Each webpageelement As HtmlElement In allelements

If webpageelement.GetAttribute("value") = "Log in" Then
webpageelement.InvokeMember("click")
End If

Next

LoadingTimer.Start()
LogInButton.Enabled = False

End If
End Sub
End Class


What you will need:


This is what will occur in specific situations:


Here is the coding if you want one just for your site:

    Public Class LogInSystem

' ----------------------------------------------------
' | Website Log-In System |
' | By: IVThaKiller |
' ----------------------------------------------------

Dim SiteIP As String = "" ' Your site IP.
Dim SiteURL As String = "" ' Your site.
Dim SiteName As String = "" ' Your site name.

Dim UsernameLogInID As String = "vb_login_username" ' Your site username login ID. The one inputed is vBulletin default.
Dim PasswordLogInID As String = "vb_login_password" ' Your site password login ID. The one inputed is vBulletin default.
Dim CookieLogID As String = "cookieuser" ' Your site 'Save Password' login ID. The one inputed is vBulletin default.
Dim LogInValue As String = "Log in" ' Your site 'Log In' button value. The one inputed is vBulletin default.

Dim AttemptNumber As String = "5" ' Your site attempt times. 5 is usually default. Do NOT leave this blank.

Dim vbTwoLine As String = vbNewLine + vbNewLine

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

If My.Computer.Network.Ping(SiteIP) = True Then

Me.Enabled = False
Me.Text = "Loading..."

LogInWebBrowser.Navigate(SiteURL)
LogInWebBrowser.ScriptErrorsSuppressed = True

LoadingTimer.Interval = "1000"
Loading.Interval = "5000"
Loading.Start()

ElseIf My.Computer.Network.Ping(SiteIP) = False Then

MsgBox("Error communicating with NGU servers! These could be few of the reasons:" + vbTwoLine + " - Your internet is down." + vbNewLine + " - " + SiteName + " servers are down." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try again.", MsgBoxStyle.Critical, Title:="Error - Communication Error")
End

End If


End Sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LogInButton.Click
LogInButtonForm()
End Sub

Private Sub LoadingTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadingTimer.Tick

If LogInWebBrowser.Document.GetElementById(UsernameLogInID) Is Nothing Then

Else

LoadingTimer.Stop()
MsgBox("Error login! These could be few of the reasons:" + vbTwoLine + " - Error log-in." + vbNewLine + " - Internet error." + vbNewLine + " - Unknown error." + vbTwoLine + "Feel free to try it again.", MsgBoxStyle.Critical, Title:="Error - Log In Error")
LogInButton.Enabled = True

End If

Me.Text = SiteName + " LogIn System"

End Sub

Private Sub Loading_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Loading.Tick


If LogInWebBrowser.Document.GetElementById(UsernameLogInID) Is Nothing Then ' -------------- If you are all ready log-in, what the program will do.

MsgBox("You are all ready log-in.", MsgBoxStyle.Information, Title:="Error - All ready log-in.")
Me.Enabled = False
End

Else
Me.Enabled = True
End If

Loading.Stop()

End Sub

Private Sub Username_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Username.Enter
LogInButtonForm()
End Sub

Private Sub Password_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Password.Enter
LogInButtonForm()
End Sub

Public Sub LogInButtonForm()
LogInLabel.Text = LogInLabel.Text + 1

If LogInLabel.Text = AttemptNumber Then

Username.Enabled = False
Password.Enabled = False
MsgBox("Pleas wait " + AttemptNumber + " minutes. You have tried to Log-In to much times." + vbTwoLine + "This is " + SiteName + " protocal. Sorry.", MsgBoxStyle.Exclamation, Title:="Error - 15 minutes Error. ")

Else

LogInWebBrowser.Document.GetElementById(UsernameLogInID).SetAttribute("value", Username.Text)
LogInWebBrowser.Document.GetElementById(PasswordLogInID).SetAttribute("value", Password.Text)
LogInWebBrowser.Document.GetElementById(CookieLogID).InvokeMember("click")

Dim allelements As HtmlElementCollection = LogInWebBrowser.Document.All
For Each webpageelement As HtmlElement In allelements

If webpageelement.GetAttribute("value") = LogInValue Then
webpageelement.InvokeMember("click")
End If

Next

LoadingTimer.Start()
LogInButton.Enabled = False

End If
End Sub
End Class


seen it before in c# thanks for taking time to post iv :carling:

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo