#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <WinHttp_GetRespond.au3>
#include <array.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#Region ### START Koda GUI section ### Form=
$NEW_STYLE=BitOR($WS_MINIMIZEBOX,$WS_CAPTION,$WS_POPUP,$WS_SYSMENU,$WS_EX_TRANSPARENT) ;透明效果
$Form1 = GUICreate("Form1", 337, 201,-1, -1) ;透明效果
$Input1 = GUICtrlCreateInput("", 24, 24, 121, 21)
$Input2 = GUICtrlCreateInput("", 24, 64, 121, 21)
$Input3 = GUICtrlCreateInput("", 24, 96, 121, 21)
$Pic1 = GUICtrlCreatePic("", 168, 80, 86, 28)
$Button1 = GUICtrlCreateButton("重新获取", 184, 128, 75, 25)
$Button2 = GUICtrlCreateButton("登录", 24, 128, 75, 25)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
#cs
注册ANIGIF控件
#ce
FileCopy(@ScriptDir & '\AniGIF.ocx',@SystemDir & "", 1)
RunWait('REGSVR32 /S ' & @SystemDir & "\AniGIF.ocx")
;解除注册
;~ RunWait('REGSVR32 /U /S ' & @SystemDir & "\AniGIF.ocx")
_WinAPI_SetLayeredWindowAttributes ($Form1,0x010101,190) ;透明效果
$Obj_gif = ObjCreate("AniGIFCtrl.AniGIF") ;创建AniGIF对象
$id_ctrl_gif = GUICtrlCreateObj($Obj_gif, 176, 8, 700,460)
Global $seccode_update,$idhash,$loginhash,$formhash,$header_cookie
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;$idhash
$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP = ObjCreate("MSXML2.XMLHTTP")
$oHTTP.Open("GET","http://www.macx.cn/member.php?mod=logging&action=login&infloat=yes&handlekey=login&inajax=1&ajaxtarget=fwin_content_login",false)
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
$oHTTP.setRequestHeader("Connection", "Keep-Alive")
$oHTTP.setRequestHeader("Referer", "http://www.macx.cn/")
$oHTTP.Send()
$data=$oHTTP.responseText
$header=$oHTTP.GetAllResponseHeaders
$header_cookie = StringRegExp($header, "MacX_4.*?;", 3)
_ArrayDisplay($header_cookie)
$idhash="SA"&StringMid ($header_cookie[1],15,6)&"0"
$loginhash_start=StringInStr ($data,"main_messaqge",0,1,1)
$loginhash=StringMid ($data,$loginhash_start+14,5)
$formhash_start=StringInStr ($data,"formhash",0,1,1)
$formhash=StringMid ($data,$formhash_start+17,8)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;$seccode_update
$oHTTP.Open("GET","http://www.macx.cn/misc.php?mod=seccode&action=update&idhash="&$idhash&"&inajax=1&ajaxtarget=seccode_"&$idhash,false)
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
$oHTTP.setRequestHeader("Connection", "Keep-Alive")
$oHTTP.setRequestHeader("Referer", "http://www.macx.cn/")
$oHTTP.Send()
$data=$oHTTP.responseText
$seccode_update_start=StringInStr ($data,"seccode&update",0,1,1)
$seccode_update=StringMid ($data,$seccode_update_start+15,5)
_Get_Code()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button1
_Get_Code()
Case $Button2
_Login()
EndSwitch
WEnd
Func _Get_Code()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;get验证图
$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("GET","http://www.macx.cn/misc.php?mod=seccode&update="&$seccode_update&"&idhash="&$idhash,false)
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
$oHTTP.setRequestHeader("Connection", "Keep-Alive")
$oHTTP.setRequestHeader("Referer", "http://www.macx.cn/")
$oHTTP.setRequestHeader("Cookie", "PHPSESSID=fk36bki5k1iukulup0gi0ca1mrfkmsui")
$oHTTP.Send()
$alldata=$oHTTP.ResponseBody
If @error Then Return MsgBox(0,@error,"出错了")
$CodeFile = FileOpen(@ScriptDir & "\code.gif",10)
FileWrite($CodeFile,Binary($alldata))
FileClose($CodeFile)
GUICtrlSetImage($Pic1,@ScriptDir & "\code.gif")
$Obj_gif.ReadGIF(@ScriptDir & "\code.gif") ;gif动画path。全路径,相对路径均可
;~ $Obj_gif.Transparent=True ;透明设置,好像没JBD用
$Obj_gif.Speed=1 ;播放速度。1-正常;数字增大速度变慢;
$Obj_gif.Play ;播放
RunWait('REGSVR32 /U /S ' & @SystemDir & "\AniGIF.ocx")
EndFunc
Func _Login()
$post_url="http://www.macx.cn/member.php?mod=logging&action=login&loginsubmit=yes&handlekey=login&loginhash="&$loginhash&"&inajax=1"
$post_data="formhash="&$formhash&"&referer=http%3A%2F%2Fwww.macx.cn%2F&username="&GUICtrlRead($Input1)&"&password="&GUICtrlRead($Input2)&"&questionid=0&answer=&sechash="&$idhash&"&seccodeverify="&GUICtrlRead($Input3)
$oHTTP = ObjCreate("WinHttp.WinHttpRequest.5.1")
$oHTTP.Open("POST",$post_url,false)
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
$oHTTP.setRequestHeader("Cache-Control", "no-cache")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
$oHTTP.setRequestHeader("Referer","http://www.macx.cn/")
$oHTTP.setRequestHeader("Cookie", "PHPSESSID=fk36bki5k1iukulup0gi0ca1mrfkmsui")
$oHTTP.setRequestHeader("User-Agent","Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)")
$oHTTP.Send($post_data);post关键数据
$data=$oHTTP.responseText
$header=$oHTTP.GetAllResponseHeaders
MsgBox(0,0,$data)
EndFunc