
Sub init()
Dim objXML, objXSL, objFSO
Dim strFile, strFileName, strXSL
Dim strURL, theString
dim i
dim numid
window.status="正在传送登录数据···"

strURL="login.asp"
'创建MS的XMLHTTP组件
Set objXML = CreateObject("Microsoft.XMLHTTP")
' 发送信息
stra = URLEncoding("submit=submit&action=login&username="&document.all.username.value&"&password="&document.all.password.value&"")
objXML.Open "post",strURL,false
objXML.setrequestheader "content-length",len(stra)
objXML.setrequestheader "content-type","application/x-www-form-urlencoded"
objXML.send stra

getsetcx = objXML.responsebody
getsetcx = bytes2bstr(getsetcx)

logininfo.innerHTML =getsetcx
Set objXML = Nothing
window.status=""
end sub 

Sub loginoff()
Dim objXML, objXSL, objFSO
Dim strFile, strFileName, strXSL
Dim strURL, theString
dim i
dim numid
window.status="正在传送登录数据···"

strURL="login.asp"
'创建MS的XMLHTTP组件
Set objXML = CreateObject("Microsoft.XMLHTTP")
' 发送信息
stra = URLEncoding("submit=submit&action=loginoff")
stra=replace(stra," ","#$$#")
objXML.Open "post",strURL,false
objXML.setrequestheader "content-length",len(stra)
objXML.setrequestheader "content-type","application/x-www-form-urlencoded"
objXML.send stra

getsetcx = objXML.responsebody
getsetcx = bytes2bstr(getsetcx)

logininfo.innerHTML =getsetcx
Set objXML = Nothing
window.status=""
end sub 


function URLEncoding(vstrIn)
dim strReturn
strReturn = ""
dim i
For i = 1 To Len(vstrIn)
ThisChr = Mid(vStrIn,i,1)
If Abs(Asc(ThisChr)) < &HFF Then
strReturn = strReturn & ThisChr
Else
innerCode = Asc(ThisChr)
If innerCode < 0 Then
innerCode = innerCode + &H10000
End If
Hight8 = (innerCode And &HFF00)\ &HFF
Low8 = innerCode And &HFF
strReturn = strReturn & "%" & Hex(Hight8) & "%" & Hex(Low8)
End If
Next
URLEncoding = strReturn
End function

function bytes2bstr(vin)
dim strreturn
strreturn = ""
dim i
for i = 1 to lenb(vin)
thischarcode = ascb(midb(vin,i,1))
if thischarcode < &h80 then
strreturn = strreturn & chr(thischarcode)
else
nextcharcode = ascb(midb(vin,i+1,1))
strreturn = strreturn & chr(clng(thischarcode) * &h100 + cint(nextcharcode))
i = i + 1
end if
next
bytes2bstr = strreturn
end function

