您当前的位置:首页 > 其他技术 > 其他技术

龙族经验归0的ASP代码

本文出处:网游动力作者:本站发布时间:2010-06-03阅读次数:

以下是ASP代码
<%
        Dim DBHost,DBUser,DBPass,DB1,DB2,MaxLev
        DBHost = "127.0.0.1"     '把127.0.0.1改成你的数据库IP,本机可用127.0.0.1
        DBUser = "sa"            '数据库用户名
        DBPass = "12345"        '数据库密码
        DB1 = "TotalDB"          '帐号数据库
        DB2 = "DragonRajaDB"     '角色数据库
        MaxLev = 100             '清经验最低所要等级
        if Request.QueryString("Action") = "Exp" then
                Dim rs,rs1,Conn,Conn1,Account,PassWord,User
                Account = Request.Form("Account")
                PassWord = Request.Form("PassWord")
                User = Request.Form("User")
                if Account = "" or PassWord = "" or User = "" or Instr(Account,"'") or

Instr(PassWord,"'") or Instr(User,"'") then
                        Response.Write "<script>alert('所有项目不能为空并不能包含非法字

符!');location.href='ExpClear.asp'</script>"
                        Response.End()
                end if
                Set Conn = Server.CreateObject("ADODB.Connection")
                Set Conn1 = Server.CreateObject("ADODB.Connection")
                Conn.open "Provider=SQLOLEDB.1;UID="&  DBUser  &";PWD="&  DBPass 

&";database="  &  DB1  &";server="  &  DBHost
                Conn1.open "Provider=SQLOLEDB.1;UID="&  DBUser  &";PWD="&  DBPass 

&";database="  &  DB2  &";server="  &  DBHost 
                '检查用户名和密码
                Set rs = Server.CreateObject("ADODB.RecordSet")
                rs.open "Select * from Chr_log_info where login_id ='" & Account & "' and

passwd ='" & PassWord & "'",Conn,1,1
                if not rs.eof then
                        '用户名密码正确检查角色
                        Set rs1 = Server.CreateObject("ADODB.RecordSet")
                        rs1.open "Select * from Chr_Info where login_id ='" & Account & "'

and name='" & User & "'",Conn1,1,3
                        if not rs1.eof then
                                '验证等级
                                if rs1("Lev") < MaxLev then
                                        Response.Write "<script>alert('角色等级不

够!');history.back(-1)</script>"
                                        Response.End()
                                else
                                        rs1("Exp") = 0
                                        rs1.update
                                        Response.Write "<script>alert('经验清空成

功!');location.href='ExpClear.asp'</script>"
                                        Response.End()
                                end if
                        else
                                Response.Write "<script>alert('角色不正确!');history.back(-

1)</script>"
                                Response.End()
                        end if
                else
                        Response.Write "<script>alert('帐号或密码不正确!');history.back(-1)

</script>"
                        Response.End()
                end if
        end if
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>经验清0服务</title>
<style type="text/css">
<!--
body, td, th {
        font-family: 宋体;
        font-size: 12px;
        color: #000000;
}
body {
        margin-left: 0px;
        margin-top: 0px;
        margin-right: 0px;
        margin-bottom: 0px;
        background-color: #00CFFF;
}
a {
        font-size: 12px;
}
.style3 {
        font-size: 14;
        font-weight: bold;
        color: #FFFF00;
}
-->
</style></head>

<body>
<br>
<br>
<br>
<form name="form1" method="post" action="?Action=Exp">
  <table width="235" border="0" align="center" cellpadding="0" cellspacing="1"

bgcolor="#0000FF">
    <tr align="center" bgcolor="#3399FF">
      <td height="30"><span class="style3">经验清0服务(所需等级:<%=MaxLev%>)</span></td>
    </tr>
    <tr bgcolor="#00CFFF">
      <td height="25" align="center">帐号:
        <input name="Account" type="text" id="Account" size="15" maxlength="14" style="font

-family: 宋体; font-size: 12px; border: 1px solid #0000FF; background-color: #00CFFF"></td>
    </tr>
    <tr bgcolor="#00CFFF">
      <td height="25" align="center">密码:
      <input name="PassWord" type="password" id="PassWord" size="15" maxlength="14"

style="font-family: 宋体; font-size: 12px; border: 1px solid #0000FF; background-color:

#00CFFF"></td>
    </tr>
    <tr bgcolor="#00CFFF">
      <td height="25" align="center">角色:
      <input name="User" type="text" id="User" size="15" maxlength="10" style="font-family:

宋体; font-size: 12px; border: 1px solid #0000FF; background-color: #00CFFF"></td>
    </tr>
    <tr align="center" bgcolor="#00CFFF">
      <td height="40"><input type="submit" name="Submit" value="提交">
        <input type="reset" name="Submit" value="重置"></td>
    </tr>
  </table>
</form>
</body>
</html>