<!--#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,trueweb,truelogo,trueqq,truedianhua,truegonggao,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"))
	trueweb=replace(trim(Request.Form("trueweb")),"'","‘")
	truelogo=replace(trim(Request.Form("truelogo")),"'","‘")
	trueqq=replace(trim(Request.Form("trueqq")),"'","‘")
	truedianhua=replace(trim(Request.Form("truedianhua")),"'","‘")
	truegonggao=replace(trim(Request.Form("truegonggao")),"'","‘")
	truename=replace(trim(Request.Form("truename")),"'","‘")
	usersex=left(Request.Form("usersex"),4)

	If Userpass="" or Userpass2="" or Usermail="" or trueweb="" or truelogo="" or trueqq="" or truedianhua="" or truegonggao="" 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 [ylmv_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("Web")=trueWeb
		rs("Logo")=trueLogo
		rs("Qq")=trueQq
		rs("Dianhua")=trueDianhua
		rs("Gonggao")=trueGonggao
		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,web,Logo,Qq,Dianhua,Gonggao,id from [ylmv_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%"><br><a href="url.asp?id=<%=rs(9)%>" target="_blank"><font color="#FF0000">点击进入你的音乐网</font></a></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;<font color=#FF0000>网站名称:</font></td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=trueWeb class="bk" value="<%=rs(4)%>"> 
        *你的个人音乐网名称！</td>       
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;<font color=#FF0000>网站Logo:</font></td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=50 size=16 name=trueLogo class="bk" value="<%=rs(5)%>"> 
        *个人音乐网的Logo！</td>       
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;<font color=#FF0000>联系QQ:</font></td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=trueQq class="bk" value="<%=rs(6)%>"> 
        *你的个人音乐网要用！</td>       
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;<font color=#FF0000>联系电话:</font></td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=trueDianhua class="bk" value="<%=rs(7)%>"> 
        *你的个人音乐网要用！</td>       
    </tr>
    <tr>
      <td height="28" width="62">&nbsp;<font color=#FF0000>网站公告:</font></td>
      <td height="28" width="287">&nbsp;<INPUT maxLength=20 size=16 name=trueGonggao class="bk" value="<%=rs(8)%>"> 
        *你的个人音乐网要用！</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
%>