Go Back   Gaming Gutter > Non-Gaming > Programming > Tutorials


Tutorials - Looking for programming tutorials to increase your knowledge? Do so here.

» Site Navigation
» Home
» FAQ
» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Advertisement
» Recent Threads
Go to first new post Ruzzykinz.
Today 06:14 PM
Last post by Vaginal-Milkshake
Today 06:29 PM
20 Replies, 67 Views
Go to first new post Lenny Conundrum
02-09-2007 11:09 AM
by Noodle
Last post by G.I.R.
Today 06:23 PM
740 Replies, 34,723 Views
Go to first new post Whats your favorite...
08-06-2008 08:59 PM
Last post by Mirage
Today 06:18 PM
109 Replies, 841 Views
Go to first new post I feel like shit.
Yesterday 10:49 PM
Last post by Zombii
Today 06:18 PM
28 Replies, 166 Views
Go to first new post Anglo-Saxon Riddles
Today 05:53 PM
by Fewmitz
Last post by Fewmitz
Today 06:16 PM
2 Replies, 14 Views
Reply
 
LinkBack Thread Tools Display Modes

 [VB.NET] Gaia Login with WINSOCK
Old 08-08-2008, 09:13 AM   #1 (permalink)

Male |G3| is online now

 
Join Date: Feb 2007
Posts: 3,846
GPoints: 7,815
iTrader: 9 / 100%
|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo
Rep Power: 21
Cool [VB.NET] Gaia Login with WINSOCK

I will teach you how to make a gaia online login using VB.NET. I currently have VB2008 installed so that is what I will use for this tut. If you have VB2005 or 2003 then some of the directions might be different.
Ok, firstly download this wrapper and just leave it for now.
Open VB, then go to File -> New Project. Select Windows Forms Application and name it whatever you want, I'll name mine GaiaLoginExamp.


Now a form should appear and on the left side you should see a box called 'Toolbox'. Select textbox and make two. Under them make one button.


Now you have to name the stuff. Name the first textbox username. Name the second textbox password. And name the button Login, also if you want you can change the text for the button to something like Login.

Double click on the button and code should appear.


Save everything and if you are using VB2008 a box should appear. Remember the location, copy it and go to the folder. And of course click save.

If you're in the folder right now then get the wrapper and unzip it in the folder called GaiaLoginExamp or whatever you named your project as.


Go back to visual studio and go to Project -> Add Reference. Click browse and you should see 5 .dlls. Select them all and click Ok.


Now we need to include the wrapper files, go to Project -> Add Existing Item.. You need to select 5 files and they are; Sleepmodule.vb, Stuff.vb, wrapper.designer.vb, wrapper.resx, wrapper.vb. When you selected these click add. We have setup the wrapper, now we just need to declare it and write the code.


Under "Public Class Form1" write this; Public Wrapper As HTTPWrapper = New HTTPWrapper
This declares that 'wrapper' is using the class HTTPWrapper. So now we can use the wrapper fully.


Now we can write the code for the login because we set up the wrapper. Under 'Private Sub Login_Click', paste this code
Code:
'This declares the strHTML as a string
        Dim strHTML As String

        'This if statement check if the username textbox OR the password textbox is Null(empty) 
        'IF it is then it shows a message box saying that the textbox is empty then it exits the login with 'Exit Sub'
        If username.Text = vbNullString Or password.Text = vbNullString Then
            MessageBox.Show("You left the username or/and password field blank." & vbNewLine & "Try again..")
            Exit Sub
        End If

        'this disables the two textboxes and the button so the user can't change them or click the button again.
        username.Enabled = False
        password.Enabled = False
        Login.Enabled = False

        'Now if no textboxes are Null then the program POSTs to Gaia with the username and password
        'when the wrapper posts the string strHTML will have the source of the page after the post
        strHTML = Wrapper.PostWrapper("login.gaiaonline.com/gaia/login.php", "username=" & username.Text & "&password=" & password.Text & "&frob=&token=&redirect=http%3A%2F%2Fwww.gaiaonline.com%2F&chap=", "http://gaiaonline.com")

        'This if statement looks at the strHTML string and checks IF strHTML contains the string "Location: http://www.gaiaonline.com/?login_success=1"
        'If it does contain that string that means that the login worked and the user has logged in
        'BUT if it doesn't contain that string then it means that the login failed so the user will have to try again. 
        If strHTML.Contains("Location: http://www.gaiaonline.com/?login_success=1") Then
            MessageBox.Show("Logged in!!")
        Else
            MessageBox.Show("Login Failed")
            'And we re enable the textboxes and buttons so the user can login again
            username.Enabled = True
            password.Enabled = True
            Login.Enabled = True
        End If
It has comments on everything so you can understand everything. This is how it should look now:


Save everything and now we can tryout the login. Go to Debug -> Start Debugging
Your form should appear, now enter a gaia online username and password if everything is setup right you should get this:


If it worked then congratulations! You have created a VB.NET gaia login


Credits
Kane - for the wrapper.
__________________

Last edited by |G3|; 08-08-2008 at 09:23 AM..
  Reply With Quote

 
Old 08-08-2008, 09:43 AM   #2 (permalink)
Cogito, ergo sum.

Male Checker is online now
 
Checker's Avatar
 
Join Date: Feb 2008
Posts: 1,888
GPoints: 1,782
iTrader: 7 / 100%
Checker Is a Lord of AwesomenessChecker Is a Lord of AwesomenessChecker Is a Lord of AwesomenessChecker Is a Lord of Awesomeness
Rep Power: 9
Good job explaining it.
+Rep
__________________


Neutral Evil
  Reply With Quote

 
Old 08-08-2008, 01:17 PM   #3 (permalink)
Banned

Male zennext is offline
 
Join Date: Mar 2007
Location: USA
Age: 15
Posts: 324
GPoints: 127
iTrader: 2 / 100%
zennext Is Recognizable
Rep Power: 0
Very nice guide. Good wrapper too.
  Reply With Quote

 
Old 08-19-2008, 04:06 PM   #4 (permalink)
Full Member

ArcticChibi is offline
 
Join Date: Jun 2008
Posts: 16
GPoints: 22
iTrader: 0 / 0%
ArcticChibi Is gaining popularity
Rep Power: 0
How come I get this error?

Quote:
An error occurred creating the form. See Exception.InnerException for details. The error is: Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG))
  Reply With Quote

 
Old 08-22-2008, 10:20 AM   #5 (permalink)

Male |G3| is online now

 
Join Date: Feb 2007
Posts: 3,846
GPoints: 7,815
iTrader: 9 / 100%
|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo
Rep Power: 21
Quote:
Originally Posted by ArcticChibi View Post
How come I get this error?
I'm thinking you linked something wrong, try again.
__________________
  Reply With Quote

 Nice...
Old 11-09-2008, 05:14 PM   #6 (permalink)
TBP
Full Member

Male TBP is offline
 
Join Date: Nov 2008
Posts: 23
GPoints: 444
iTrader: 0 / 0%
TBP Is gaining popularity
Rep Power: 0
Nice...

This really helped me out.

Thanks alot |G3|.

Logins Away!

Hey |G3|,

Keep getting login failed with neopets.

See if your wiseness can save me humble self.

Code:
Public Class Form1
    Public Wrapper As HTTPWrapper = New HTTPWrapper
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strHTML As String

        If TextBox1.Text = vbNullString Or TextBox2.Text = vbNullString Then
            MessageBox.Show("You left the username or/and password field blank." & vbNewLine & "Try again..")
            Exit Sub
        End If

        strHTML = Wrapper.PostWrapper("neopets.com/login.phtml?", "username=" & TextBox1.Text & "&password=" & TextBox2.Text & "destination=/index.phtml", "http://neopets.com")

        If strHTML.Contains("Location: http://www.neopets.com/index.phtml") Then
            MessageBox.Show("Logged in!!")
        Else
            MessageBox.Show("Login Failed")
            TextBox1.Enabled = True
            TextBox2.Enabled = True
            Button1.Enabled = True
        End If
    End Sub
End Class

Last edited by TBP; 11-09-2008 at 05:14 PM.. Reason: Automerged Doublepost
  Reply With Quote

 
Old 11-09-2008, 05:29 PM   #7 (permalink)

Male |G3| is online now

 
Join Date: Feb 2007
Posts: 3,846
GPoints: 7,815
iTrader: 9 / 100%
|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo|G3| Is a Subordinate to Kyo
Rep Power: 21
All your URLs were wrong...
Code:
Public Class Form1

    Public Wrapper As HTTPWrapper = New HTTPWrapper
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strHTML As String

        If TextBox1.Text = vbNullString Or TextBox2.Text = vbNullString Then
            MessageBox.Show("You left the username or/and password field blank." & vbNewLine & "Try again..")
            Exit Sub
        End If

        strHTML = Wrapper.PostWrapper("www.neopets.com/login.phtml", "destination=%2Findex.phtml&username=" & TextBox1.Text & "&password=" & TextBox2.Text & "&x=&y=", "http://www.neopets.com/hi.phtml")
        TextBox3.Text = strHTML
        If strHTML.Contains("Location: /index.phtml") Then
            MessageBox.Show("Logged in!!")
        Else
            MessageBox.Show("Login Failed")
            TextBox1.Enabled = True
            TextBox2.Enabled = True
            Button1.Enabled = True
        End If
    End Sub

End Class
__________________
  Reply With Quote

 
Old 11-09-2008, 06:56 PM   #8 (permalink)
TBP
Full Member

Male TBP is offline
 
Join Date: Nov 2008
Posts: 23
GPoints: 444
iTrader: 0 / 0%
TBP Is gaining popularity
Rep Power: 0
Thanks alot,

Your amazing.
  Reply With Quote
Reply

Bookmarks



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Powered by vBadvanced CMPS v3.0 RC2

All times are GMT -7. The time now is 06:30 PM.


vBulletin skin developed by: eXtremepixels
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The contents of this webpage are copyright © 2006-2008 GamingGutter.com. All Rights Reserved.

Page generated in 0.13892698 seconds (100.00% PHP - 0% MySQL) with 19 queries