|
|
|
|
![]() ![]() |
Dec 11 2007, 12:53 PM
Post
#1
|
|
|
Member [Level 2] ![]() ![]() ![]() ![]() ![]() Group: Members Posts: 76 Joined: 21-November 07 Member No.: 53,412 |
This tutorial will teach you how to login in gaiaonline through vb.net.
I'll do it with a way that you don't need to leave vb.net to get/post (bad joke) anything. What you need in this tutorial is:
Now let's start Open the VS.NET and create a new project: You now have something, that is called a form, let's rename it to GaiaLogin Easy, let's take a look at the form What?? Form1? But i renamed it... Ok, if you really said that just close this window right now. That's the title of the form, let's rename it
Ok, now we are talking. Let's insert 1 textbox on the form (see example for details) Yes, simple as drag and drop, but i want this textbox to be multiline and to have a vertival scroll. (easier to see what you'll get from teh website) So, the way that i'm going to do this is to select the textbox and go to properties (like we did to change the form1 title to GaiaOnline) and select "multiline -> true" and "Scroolbars -> Both" (yes, i changed my mind) Now just resize the textbox, mine is like this: ok, all set. Did you extract the Resources.rar? Let's use it.
Let's move then. Go back to your project. Let's add the references Ok, it was easy. Now we need to insert them on the project. You should have a tab that says "Object Browser", if you don't have it press "F2" Ok, as shown in the picture, you select the Object to insert and click on the small button that is focused in the image. Do this to AxInterop.* and Interop.* Now let's add the modules to the project, select the gaionline project and follow the pictures. Press add and let's move to the code (press 2 times on the form): you should see this Now, let's make some changes to the code: After CODE Public Class GaiaLogin Add CODE Dim wrap As New HTTPWrapper like this Ok, we are ready to go. Let's see what gaia online has for us after this CODE Private Sub GaiaLogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load add CODE TextBox1.Text = wrap.GetWrapper("http://gaiaonline.com") and press F5 What did you got? Your first error The reason for that is that you shouldn't trust me as much as you think, you'll get some errors during this tutorials (come on, it's part of the job) Note, you need to stop the script before continue (to do this you have a play and a stop button in a bar, yes press the stop one) To solve this problem let's replace the above code with CODE TextBox1.Text = wrap.GetWrapper("http://gaiaonline.com/") That's it, the slash So, now press F5 Wow, what is that? Yes, it's a little bit confusing, but it's easier to get what we want. Let's take a look to the code in that textbox. Done? What i found interesting was this: CODE <form method="post" id="loginForm" action="http://login.gaiaonline.com/gaia/login.php"> <fieldset> <label for="username">Username:</label><input type="text" id="username" name="username" tabindex="1" /> </fieldset> <fieldset> <label for="password">Password:</label><input type="password" id="password" name="password" tabindex="2" /> </fieldset> let's give it a try Close the window. In the code replace CODE TextBox1.Text = wrap.GetWrapper("http://gaiaonline.com/") with CODE TextBox1.Text = wrap.PostWrapper("http://login.gaiaonline.com/gaia/login.php", "username=Zer0&password=mypassword") 'please replace with your data and run the script again (F5) hmm, interesting. It's shorter CODE HTTP/1.0 302 Found Date: Tue, 11 Dec 2007 12:05:44 GMT Server: Apache X-Powered-By: PHP/5.1.5 Set-Cookie: gaia4_ano=13858786241197374744; path=/; domain=.gaiaonline.com Set-Cookie: gaia4_ano=13858786241197374744; path=/; domain=.gaiaonline.com Set-Cookie: gaia4_sid=0057f0c85e611139e4a9cf77d01986f9; path=/; domain=.gaiaonline.com Set-Cookie: gaia4_data=deleted; expires=Mon, 11-Dec-2006 12:05:43 GMT; path=/; domain=login.gaiaonline.com Set-Cookie: gaia4_ano=13858786241197374744; path=/; domain=.gaiaonline.com Set-Cookie: gaia4_sid=f5b0b6d0194b761d7d156ad280cfe74600002f258bec3d11; path=/; domain=.gaiaonline.com Set-Cookie: gaia4_data=a%3A1%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3B%7D; path=/; domain=login.gaiaonline.com Location: http://www.gaiaonline.com/?login_success=1 Content-Length: 0 Vary: Accept-Encoding,User-Agent Connection: close Content-Type: text/html let's see what info the next page will show. after CODE TextBox1.Text = wrap.PostWrapper("http://login.gaiaonline.com/gaia/login.php", "username=Zer0&password=mypassword") 'please replace with your data add CODE TextBox1.Text = wrap.GetWrapper("http://www.gaiaonline.com/?login_success=1") and press F5 again Hmm, bigger again. But look what i found in the code CODE src="http://s.gaiaonline.com/images/gaia_global/gaia_header/ic_shortcuts.gif" alt="Shortcuts"/>Shortcuts</div></li> <li id="messages"><a href="/profile/privmsg.php" class="newMail">(2)</a></li> </ul> I have new mail, interesting, let's see if i can read it through vb (note that i am logged already) so the link to my private messages is? I'll let you answer this one. Let's keep going with the code. I want to read my messages now. after CODE TextBox1.Text = wrap.GetWrapper("http://www.gaiaonline.com/?login_success=1") I'll add CODE TextBox1.Text = wrap.GetWrapper("http://www.gaiaonline.com/profile/privmsg.php") and press F5 again And yes, after a while i found this CODE <img src="http://s.gaiaonline.com/images/template/folder_new.gif" width="19" height="18" alt="New Message" title="New Message" /></td> <td valign="top"><span class="topictitle"><a href="/profile/privmsg.php?folder=inbox&mode=read&id=4537.1478364922" class="topictitle"><strong>You've received a special gift!</strong><br /><span class="gensmall" style="font-weight:normal;"></span></a></span></td> <td valign="top"><span class="name"> <a href="/profile/?view=profile.ShowProfile&item=4537" class="name" style="font-weight:bold;color:#D75252"><strong>[NPC] Rina</strong></a></span></td> <td NOWRAP><span class="postdetails"><strong>Thu Dec 06, 2007 5:36 am</strong></span></td> <td align="center"><input type="checkbox" name="mark[]" value="4537.1478364922" /></td> </tr> <tr> <td colspan="5"><img src="http://s.gaiaonline.com/images/template/s.gif" width="1" height="2"></td> </tr> <tr bgcolor=#FFFFFF> <td valign="top"><img src="http://s.gaiaonline.com/images/template/folder_new.gif" width="19" height="18" alt="New Message" title="New Message" /></td> <td valign="top"><span class="topictitle"><a href="/profile/privmsg.php?folder=inbox&mode=read&id=10566556.1476371945" class="topictitle"><strong>(no subject)</strong><br /><span class="gensmall" style="font-weight:normal;"></span></a></span></td> <td valign="top"><span class="name"> <a href="/profile/?view=profile.ShowProfile&item=10566556" class="name" style="font-weight:bold;color: ##2244A2"><strong>ICAN'T SHOW YOU THIS NAME</strong></a></span></td> Wow, ok, i'm not going to show you that message now that we are logged. I just want to finish this. Let's move to the design again. But first, take a look at the code that is parsed to the html, you should notice that you have one thing different that show us that we are logged. Did you find it? Good, let's move then Remove that stupid textbox1. Create something similar to this Ok, what you should know by now is how to set a name to a textbox or to a button (in the properties), so let's use our capabilities, i named the button as Loggin, the first textbox as username and the second as password. Let's move to the code (press 2 times on the form) Hmm, i forgot, you want to login using the button ( Ok, let's go back to the form, now, instead of clicking 2 times on the form, let's do the same on the button. Good, you should see a new thing on the code CODE Private Sub Login_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Login.Click End Sub haha, let's move it. Add this to the login button CODE Dim strHtml As String strHtml = wrap.PostWrapper("http://login.gaiaonline.com/gaia/login.php", "username=" & username.Text & "&password=" & password.Text) strHtml = wrap.GetWrapper("http://www.gaiaonline.com/?login_success=1") that's it, press F5, insert your data and try now. Easy hein? What? Nothing showed up? Damn, i forgot again, the thing we need to know that we are logged is "Gold:" Let's see. add this code to the button CODE If InStr(strHtml, "Gold") Then MsgBox("You are logged!") Else MsgBox("Loggin failed!") End If Press F5 and insert your data Hehe, cool... OK goo lu... What? You want to know the amount of gold in the account? But that's a new function... OK ok, calm down. It's also easy Let's change the if thing. After the "If instr(strhtml, "Gold") Then" Let's add CODE Dim gold As String = wrap.iB(strHtml, "Gold: </span>", "<") MsgBox("You have " & gold) The iB, is the function in between, if you had look to the code you would see that the amount of gold is between Gold: </span> and <, and that's what we want. Run the program. HEHE, we did it. Now it's done, (donate i'm poor Now good luck at your code.
Attached File(s)
|
|
|
|
![]() ![]() |
Similar Topics
| Topics | Topics | |
|---|---|---|
|
|
|
Lo-Fi Version | Time is now: 6th September 2008 - 05:28 PM |