In my new program I have this feature.
It is basically just this
Code:
Sub Login_to_neopets()
StopProgram = False
cmdlogin.Enabled = False
strHTML = w.PostWrapper("http://www.neopets.com/login.phtml", "username=" & txtusername.Text & "&password=" & txtpassword.Text & "&destination=%2Findex.phtml", "http://www.neopets.com/hi.phtml")
If InStrB(1, strHTML, "badpassword") Then
lblstatus.Caption = "Wrong password!"
cmdlogin.Enabled = True
ElseIf InStrB(1, strHTML, "FROZEN") Then
lblstatus.Caption = "Account frozen!"
cmdlogin.Enabled = True
ElseIf InStrB(1, strHTML, "too many times") Then
lblstatus.Caption = "Guessed password too many times!"
cmdlogin.Enabled = True
ElseIf InStrB(1, strHTML, txtusername.Text) Then
txtlog.Text = txtlog.Text & vbNewLine & Time & " : Relogged in as " & txtusername.Text
cmdstart.Enabled = True
cmdstart_Click
lblstatus.Caption = "Logged in as " & txtusername.Text
cmdlogin.Enabled = False
Call SaveSetting("Violent_J's neopets login", "Login", "Username", txtusername.Text)
Call SaveSetting("Violent_J's neopets login", "Login", "Password", txtpassword.Text)
End If
End Sub
If InStrB(1, strHTML, "<a href=" & ChrW$(34) & "/loginpage.phtml" & ChrW$(34) & "><b>Login to Neopets!</b></a>") And chklogin.Value = Checked Then
txtlog.Text = txtlog & vbNewLine & Time & " : Logged out of " & txtusername.Text & ", logging back in!"
cmdstop_Click
cmdstop.Enabled = False
cmdstart.Enabled = False
lblstatus.Caption = "Idle.."
cmdlogin.Enabled = True
Login_to_neopets In this program, I used a text box as a log so you may have to edit this for a listbox.
I made the "automatically log in when logged out" a feature called "chklogin"
You may edit this if you like to fit your code etc.
This is just the basic gist of it as I am sure there is a more "proper and efficient" way of doing it.