A preserved archive of the Logical Gamers community forums, 2009-2025. The original threads and posts, served read-only. Registration, posting and private messages are gone for good.

[C#] GaiaOnline login (4/2/2013)

1.4k views · started by Stapled ·
#1
[C#] GaiaOnline login (4/2/2013)
        public static Boolean GaiaLogin(string username,string password)
{
string pd = StringExtensions.gsb((wrapper.get("http://www.gaiaonline.com/")), "</fieldset>", "</form>").Replace("data-value", "").Replace("<a name", "").Replace("value=\"value", "");
List<string> n = StringExtensions.gasb(pd, "name=\"", "\"");
List<string> v = StringExtensions.gasb(pd, "value=\"", "\"");
string postdata = n[0] + "=" + v[0]
+ "&" + n[1] + "=" + v[1]
+ "&" + n[2] + "=" + v[2]
+ "&" + n[3] + "=" + v[3]
+ "&" + "username=" + username + "&password=" + password;
string login = wrapper.post("http://www.gaiaonline.com/auth/login/", postdata);
login = wrapper.get("http://www.gaiaonline.com/");
return login.Contains("Welcome back");
}[/3][/3][/2][/2][/1][/1][/0][/0]


The C# wrapper and StringExtension.cs and be found here http://forum.logicalgamers.com/programming/44584-c-httpinterface-class-perfected-wrappers-proxy-support-simple-structure.html
#2
Looks nice.

Good work.
#3
It looks good, though at the end you should just be able to go:

return login.Contains("Welcome back")
#4
Artificial wrote:
It looks good, though at the end you should just be able to go:

return login.Contains("Welcome back")


That does work, thanks.
#5
I don't know C#, so forgive my potential ignorance, but is the ToString method necessary for all the v[#]? I'm assuming gasb() is string between, which I imagine returns a string to begin with, so no use that method, which would make the code a lot more readable. And blahblahblah microoptimization.[/#]
#6
I don't know C#, so forgive my potential ignorance, but is the ToString method necessary for all the v[#]? I'm assuming gasb() is string between, which I imagine returns a string to begin with, so no use that method, which would make the code a lot more readable. And blahblahblah microoptimization.[/#]


This was my first time using lists instead of arrays so I wasn't sure if it was needed. Turns out it's not.
#7
Dang, that's nice. I wish I could find an easy way to search for field names and values like that, but in Java lol.
#8
Dang, that's nice. I wish I could find an easy way to search for field names and values like that, but in Java lol.


You can! Just port the code over to Java.
#9
Artificial wrote:
You can! Just port the code over to Java.


I wish I was skilled enough to, haha.
#10
I wish I was skilled enough to, haha.


Ask someone to
#11
Ask someone to


I would, but I would also love to figure out on my own, but I don't see that happening. If someone could do it for me, I would be insanely grateful, because it would also allow me to learn from their code, and get to coding bots even faster haha.
#12
Put into Vb.net:
 Public Shared Function GaiaLogin(username As String, password As String) As [boolean]
Dim pd As String = StringExtensions.gsb((wrapper.[get]("http://www.gaiaonline.com/")), "</fieldset>", "</form>").Replace("data-value", "")
Dim n As List(Of String) = StringExtensions.gasb(pd, "name=""", """")
Dim v As List(Of String) = StringExtensions.gasb(pd, "value=""", """")
Dim postdata As String = ((((((n(0) + "=" + v(0) & "&") + n(1) & "=") + v(1) & "&") + n(2) & "=") + v(2) & "&") + n(3) & "=") + v(3) & "&" & "username=" & username & "&password=" & password
Dim login As String = wrapper.post("http://www.gaiaonline.com/auth/login/", postdata)
login = wrapper.[get]("http://www.gaiaonline.com/")
Return login.Contains("Welcome back")
End Function [/get][/get][/boolean]
#13
lol VB. Stapled also already has one in VB btw.
#14
lol VB. Stapled also already has one in VB btw.


He have the wrappers with it? If so link please? Was just trying to contribute.
#15
You guys might want to post these to Guides or Public Programs. Just throwing that out there. If there is any of this you don't want the public accessing, now that guides/progs has the 10 post/3 day requirement.
#16
Oh so you just took out the part that they keep changing and made it so it would grab the changed part every time? Clever! And thanks now I can finish updating some older bots!