» Site Navigation | | | » Advertisement | | | » Recent Threads | | | IMMA CRY Yesterday 09:07 PM Today 01:20 AM 6 Replies, 71 Views | | | | | | | |  |  | [vb6] Having your program auto log back in |  |
08-11-2008, 01:16 PM
|
#1 (permalink)
| Full Member
Join Date: Nov 2006 Location: Sacramento, California Age: 18 Posts: 1,057
GPoints: 5,450 Rep Power: 14 | [vb6] Having your program auto log back in 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. | |
| |  |
01-05-2009, 09:21 AM
|
#2 (permalink)
| Full Member
Join Date: Jan 2009 Location: Somewhere, who knos maybe I'm behind you o.O Posts: 121
GPoints: 1,729 Rep Power: 4 | looks good, but how do I make it auto log back in for gaia?
srry bearly learning programin =P | |
| |  | |  |
01-05-2009, 09:27 AM
|
#3 (permalink)
| Full Member
Join Date: Dec 2008 Location: Maryland Age: 21 Posts: 911
GPoints: 12,316 Rep Power: 8 | Please don't get angry, I'm just posting how I do it for comparision purposes. Code: Private Type LoginInformation
Username As String
Password As String
End Type
Dim User As LoginInformation
Private Sub cmdLogin_Click()
If Login(txtUsername.Text, txtPassword.Text) Then
SaveSetting "AutoTrainer", "Login", "Username", txtUsername
SaveSetting "AutoTrainer", "Login", "Password", txtPassword
User.Username = txtUsername.Text
User.Password = txtPassword.Text
End If
End Sub
Public Function IsLoggedIn(ByVal strHtml) As Boolean
IsLoggedIn = False
Status.SimpleText = "Status: Determining if Logged In!"
If InStr(1, strHtml, "<b>Login to Neopets!</b>") = 0 Then IsLoggedIn = True
End Function
''''''''''Main Sub Code'''''''''''''''''''''''
If Not IsLoggedIn(DPage) Then
If Login(User.Username, User.Password) = False Then
Status.SimpleText = "Status: Failed to relogon!"
Status2.SimpleText = "Status: Currently Training []"
bolStop = True
Exit Sub
End If
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Btw, I like how you save your settings. Makes it more programming dependent. Neat idea! | |
| |  |  | |  |
01-05-2009, 09:37 AM
|
#4 (permalink)
| Full Member
Join Date: Jan 2009 Location: Somewhere, who knos maybe I'm behind you o.O Posts: 121
GPoints: 1,729 Rep Power: 4 | Quote:
Originally Posted by iceydefeat Please don't get angry, I'm just posting how I do it for comparision purposes. Code: Private Type LoginInformation
Username As String
Password As String
End Type
Dim User As LoginInformation
Private Sub cmdLogin_Click()
If Login(txtUsername.Text, txtPassword.Text) Then
SaveSetting "AutoTrainer", "Login", "Username", txtUsername
SaveSetting "AutoTrainer", "Login", "Password", txtPassword
User.Username = txtUsername.Text
User.Password = txtPassword.Text
End If
End Sub
Public Function IsLoggedIn(ByVal strHtml) As Boolean
IsLoggedIn = False
Status.SimpleText = "Status: Determining if Logged In!"
If InStr(1, strHtml, "<b>Login to Neopets!</b>") = 0 Then IsLoggedIn = True
End Function
''''''''''Main Sub Code'''''''''''''''''''''''
If Not IsLoggedIn(DPage) Then
If Login(User.Username, User.Password) = False Then
Status.SimpleText = "Status: Failed to relogon!"
Status2.SimpleText = "Status: Currently Training []"
bolStop = True
Exit Sub
End If
End If
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' Btw, I like how you save your settings. Makes it more programming dependent. Neat idea! | So I just change a few things to this and I can make it login to gaia?
also like ur pic, I saw that family guy episode lol | |
| |  |
01-05-2009, 09:39 AM
|
#5 (permalink)
| Full Member
Join Date: Dec 2008 Location: Maryland Age: 21 Posts: 911
GPoints: 12,316 Rep Power: 8 | hmmm. Ya, but it would be a complete change, as with Violent's. I don't know gaia well enough  | |
| |
01-05-2009, 09:40 AM
|
#6 (permalink)
| I don't never troll
Join Date: Jun 2009 Location: live? wut. Posts: 6,919
GPoints: 16,936 Rep Power: 30 | Quote:
Originally Posted by james310 So I just change a few things to this and I can make it login to gaia?
also like ur pic, I saw that family guy episode lol | Like using brain? [VB6] How to make a Gaia Login | |
| |
01-05-2009, 09:42 AM
|
#7 (permalink)
| Full Member
Join Date: Dec 2008 Location: Maryland Age: 21 Posts: 911
GPoints: 12,316 Rep Power: 8 | oooo. Nice tut G3  | |
| |
01-05-2009, 09:48 AM
|
#8 (permalink)
| Full Member
Join Date: Jan 2009 Location: Somewhere, who knos maybe I'm behind you o.O Posts: 121
GPoints: 1,729 Rep Power: 4 | I was acutally wondering something else but thx G3 the tut is really good, it'll be the first program I make =) | |
| |  | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | | | | Thread Tools | | | | Display Modes | Linear Mode |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | |