<%@ Language=VBScript%>
<%
Response.Buffer=false
Response.Expires=0
%>
<!-- #include file="../dsn.asp" -->
<!-- #include file="../links.asp" -->
<%
username=trim(Request.QueryString("username"))
pageno=Request.QueryString("pageno")
idd=Request.QueryString("id")
httpadd=Request.QueryString("httpadd")
%>
<%
if session("adminusername")="" then
		session("xhy")=1
		Response.Redirect linkwarn
end if
if session("adminusername")="xhaiy6411620" then
		adminusername="admin"
	else
		adminusername=session("adminusername")
end if
set cn = Server.CreateObject("ADODB.Connection")
cn.Open(mycnstr)
set rs1 = Server.CreateObject("ADODB.Recordset")
set rs2 = Server.CreateObject("ADODB.Recordset")
		sqltext1="select * from adminuser where username='"+adminusername+"'"
		rs1.Open sqltext1,cn,1,1
		username=rs1("username")
		realname=rs1("relname")		
		password=rs1("userpass")
		rs1.Close

%>
<html>
<head>
<title>会员资料</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body {font-size: 12px; color: #000; font-family: 宋体}
td {font-size: 12px; color: #000; font-family: 宋体;line-height:130%}

.t1 {font:12px 宋体;color=000000} 
.t2 {font:12px 宋体;color:ffffff} 
.t3 {font:12px 宋体;color:336699} 
.t4 {font:12px 宋体;color:ff0000} 
.bt1 {font:14px 宋体;color=000000} 
.bt2 {font:14px 宋体;color:ffffff} 
.bt3 {font:14px 宋体;color:336699} 
.bt4 {font:bold 16px 宋体;color:maroon} 

.td1 {font-size:12px;line-height:24px;text-align:right;background-color:#efefef;color:#000000}
.td2 {font-size:12px;line-height:24px;text-align:left;background-color:#ffffff;color:#000000;}
.td3 {font-size:12px;line-height:24px;text-align:left;background-color:#ffffff;color:#000000;}

A:link {color: #000077}
A:visited {color: #000077}
A:hover {color: #ff0000}

A.title1:link {text-decoration:none;color:#000000;}
A.title1:visited {text-decoration:none;color:#000000;}
A.title1:active {text-decoration:none;color:#ff0000;}
A.title1:hover {font-size:13px;text-decoration:none;color:#ff0000;}
-->
</style>
</head>

<body bgcolor=#ffffff topmargin=10>
<form action="<%=linkadminpass%>" method=post name=form1 onsubmit="return checkform()" autocomplete = "off">
<%
if Request.ServerVariables("REQUEST_METHOD")="POST" then
	newname=Request.Form("username")
	realname=Request.Form("realname")
	password=Request.Form("password")
	password2=password
	sqltext2="select * from adminuser where username='"+adminusername+"'"
	rs1.Open sqltext2,cn,1,1
	idd=rs1("id")
	rs1.Close 
				sqltext3="select * from adminuser where id<>"&idd&" and username='"+newname+"'" 
				rs2.Open sqltext3,cn,1,1
				if not rs2.EOF then
						errtxt="用户编号:“"&newname&"”已被别人使用，请换号重试！"
						username=""
						password=""
						password2=""
					else
						sqltext2="select * from adminuser where id="&idd
						rs1.Open sqltext2,cn,1,2
						rs1("username")=newname
						rs1("relname")=realname
						rs1("userpass")=password	
						username=newname
						rs1.Update 
						rs1.Close 
						session("username")=newname
						editok=1
				end if
				rs2.Close 
end if
 %>
 <table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
	<tr><td width=70 height=26><b>用户资料</b></td></tr>
 </table>
 <table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
	<tr bgcolor=666690><td colspan=2><font class=t2>我的资料</font>&nbsp;&nbsp;&nbsp;&nbsp;<%if editok=1 then Response.Write ("<font color=ffff00>（修改成功！）</font>")%></td></tr>
	<tr ><td colspan=3 align=center><font size=3 color="red"><b><%=errtxt%></b></font></td></tr>

	<tr><td width=70 class=td1>用户编号</td>
		<td class=td2><INPUT type="text" value="<%=username%>" name=username maxlength=15 size=20 STYLE="background-color:efefef" readonly><font color=red>*</font>
	<tr><td class=td1>真实姓名</td>
		<td class=td2><INPUT type="text" value="<%=realname%>" name=realname maxlength=12 size=20><font color=red>*</font>
		</td></tr>
	<tr><td class=td1>密码</td>
		<td class=td2><INPUT type="password" value="<%=password%>" name=password maxlength=15 size=15><font color=red>*</font>
		<font class=td3>不分大小写</font>
		</td></tr>
	<tr><td class=td1 bgcolor=ffffff>确认密码</td>
		<td class=td2><INPUT type="password" value="<%=password%>" name=password2 maxlength=15 size=15><font color=red>*</font>
		<font class=td3>请再次输入密码(两次密码需一致)</font>
		</td></tr>
	<tr><td class=td2 bgcolor=ffffff ></td><td class=td2 bgcolor=ffffff align=middle><br>
	&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" name="submit" value="确认提交" onclick="checkinput(form1)">&nbsp;&nbsp;&nbsp;&nbsp;
	</td></tr>
	</table>
</td></tr>
</table>	
</form>
<body>
</html>
<script language=Javascript>
	var flag=true;
	function checkform()
	{
		return flag;
	}
	
	function checkinput(form)
	{

		if(form("username").value=="")
			{alert("请输入用户编号!");form("username").focus();flag=false;return}else{flag=true}	
		if(form("realname").value=="")
			{alert("请输入真实名称!");form("realname").focus();flag=false;return}else{flag=true}

		if(form("password").value=="")
			{alert("密码不能为空!");form("password").focus();flag=false;return}else{flag=true}
		if(form("password2").value!=form("password").value)
			{alert("两次密码不一致!");
			form("password").value="";
			form("password2").value="";
			form("password").focus();flag=false;return}else{flag=true}
			
	}
	
</script>
