cHTTP.cls
上传用户:mfksglq
上传日期:2010-03-23
资源大小:3k
文件大小:3k
源码类别:

弱点检测代码

开发平台:

Visual Basic

  1. VERSION 1.0 CLASS
  2. BEGIN
  3.   MultiUse = -1  'True
  4.   Persistable = 0  'NotPersistable
  5.   DataBindingBehavior = 0  'vbNone
  6.   DataSourceBehavior  = 0  'vbNone
  7.   MTSTransactionMode  = 0  'NotAnMTSObject
  8. END
  9. Attribute VB_Name = "cHTTP"
  10. Attribute VB_GlobalNameSpace = False
  11. Attribute VB_Creatable = True
  12. Attribute VB_PredeclaredId = False
  13. Attribute VB_Exposed = False
  14. Private objXMLHTTP As New ServerXMLHTTP
  15. Public Function QueryData(ByVal sid As String, ByVal spass As String)
  16.     Dim time1 As Integer
  17.     Dim k As String
  18.     strFormData = "username=" & sid & "&password=" & spass & "&utype=1"
  19.     With objXMLHTTP
  20.         .abort
  21.         .open "POST", "http://202.207.16.59/servlet/javabbs.jwlogin?tag=login", False
  22.         .setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
  23.         .setRequestHeader "Connection", "Keep-Alive"
  24.         .setRequestHeader "Cookie", "0"
  25.         .send strFormData
  26.     'DoEvents
  27.         Do
  28.             
  29.             If .readyState = 4 Then
  30.             
  31.                 ss = .responseText
  32.                 
  33.                 If sta = 0 Then
  34.                     
  35.                     If InStr(ss, "密码") > 0 Then
  36.                         QueryData = "密码错误"
  37.                         Exit Function
  38.                     End If
  39.                     
  40.                     If Not InStr(ss, "loginok.jsp") > 0 Then
  41.                         QueryData = "未知错误"
  42.                         Exit Function
  43.                     End If
  44.                     
  45.                     .open "GET", "http://202.207.16.59/jw/jw_student/wdkc/xk.jsp", False
  46.                     .send
  47.                     sta = 1
  48.                 Else
  49.                     info = Mid(ss, InStr(ss, "选课人"), 35)
  50.                     
  51.                     
  52.                     If InStr(ss, "<td  height=""20"" width=""18%""><a href=""kchchx_xx.jsp?pcourseid") > 0 Then
  53.                         ss = Split(ss, "<td  height=""20"" width=""18%""><a href=""kchchx_xx.jsp?pcourseid")(1)
  54.                         ss = Split(ss, "class=""middle_a"">")(1)
  55.                         ss = Split(ss, "</a></td>")(0)
  56.                     Else
  57.                         ss = "未选课"
  58.                     End If
  59.                     
  60.                     QueryData = Trim(Replace(info, vbCrLf, "")) & "=" & ss
  61.                     
  62.                     Exit Function
  63.                 End If
  64.             End If
  65.               
  66.             Sleep (100)
  67.             time1 = time1 + 1
  68.         Loop Until time1 > 50
  69.         QueryData = "超时"
  70.     End With
  71. End Function
  72. Public Function Stas() As Integer
  73.     Stas = objXMLHTTP.readyState
  74. End Function