laoyou456 发表于 2008-9-14 20:44:19

求修改中文名的asp!

前面用了个 但是一修改就出现 一个角色只能修改一次其实什么也没修改 郁闷了好久
那个大虾无私分享个 修改中文的 asp

vvforgs 发表于 2008-9-14 22:51:53

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>人物角色名称修改</title>
<link href="css.css" rel="stylesheet" type="text/css" />
</head>
<script language="javascript">
function check1()
{
        if (form1.username.value==''||form1.rusername.value==''||form1.strid.value==''||form1.psw.value=='')
        {
                alert('error!');
                return false;
        }
        else
        {
                if(form1.rusername.value.length>10)
                {
                        alert('太长了!');
                        return false;
                }
                else
               
                return true;
        }
}
</script>
<%
if request.Form("submit")<>"" then
        strid=TRIM(Request.Form("strid"))
        psw=TRIM(Request.Form("psw"))
        username=TRIM(Request.Form("username"))
        rusername=TRIM(Request.Form("rusername"))
        if len(rusername)>10 then
                Response.write("<script>alert('输入的角色名太长了!');window.history.back();</script>")
                Response.End()
        end if
       
        '==========
        Sql="Select * from Account_char where strAccountID='"& strid &"' and (strcharID1='"& username &"' or strcharID2='"& username &"' or strcharID3='"& username &"')"
        set ors=conn.execute(Sql)
        if ors.eof then
                Response.write("<script>alert('输入的信息不正确!');window.history.back();</script>")
                Response.End()
        end if
        Sql="Select * from TB_USER where strAccountid='"& strid &"' and strpasswd='"& psw &"'"
        set ors=conn.execute(Sql)
        if ors.eof then
                Response.write("<script>alert('输入的密码不正确!');window.history.back();</script>")
                Response.End()
        end if
       
        '===============
        Sql="Select * from USERDATA where struserID='" & username & "'"
        set ors=conn.Execute(Sql)
        if ors.eof then
                Response.write("<script>alert('输入的角色名有误!');window.history.back();</script>")
                Response.End()
        end if
        if ors("knights")<>0 then
                Response.write("<script>alert('该角色未退出骑士团!');window.history.back();</script>")
                Response.End()
        end if
        ors.close
        set ors=nothing
        Sql="Select * from userdata where struserID='"& rusername &"'"
        set ors=conn.Execute(Sql)
        if not ors.eof then
                Response.write("<script>alert('输入的新角色名已经存在!');window.history.back();</script>")
                Response.End()
        end if
        ors.close
        set ors=nothing
       
        Sql="Select * from rname where charname='"& username &"'"
        set ors=conn.Execute(Sql)
        if not ors.eof then
                Response.write("<script>alert('一个角色只能修改一次!');window.history.back();</script>")
                Response.End()
        end if
        ors.close
        set ors=nothing
       
       
        Sql="insert into rname (charname) values ('"& rusername &"')"
        conn.Execute(Sql)
       
       
        Sql="update ACCOUNT_CHAR set strCharID1='"& rusername &"' where strCharID1='"& username &"'"
        conn.execute(Sql)
        Sql="update ACCOUNT_CHAR set strCharID2='"& rusername &"' where strCharID2='"& username &"'"
        conn.execute(Sql)
        Sql="update ACCOUNT_CHAR set strCharID3='"& rusername &"' where strCharID3='"& username &"'"
        conn.execute(Sql)
        Sql="update USERDATA set strUserID='"& rusername &"' where strUserID='"& username &"'"
        conn.Execute(Sql)
        Response.write("<script>alert('角色名修改成功!');</script>")
end if

%>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td height="150"><img src="Pic/top.jpg" width="700" height="150" /></td>
</tr>
<tr>
    <td>&nbsp;</td>
</tr>
<tr>
    <td><form id="form1" name="form1" method="post" action="" onsubmit="return check1();">
      <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
          <td>帐号:</td>
          <td><input name="strid" type="text" id="strid" /></td>
      </tr>
      <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
      </tr>
      <tr>
          <td>密码:</td>
          <td><input name="psw" type="text" id="psw" /></td>
      </tr>
      <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
      </tr>
      <tr>
          <td>原角色名称: </td>
          <td><input name="username" type="text" id="username" /></td>
      </tr>
      <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
      </tr>
      <tr>
          <td>新角色名称:</td>
          <td><input name="rusername" type="text" id="rusername" /></td>
      </tr>
      <tr>
          <td>&nbsp;</td>
          <td>(不要含有特殊符号,修改前保证人物已经下线,并没有团)</td>
      </tr>
      <tr>
          <td>&nbsp;</td>
          <td>&nbsp;</td>
      </tr>
      <tr>
          <td>&nbsp;</td>
          <td><input type="submit" name="Submit" value="提交" /></td>
      </tr>
      </table>
    </form></td>
</tr>
<tr>
    <td>&nbsp;</td>
</tr>
<tr>
    <td>&nbsp;</td>
</tr>
<tr>
    <td>&nbsp;</td>
</tr>
<tr>
    <td><div align="center"></div></td>
</tr>
</table>
</body>
</html>

laoyou456 发表于 2008-9-15 00:04:42

谢谢啊 好人还是多纳

laoyou456 发表于 2008-9-15 00:14:53

用了上面的代码 还是那样子 问题出在哪了 望高手指点迷津


一输入完修改信息 点击后就出现    一个角色只能修改一次

feike 发表于 2008-9-17 10:45:49

服务器地址指向是不是在此定义:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

binwang 发表于 2008-9-17 11:07:13

原帖由 feike 于 2008-9-17 02:45 发表 http://www.kofans.cn/bbs/static/image/common/back.gif
服务器地址指向是不是在此定义:


no
这个是定义这个页面用的是w3c的transitional标准

laoyou456 发表于 2008-9-17 12:59:56

哎~~~!
页: [1]
查看完整版本: 求修改中文名的asp!