Since everything is so dead, here's my Gaia login.
Code:#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <URLEncode.au3>;Can be found at: http://pastebin.com/W7NQJR1A Global $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") Global $hForm1, $hInput1, $hInput2, $hButton1, $nMsg $hForm1 = GUICreate('Gaia Online Login', 200, 100, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION), $WS_EX_CLIENTEDGE) GUISetBkColor(0x000000) $hInput1 = GUICtrlCreateInput("Username", 40, 15, 120, 20, BitOR($ES_CENTER, $ES_AUTOHSCROLL)) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) $hInput2 = GUICtrlCreateInput("Password", 40, 40, 120, 20, BitOR($ES_CENTER, $ES_PASSWORD, $ES_AUTOHSCROLL)) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) $hButton1 = GUICtrlCreateButton('Login', 60, 65, 80, 20, BitOR($BS_CENTER, $BS_VCENTER, $WS_GROUP)) GUICtrlSetBkColor(-1, 0x000000) GUICtrlSetColor(-1, 0xFFFFFF) GUISetState() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hButton1 $fReturn = _GaiaLogin(GUICtrlRead($hInput1), GUICtrlRead($hInput2)) If $fReturn = True Then ExitLoop If Not $fReturn Then MsgBox(0, 'Login Failed', 'You have entered invalid login info.') Case $hInput2 $fReturn = _GaiaLogin(GUICtrlRead($hInput1), GUICtrlRead($hInput2)) If $fReturn = True Then ExitLoop If Not $fReturn Then MsgBox(0, 'Login Failed', 'You have entered invalid login info.') EndSwitch WEnd Func _GaiaLogin($sUser, $sPass) Local $sToken $oHTTP.Open("GET", "http://www.gaiaonline.com/", False) $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5") $oHTTP.Send() $sToken = _StrBetween($oHTTP.ResponseText, '<input type="hidden" name="token" value="', '" />') $oHTTP.Open("POST", "http://www.gaiaonline.com/auth/login", False) $oHTTP.SetRequestHeader("User-Agent", "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5") $oHTTP.SetRequestHeader("Referer", "http://gaiaonline.com/") $oHTTP.SetRequestHeader("Content-Type", "application/x-www-form-urlencoded") $oHTTP.Send("username=" & _UrlEncode($sUser) & "&password=" & _UrlEncode($sPass) & "&token=" & $sToken & "&sid=&redirect=http%3A%2F%2Fwww.gaiaonline.com%2F&signInButton=") If StringInStr($oHTTP.ResponseText, "logout") Then Return True If Not StringInStr($oHTTP.ResponseText, "logout") Then Return False EndFunc ;==>_GaiaLogin Func _StrBetween($sArg_01, $sArg_02, $sArg_03);Not made by me; Modified by me because of my OCD Local $sStr_X, $sStr_Y $sStr_X = StringInStr($sArg_01, $sArg_02) + StringLen($sArg_02) $sStr_Y = StringInStr(StringTrimLeft($sArg_01, $sStr_X), $sArg_03) Return StringMid($sArg_01, $sStr_X, $sStr_Y) EndFunc ;==>_StrBetween
Also. As you can tell from this program, chap is not necessary. The username and password can both be passed in plain text.
Results 1 to 1 of 1
Thread: AutoIt- Gaia Login
- 24 May. 2010 03:39am #1
AutoIt- Gaia Login
Last edited by Personoid; 27 May. 2010 at 06:12am.