#Include <File.au3>
#include <array.au3>
#include <IE.au3>
#include <INet.au3>
Dim $CardNo, $Pwd, $TbUsr, $InType, $InNumb, $Verif, $x, $y, $ArrayIn[5],$ArrayVal[3]
$ArrayIn[0] = "易赛"
$ArrayIn[1] = "捷易通"
$ArrayIn[2] = "速度达"
$ArrayIn[3] = "惠联"
$ArrayIn[4] = "第五代"
$ArrayVal[0] = "50元"
$ArrayVal[1] = "100元"
$ArrayVal[2] = "200元"
$file = 'user.txt'
$row = _FileCountLines($file)
For $i = $row To 1 Step -1
$InType = AnsiURLEncode($ArrayIn[Random(0,4,1)])
$InNumb = AnsiURLEncode($ArrayVal[Random(0,2,1)])
$Verif = Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)
$x = Random(6,100,1)
$y = Random(4,25,1)
$CardNo = "tt"&Random(1,2,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)
$Pwd = Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)&Random(0,9,1)
$TbUsr = AnsiURLEncode(FileReadLine($file, $i))
$oHTTP = ObjCreate("microsoft.xmlhttp")
$oHTTP.Open("post","http://ykt.kab80.com/yhb/index.asp?action=sut",false)
$oHTTP.setRequestHeader("Cache-Control", "private")
$oHTTP.setRequestHeader("Accept-Language", "zh-cn")
$oHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
$oHTTP.setRequestHeader("Referer","http://ykt.kab80.com/yhb/")
$oHTTP.Send("CardNo1="&$CardNo&"&CardPassword1="&$Pwd&"&CardNo2=&CardPassword2=&CardNo3=&CardPassword3=&CardNo4=&CardPassword4=&CardNo5=&CardPassword5=&PlayerUserName="&$TbUsr&"&RePlayerUserName="&$TbUsr&"&isautosave=1&e="&$InType&"&TwoAreaName="&$InNumb&"&RndPassword="&$Verif&"&Id=206&x="&$x&"&y="&$y)
;$Log = BinaryToString($oHTTP.responseBody)
;$LogFile = FileOpen("d:\postlog.txt",1)
;FileWrite($LogFile,$Log)
;FileClose($LogFile)
Next
Func AnsiURLEncode($str, $falg = 0)
;转换字符串为ANSI(GB2312)URL编码By afan
;可选参数$falg = 0,不转换字母及数字(默认);$falg = 1,全部转换(字符头http://除外)
Local $str_s = StringRegExpReplace($str, '^(http://).+', '$1') ;StringRegExpReplace ( _"字符串", "表达式", "替换", [ 数量 ] )基于正则表达式的文本替换.
If @extended = 0 Then $str_s = '' ;扩展的函数返回值,使用于一些特定函数.
If @extended > 0 Then $str = StringRegExpReplace($str, '^http://', '')
Local $astr, $i, $s2d, $sS = StringSplit($str, '') ;StringSplit ( "字符串", "分隔符" [, 标志 ] )以指定分隔符把字符串拆分成若干子串.
For $i = 1 To UBound($sS) - 1 ;UBound ( 数组 [, 维度] )返回数组维度的大小.
If StringRegExp($sS[$i], '[^\x00-\xff]') Then
$s2d = StringToBinary($sS[$i] & ' ') ;StringToBinary ( 表达式[,标志])转换字符串为二进制数据.
$astr &= '%' & StringMid($s2d, 3, 2) & '%' & StringMid($s2d, 5, 2) ;StringMid ( "字符串", 起始位置 [, 数量] )取某个字符串的部分字符.
ElseIf StringRegExp($sS[$i], '[^\w]') Then
$s2d = StringToBinary($sS[$i])
$astr &= '%' & StringMid($s2d, 3, 2)
Else
If $falg = 0 Then $astr &= $sS[$i]
If $falg <> 0 Then
$s2d = StringToBinary($sS[$i])
$astr &= '%' & StringMid($s2d, 3, 2)
EndIf
EndIf
Next
$astr = StringReplace($astr, '%20', '+') ;转换空格的编码为'+'号,也可不要此行
Return $str_s & $astr
EndFunc ;==>AnsiURLEncode
现有两个问题请高手指教一下: