搜索
 找回密码
 加入

ASP人兽互转网页(可独立运行)

45436348 2009-1-13 11:07:23 288
  1. <%@ CODEPAGE=936%>
  2. <%
  3. Session.CodePage=936
  4. Response.Charset="GBK"

  5. Dim Conn
  6. sub OpenConn()
  7.         On Error Resume next
  8.         Set Conn= Server.CreateObject("ADODB.Connection")
  9.         '链接access
  10.         'databaseurl="#KO.mdb"
  11.         'Conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(databaseurl)
  12.         '链接2000
  13.         Conn.ConnectionString="Provider=SQLOLEDB;Data Source=(local);DATABASE=kn_online;UID=sa;pwd=slleo"
  14.         Conn.Open
  15.         if err.number<>0 then
  16.                 response.write("<div style='font-size:11px;font-weight:bold;border:1px #ccc solid;background:#fdfdea;padding:6px 10px;text-align:left;margin-bottom:8px;color:red;'>SQL数据库连接失败!请联系管理员解决!</div>")
  17.                 response.End
  18.         end if
  19. end sub

  20. sub CloseConn()
  21.         On Error Resume Next
  22.         If IsObject(Conn) Then
  23.                 conn.close
  24.                 set conn=nothing
  25.         end if
  26. end sub

  27. Function CheckStr(byVal ChkStr)
  28.         Dim Str:Str=ChkStr
  29.         Str=Trim(Str)
  30.         If IsNull(Str) Then
  31.                 CheckStr = ""
  32.                 Exit Function
  33.         End If
  34.         Dim re
  35.         Set re=new RegExp
  36.         re.IgnoreCase =True
  37.         re.Global=True
  38.         re.Pattern="(\r\n){3,}"
  39.         Str=re.Replace(Str,"$1$1$1")
  40.         Set re=Nothing
  41.         'Str = Replace(Str,"'","''")
  42.         Str = Replace(Str,"'","&quot;")
  43.         Str = Replace(Str, "select", "select")
  44.         Str = Replace(Str, "join", "join")
  45.         Str = Replace(Str, "union", "union")
  46.         Str = Replace(Str, "where", "where")
  47.         Str = Replace(Str, "insert", "insert")
  48.         Str = Replace(Str, "delete", "delete")
  49.         Str = Replace(Str, "update", "update")
  50.         Str = Replace(Str, "like", "like")
  51.         Str = Replace(Str, "drop", "drop")
  52.         Str = Replace(Str, "create", "create")
  53.         Str = Replace(Str, "modify", "modify")
  54.         Str = Replace(Str, "rename", "rename")
  55.         Str = Replace(Str, "alter", "alter")
  56.         Str = Replace(Str, "cast", "cast")
  57.         CheckStr=Str
  58. End Function


  59. action=trim(request("action"))
  60. if action="do" then
  61.         openconn()
  62.         charid=trim(CheckStr(request.form("charid")))
  63.         pass=trim(CheckStr(request.form("pass")))
  64.         Set rcs=conn.execute("select strAccountID from CURRENTUSER where [strAccountID]='"&charid&"'")
  65.         If Not rcs.eof Then
  66.                 response.write("该账号当前在线,不可进行操作!")
  67.         else
  68.                 set rs=conn.execute("select strAccountID,strPasswd from [TB_USER] where [strAccountID]='"&charid&"' and [strPasswd]='"&pass&"'")
  69.                 if not rs.eof then
  70.                         set cs=conn.execute("select strAccountID,bnation from ACCOUNT_CHAR where strAccountID='"&charid&"'")
  71.                         if not cs.eof then
  72.                                 if cs("bnation")=1 then
  73.                                         conn.execute("EXEC HumanNT '"&charid&"'")
  74.                                         response.write("成功转成人族!")
  75.                                 else
  76.                                         conn.execute("EXEC KarusNT '"&charid&"'")
  77.                                         response.write("成功转成兽族!")
  78.                                 end if
  79.                         else
  80.                                 response.write("该ID还没有创建账号!")
  81.                         end if
  82.                 else
  83.                         response.write("账号或密码不对!")
  84.                 end if
  85.                 rs.close:set rs=Nothing
  86.         End if
  87.         closeconn()
  88. end if
  89. %>


  90. <style>
  91. *{font-family:arial;font-size:12px;color:#000;}
  92. .listTbl{border-top:1px #777574 solid;border-left:1px #777574 solid;}
  93. .listTbl th{font-weight:bold;background:#4d4e48;}
  94. .listTbl th,
  95. .listTbl td{border-right:1px #777574 solid;border-bottom:1px #777574 solid;padding:4px;}
  96. </style>

  97. <form action="?action=do" method="post">
  98. <table width="98%" border="0" cellspacing="0" cellpadding="0" class="listTbl">
  99.         <tr>
  100.                 <td width="70">用户ID:</td>
  101.                 <td align="left"><input type="text" name="charid" /></td>
  102.         </tr>
  103.         <tr>
  104.                 <td>密码:</td>
  105.                 <td align="left"><input type="password" name="pass" /></td>
  106.         </tr>
  107.         <tr>
  108.                 <td>&nbsp;</td>
  109.                 <td align="left"><input type="submit" value="转换" /></td>
  110.         </tr>
  111. </table>
  112. </form>

  113. <%closeconn()%>
复制代码
随机推荐

0 回复

高级模式
游客