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

📄 user_mod.asp

📁 971音乐站全站程序
💻 ASP
字号:
<!--#include file="conn.asp"-->
<%
UserName=session("UserName")
If UserName="" or IsNull(WordID) Then
	Response.Write ("访问错误!可能你还没有登陆或者登陆超时!")
	Response.Write ("<br><br><a href='javascript:window.close();'>关闭窗口</a>")
	Response.End
End If
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改用户注册信息 <%Response.Write (UserName)%></title>
<style>
body,td{font-size:12px}
.bk {color: #f78d00; border:1px #f78d00 solid;}
.Tips_bo {
	FONT-FAMILY: "Arial", "宋体";
	BORDER: 0px #f78d00 solid; 
	FONT-SIZE: 12px; 
	COLOR: #f78d00;  
	text-decoration: none; 
	POSITION: relative;
	HEIGHT: 19;
}
</style>
<script language="JavaScript">
<!--
function form1_onsubmit() {
if(document.form1.Userpass.value=="")
	{
	  alert("错误! \n\n请设定一个登陆密码。")
	  document.form1.Userpass.focus()
	  return false
	 }
else if(document.form1.Userpass2.value=="")
	{
	  alert("错误! \n\n请填验证密码。")
	  document.form1.Userpass2.focus()
	  return false
	 }
else if(document.form1.Usermail.value=="")
	{
	  alert("错误! \n\n请填写您的E-Mail地址。")
	  document.form1.Usermail.focus()
	  return false
	 }
else if(document.form1.truename.value=="")
	{
	  alert("错误! \n\n请输入你的真实姓名。")
	  document.form1.truename.focus()
	  return false
	 }
else if(document.form1.Userpass2.value!=document.form1.Userpass.value)
	{
	  alert("错误! \n\n两次输入的密码不一致。")
	  document.form1.Userpass.focus()
	  return false
	 }	
}
// -->
</script>
</head>
<body bgColor="#FFCC00" text="#000000" >
<center>
<%
Dim UserName,Userpass,Userpass2,Usermail,truename,usersex,userip,userip1,userip2

If request.QueryString("action")="save" Then
	Userpass=replace(trim(Request.Form("Userpass")),"'","‘")
	Userpass2=replace(trim(Request.Form("Userpass2")),"'","‘")
	Usermail=trim(Request.Form("Usermail"))
	truename=trim(Request.Form("truename"))
	usersex=Request.Form("usersex")

	If Userpass="" or Userpass2="" or Usermail="" or truename="" or usersex="" or IsValidEmail(Usermail)=falseh Then
		Response.Write ("<font color=#000000>修改注册信息失败! 必须真实填写全部注册内容.</font>")
		Response.Write ("<br><br><a href='javascript:history.back();'><font color=#000000>返回</font></a>")
		Response.end
	End If

	set rs=server.createobject("adodb.recordset")
	sql="select * from [user] where username='"&UserName&"'"
	rs.open sql,conn,1,3
	if rs.eof then
		Response.Write ("<font color=#000000>修改用户注册信息失败! 该用户可能已经被删除.</font>")
		Response.Write ("<br><br><a href='javascript:history.back();'><font color=#000000>返回</font></a>")
		Response.end
	else
		rs("password")=Userpass
		rs("Sex")=usersex
		rs("email")=Usermail
		rs("Name")=truename
		rs.update
	end if
	rs.close
	
		session("UserName")=UserName
	    session("TrueName")=truename
		session("PassWord")=Userpass
		session("sex")=usersex
		session.timeout=200
	
	Response.Write ("<font color=#000000>修改注册信息成功! <br>您现在可以立即登陆了.</font>")
	Response.Write ("<br><br><a href='javascript:window.close();'><font color=#000000>关闭窗口</font></a>")
	
	conn.close
	set conn=nothing
Else

Set rs=conn.execute("select password,sex,email,name from [user] where username='"&UserName&"'")
%>
<form method="post" language="javascript" onsubmit="return form1_onsubmit()" action="?action=save&username=<%=UserName%>" name="form1">
  <table width="359" border="0" bgcolor="#FFFFFF" height="27">
    <tr>
      <td height="33" width="344" align="center" colspan="2"> 修 改 用 户 
        信 息 <hr align="center" color="#ff0000" SIZE="1" width="98%"></td> 
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;用户名称:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=UserName  disabled class="bk" value="<%=UserName%>"> 
        *不允许修改</td>       
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;用户密码:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=Userpass class="bk" type="password" value="<%=rs(0)%>"> 
        *登陆密码(英文字母/数字)</td>       
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;验证密码:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=Userpass2 class="bk" type="password" value="<%=rs(0)%>"> 
        *再重复输入一次用户密码</td>       
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;电子邮件:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=80 size=16 name=Usermail class="bk" value="<%=rs(2)%>"> 
        *经常使用的E-mail</td>     
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;真实姓名:</td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=truename class="bk" value="<%=rs(3)%>"> 
        *</td>      
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;用户称呼:</td>
      <td height="28" width="287">&nbsp;<select style="FONT-SIZE: 9pt" name="usersex" class="bk" size="1">    
                  <option value="先生"<%If rs(1)="先生" Then Response.Write(" selected") End If%>> 先 生 </option>
                  <option value="女士"<%If rs(1)="女士" Then Response.Write(" selected") End If%>> 女 士 </option>
        </select>   *</td>   
    </tr>
    <tr>
      <td height="1" width="349" colspan="2">
        <p align="center">&nbsp;&nbsp;<input type="submit" value=" 修 改 " name="B1" class="Tips_bo">&nbsp;&nbsp;    
        <input type="button" value=" 关 闭 " name="B3" class="Tips_bo" onclick="javascript:window.close();"></p>
      </td>
    </tr>
  </table>
</form>
<%
rs.close
set rs=nothing

End If%>
</center>
</body>
</html>
<%


'检查EMAIL格式是否正确
Function IsValidEmail(email)
Dim names, name, i, c
IsValidEmail = TRUE
names = Split(email, "@")
If UBound(names) <> 1 Then
   IsValidEmail = FALSE
   Exit Function
End If
For Each name in names
   If Len(name) <= 0 Then
     IsValidEmail = FALSE
     Exit Function
   End If
   For i = 1 To Len(name)
     c = LCase(Mid(name, i, 1))
     'If InStr("`!@#$%^&*()+=|\?';:<>,。,~!·¥……—()——、;:“’《》?", c) <> 0 AND NOT IsNumeric(c) Then	'支持中文格式地址
     If InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 AND NOT IsNumeric(c) Then	'不支持中文格式地址
       IsValidEmail = FALSE
       Exit Function
     End If
   Next
   If Left(name, 1) = "." or Right(name, 1) = "." Then
      IsValidEmail = FALSE
      Exit Function
   End If
Next
If InStr(names(1), ".") <= 0 Then
   IsValidEmail = FALSE
   Exit Function
End If
i = Len(names(1)) - InStrRev(names(1), ".")
If i <> 2 AND i <> 3 Then
   IsValidEmail = FALSE
   Exit Function
End If
If InStr(email, "..") > 0 Then
   IsValidEmail = FALSE
End If
End Function
%>

⌨️ 快捷键说明

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