搜索
 找回密码
 加入

谢谢, 网页改人物中文的代码,帮看看数据库表在那里.谢谢

hl8882 2008-10-28 10:30:59 1593
谢谢,这是修改人物中文名字网页的代码,那个是连接数据库表的项?谢谢应该怎么设置~
on error resume next
if request.form("username")<>"" then
ps_loginname=request.form("username")        '帐号
ps_oldpsd=request.form("oldpsd")        '密码
ps_psd1=request.form("psd1")        '旧角色名
ps_psd2=request.form("psd2")  '新角色中文名
if instr(ps_psd2,"'")<>0 or instr(ps_psd2,"=")<>0 or instr(ps_psd2,"&")<>0 or instr(ps_psd2,"%")<>0 then
response.write "您所输入的中文角色名数据包含非法字符,对不起!"
response.end
end if
if ps_loginname="" or ps_oldpsd="" or ps_psd1="" or ps_psd2="" then
response.write "<script language=javascript>alert('请填写清楚!');history.back();</script>"
response.end
end if

set rs1 = Server.CreateObject("ADODB.Recordset")
sql="select strPasswd from TB_USER  where strAccountID = '"&ps_loginname&"'"
rs1.open sql,conn,1,3
'response.write rs1("strPasswd")
'response.write ps_psd1
chg=0
if not rs1.eof then
        if ps_oldpsd=rs1("strPasswd") then '密码正确

                set rs3 = Server.CreateObject("ADODB.Recordset")
                sql3="select strcharid1 from account_char where straccountid = '"&ps_loginname&"'"
                rs3.open sql3,conn,1,3
                s_user1=ltrim(rtrim(rs3("strcharid1"))) '去除左右空格
                s_user2=ltrim(rtrim(ps_psd1))
                if s_user1 = s_user2 then  '取得正确的原始角色名进行比较,错误6
                        set rs2 = Server.CreateObject("ADODB.Recordset")
                        sql2="select ChangeID,Level from userdata where  strUserID = '"&ps_psd1&"'"
                        rs2.open sql2,conn,1,3

                                if rs2("ChangeID") = "0" then '没修改过中文,1为修改过,错误5
                                        if rs2("level") = "1" then '级别为1,错误4
                                                sql5="select struserid from userdata where struserid = '"&ps_psd2&"'"
                                                rs1.open sql5,conn ,1,3
                                                if not rs1.eof then
                                                   response.write "<script language=JavaScript>alert('新角色名已经有人使用!');history.back();</script>"
                                                   response.end
'                                                   chg=7 '新名被人占用
                                                else
                                                        sql4="update userdata set struserid='"&ps_psd2&"',ChangeID = '1'  where struserid='"&ps_psd1&"'"
                                                        sql2="update account_char set strCharID1='"&ps_psd2&"'  where strCharID1= '"&ps_psd1&"'"
                                                        set rs2=conn.execute(sql2)
                                                        set rs2=conn.execute(sql4)                                               
                                                        chg=1
                                                end if
                                        else
                                                chg=4  '级别不为1
                                        end if
                                else
                                        chg = 5 '修改过名字
                                end if
                                rs2.close
                                set rs2=nothing
                else        '账号和角色不对应
                        chg=6
                end if
                rs3.close
                set rs3=nothing
        else
        chg=2
        end if
else
        chg=3
end if
if chg=1 then response.write "<script language=javascript>alert('修改中文名成功!');location.href='index.htm';</script>"
if chg=2 then response.write "<script language=javascript>alert('密码错误!');history.back();</script>"
if chg=3 then response.write "<script language=javascript>alert('请正确输入您的帐号!');history.back();</script>"
if chg=4 then response.write "<script language=javascript>alert('级别不为1无法修改!');history.back();</script>"
if chg=5 then response.write "<script language=javascript>alert('您已经修改过角色名!');history.back();</script>"
if chg=6 then response.write "<script language=javascript>alert('原角色名错误!');history.back();</script>"
'sql2="update USERDATA set Gold=99999999  where strUserId= 'BOW'"
'set rs1=conn.execute(sql2)
rs1.close
set rs1=nothing
conn.close
set conn=nothing
response.end
else
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Knight V1.0&nbsp; 骑士</title>
<link href="tupian/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
</style>
</head>
<body leftmargin="0" topmargin="0" background="tupian/left_bg.jpg">
<TABLE cellSpacing=0 cellPadding=0 width=760 align=center border=0>
  <TBODY>
    <TR>
      <TD><img border="0" src="tupian/222.jpg" width="763" height="100"></TD>
      <TD></TD>
    </TR>
  </TBODY>
</TABLE>
<TABLE align=center border=1 cellPadding=0 cellSpacing=0 width=760 borderColor="#666666" frame=vsides rules=none>
  <TR>
    <td width=204 align=left vAlign=top><p>&nbsp;</p>
      <!--#include file="inc_hy.asp" -->
    </TD>
    <td width=1 height="190" background="tupian/xu.gif"></TD>
    <td width=553 align=left vAlign=middle bgcolor="#FFFFFF" class="newsbg">
<table width="443" height="199" border="0" align="center" cellpadding="3" cellspacing="0">
        <tr>
          <td width="437" height="40" align="left" >
            <table width="196" border="0" cellspacing="0" cellpadding="3">
              <tr>
                <td align="center" class="bigf"><font color="#666666">修改中文角色名</font></td>
              </tr>
            </table> </td>
        </tr>
        <tr>
          <td height="92" align="center">
            <TABLE align=left border=0 cellPadding=5 cellSpacing=1 width="268">
             <FORM method=post name=chgform action="ChangeUserID.asp">
<TBODY>
                <TR>
                  <TD align=right class=txt_gray colSpan=2> <DIV align=left>
                    <p><FONT
              color=#cc3300>此处可以将英文名修改为中文名,步骤:<br>
                    1、新建帐号注册成功后,必须登陆游戏创建游戏中的角色,创建后直接退出游戏。<br>
                      2、
                      在此处修改中文名,只能修改一次。(只有在一级时候才可以修改)</FONT></p>
                    </DIV></TD>
                </TR>
                <TR>
                  <TD align=right class=txt_gray width="100"> <DIV align=left>登陆帐号</DIV></TD>
                  <TD class=txt_gray width="133"> <INPUT name=username type=text class="lanyu" size=17 maxLength=16>
                  </TD>
                </TR>
                <TR>
                  <TD class=txt_gray width="100">原始密码</TD>
                  <TD class=txt_gray width="133"> <INPUT name=oldpsd type=password class="lanyu" size=18 maxLength=16></TD>
                </TR>
                <TR>
                  <TD class=txt_gray width="100">原角色名</TD>
                  <TD class=txt_gray width="133"> <INPUT name=psd1 type=text class="lanyu" size=18 maxLength=16></TD>
                </TR>
                <TR>
                  <TD class=txt_gray width="100">新中文角色名</TD>
                  <TD class=txt_gray width="133"> <INPUT name=psd2 type=text class="lanyu" size=18 maxLength=16></TD>
                </TR>
              </TBODY></form>
            </TABLE>
          </td>
        </tr>
        <tr>
          <td height="25" align="left">
            <table width="214" border="0" cellspacing="0" cellpadding="3">
              <tr>
                <td width="208" align="center" class="bigf"><img src="tupian/reg.gif" width="40" height="17" class="hand" onClick="chgform.submit()"> <img src="tupian/reg1.gif" width="40" height="17" class="hand" onClick="chgform.reset()"></td>
              </tr>
            </table>
            
          </td>
        </tr>
      </table></TD>
  </TR>
</TABLE>
<p>&nbsp;</p>

4 回复

minghua100
2008-9-14 03:19:26
点击查看详情
sql="select strPasswd from TB_USER where strAccountID = '"&ps_loginname&"'"
这是检测帐号密码的调用

sql4="update userdata set struserid='"&ps_psd2&"',ChangeID = '1' where struserid='"&ps_psd1&"'"

这是角色的调用
最后提交到的ChangeUserID.asp文件处理

评分

1

查看全部评分

feike
2008-9-17 10:55:23
哦,学习啦!!
忝才混混
2008-10-11 02:36:31
还是没明白~~
chencjh
2008-10-28 10:30:59

顶起来,好东西啊,不错不错。

顶起来,好东西啊,不错不错。
高级模式
游客