⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 per_changename.asp

📁 直接附加数据库! 修改 Include/ Class_Main.asp 为自己信息 后台admin admin 绍兴人才网程序
💻 ASP
字号:
<!--#include file="../Include/Class_Conn.asp" -->
<!--#include file="../Public/Person_Cookies.asp" -->
<!--#include file="../Include/Class_Main.asp" -->
<% 
Dim Rs,Cmd,Tmp,Action,Temp(3)
Dim Perid,UserName,UserType,RealName,JobContent

Action = Request.QueryString("action")
If Action = "edit" Then Call Edit_Submit() '跳转到保存函数

'//获取个人用户的登陆标记
If IsArray(Session("Person")) Then
 Perid = Session("Person")(2)
 UserName = Session("Person")(0)
Else
 Session.Abandon() 
 Response.write "<script>alert('-登录后才能进行该操作!-');location.href='../Public/MemberLogin.asp';</script>"
End if

'//调用存储过程
Set Cmd = Server.CreateObject("ADODB.Command")
Cmd.ActiveConnection = Conn
Cmd.CommandText = "Per_Account"
Cmd.CommandType = 4
Cmd.Parameters.Append Cmd.CreateParameter("@Perid",200,1,30)
Cmd.Parameters("@Perid") = Perid
Set Rs = Cmd.Execute

If Rs.Eof Then
 CloseRs
 Set Cmd = Nothing
 CloseDB
 Response.write "没有找到会员资料!"
 Response.End()
End if
Tmp = Rs.GetRows() '//将数据填充到数组
'//0姓名,1会员类型
'//如:Tmp(0,0)表示 用户的姓名
Rs.Close
Set Cmd = Nothing
'//功能代码
UserType = Cls_Usertype(Tmp(1,0))
 
RealName   = Tmp(0,0)

 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="../Css/Style.css" type=text/css rel=stylesheet>
<title><%= Cls_WebName %> -- 个人会员管理中心 -- 更改用户名</title>
</head>
<script language="JavaScript" >
function theForm_check()
{
if (document.theForm.oldname.value=="")
{
 alert("请输入原用户名!");
 document.theForm.oldname.focus();
 return false;
}

if (document.theForm.newname.value=="")
{
 alert("请输入新用户名!");
 document.theForm.newname.focus();
 return false;
}
}
</script>
<body>
<table width="768" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td>
      <!--#include file="../Include/Header.asp" -->
    </td>
  </tr>
</table>
<table width="956" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr> 
    <td><table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td height="4"></td>
        </tr>
        <tr> 
          <td height="1" bgcolor="#eeeeee"></td>
        </tr>
      </table>
      <table width="956" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td width="175">
            <!--#include file="../Public/Person_Left.asp" -->
          </td>
          <td width="5">&nbsp;</td>
          <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr> 
                <td height="25"><img src="../Images/icon.gif" width="11" height="11" align="absmiddle"> 
                  <%= RealName %>[<%= UserType %>] </td>
              </tr>
            </table>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <Form action="?action=edit" method="post" name="theForm" onSubmit="return theForm_check()"> 
                <tr> 
                  <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgcolor="eeeeee">
                      <tr> 
                        <td bgcolor="#FFFFFF"><table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td height="2"></td>
                            </tr>
                          </table>
                          <table width="99%" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="eeeeee">
                            <tr> 
                              
                              <td height="25" bgcolor="f5f5f5"><b><font color="#000000">&nbsp;</font></b><strong>更改用户名</strong></td>
                            </tr>
                          </table>
                          
                          <table width="99%" border="0" align="center" cellpadding="2" cellspacing="1">
                            <tr bgcolor="f9f9f9"> 
                              <td width="22%" height="25" align="right"><STRONG><FONT 
                  color=#ff6600>*</FONT></STRONG> 原用户名:</td>
                              <td height="25"> <input name="oldname" type="text" id="oldname" size="15" maxlength="30"></td>
                            </tr>
                            <tr> 
                              <td width="22%" height="25" align="right"><STRONG><FONT 
                  color=#ff6600>*</FONT></STRONG> 新用户名:</td>
                              <td height="25"><input name="newname" type="text" id="newname" size="15" maxlength="30">
                              </td>
                            </tr>
                          </table>
                          <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0">
                            <tr> 
                              <td height="2"></td>
                            </tr>
                          </table> </td>
                      </tr>
                    </table></td>
                </tr>
                <tr> 
                  <td height="40" align="center"> <input type="submit" name="Submit" value=" 提 交 " style="height:30px;"></td>
                </tr>
             </Form> 
            </table></td>
        </tr>
      </table>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="1" bgcolor="#eeeeee"></td>
  </tr>
</table>
<!--#include file="../Include/Footer.asp" -->
	  </td>
  </tr>
</table>

</body>
</html>
<% 
Sub Edit_Submit()
 '//接收参数
 Perid             = Session("Person")(2)
 Password          = Session("Person")(1)
 OldName           = Replace_Text(Request.Form("OldName"))
 NewName           = Replace_Text(Request.Form("NewName"))
 
 '查找有没有该用户存在
 SQL = "Select UserName From [pH_Person_Base] Where UserName='"&OldName&"'"
 Set Rs = Conn.Execute(SQL)
 If Rs.Eof Then
  Response.write "<script>alert('对不起!没有找到该用户名...');history.back(-1);</script>"
  Response.End()
 End if
 Rs.Close
 '查找新用户名有没有和其他用户名相同
 SQL = "Select UserName From [pH_Person_Base] Where UserName='"&NewName&"'"
 Set Rs = Conn.Execute(SQL)
 If Not Rs.Eof Then
  Response.write "<script>alert('对不起!新用户名已经被其他用户使用...');history.back(-1);</script>"
  Response.End()
 End if
 Rs.Close
 '更新用户名
 Conn.Execute("Update [pH_Person_Base] Set Username='"&NewName&"' Where Username='"&OldName&"'")
 Conn.Execute("Update [pH_Person_Info] Set Username='"&NewName&"' Where Username='"&OldName&"'")
 Conn.Execute("Update [pH_Person_Education] Set Username='"&NewName&"' Where Username='"&OldName&"'")
 Conn.Execute("Update [pH_Person_Searcher] Set Username='"&NewName&"' Where Username='"&OldName&"'") 
 Conn.Execute("Update [pH_Person_Work] Set Username='"&NewName&"' Where Username='"&OldName&"'")
 Conn.Execute("Update [User] Set User_name='"&NewName&"' Where User_name='"&OldName&"'")   
 '更改Session值
 Temp(0) = NewName
 Temp(1) = Password
 Temp(2) = Perid
 Session("Person") = Temp
 
 Response.write "<script>alert('用户名修改修改成功!');location.href='Per_ChangeName.asp';</script>"
 
End Sub

'//关闭数据库连接
CloseDB
 %>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -