<!--#include file="inc/conn.asp"-->
<!--#include file="usercookies.asp"-->
<!--#include file="inc/inc.asp"-->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=title%>-会员管理中心-修改资料</title>
</head>
<SCRIPT language=javascript>
<!--
function CheckForm()
{
if(document.thisForm.username.value.length<1)
	{
	    alert("参数错误!");
	    return false;
	}
if(document.thisForm.password.value.length<1)
	{
	    alert("参数错误!");
	    return false;
	}
if(document.thisForm.name.value.length<1)
	{
	    alert("真实姓名没有填写!");
	    return false;
	}
if(document.thisForm.idcard.value.length<1)
	{
	    alert("身份证号码没有填写!");
	    return false;
	}
if(document.thisForm.dianhua.value.length<1)
	{
	    alert("联系电话没有填写!");
	    return false;
	}
}

//-->
</SCRIPT>
<body topmargin="0">
<%call t()%>
<%
dim edit,pass2,pass3
edit=Request.form("edit")
pass2=Request.form("pass2")
pass3=Request.form("pass3")
username=request.cookies("cnmai")("username")
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [jle_user] where username='"&username&"'" 
rs.open sql,conn,1,1
if rs.eof then
response.write "<br>"
response.write "<li>参数错误！"
response.end
end if
%>
<div align="center">
<table width="755"bgcolor="#FFFFFF" style="border-left:1px solid #999999; border-right:1px solid #999999; padding:1px; " cellspacing="0" cellpadding="0">
<tr>
<td width="160" height="25" class=td1>
<p align="center">会员管理系统</td>
<td width="1" height="322" rowspan="3">　</td>
<td height="25" class=td1>
<p align="center">会员管理中心</font>-修改资料</td>
</tr>
<tr>
<td bgcolor="#F6F6F6" valign="top"><!--#include file=userleft.asp--></td>
<td valign="top"><%if edit="" then %><form method="POST" name="thisForm" action="u_editzl.asp">
<table width="100%" border="0" cellspacing="0" bordercolor="#FFFFFF" cellpadding="0">
<tr>
<td height="27" bgcolor="#F6F6F6" width="30%" align="right">
登陆帐号:</td>
<td height="25" bgcolor="#F6F6F6" width="68%"><font style="font-size: 11pt"> &nbsp;<%=rs("username")%></font></td>
</tr>                                                      
<tr>
<td height="27" bgcolor="#F6F6F6" width="30%" align="right">
原密码:</td>
<td height="25" bgcolor="#F6F6F6" width="68%">
&nbsp;<input name="pass1" size="20" value="<%=rs("password")%>" type="password"> 
不修改密码,保留不变</td>
</tr>                                                      
<tr>
<td height="27" bgcolor="#F6F6F6" width="30%" align="right">
新密码:</td>
<td height="25" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="password" name="pass2" size="20"> 
不修改密码,留空</td>
</tr>                                                      
<tr>
<td height="27" bgcolor="#F6F6F6" width="30%" align="right">
确认新密码:</td>
<td height="25" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="password" name="pass3" size="20"> 
不修改密码,留空</td>
</tr>                                                      
<tr>
<td height="23" bgcolor="#F6F6F6" width="30%" align="right">
<p>姓名:</td>
<td height="23" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="12" name="name" size="20" value="<%=rs("name")%>"><font color="#FF0000"> 
*</font></td>
</tr>                                                      
<tr> 
<td height="31" bgcolor="#F6F6F6" width="30%" align="right">
<p align="right">邮件地址:</td>
<td height="31" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="30" name="email" size="20" value="<%=rs("email")%>"></td>
</tr>
<tr> 
<td height="27" bgcolor="#F6F6F6" width="30%" align="right">
<p align="right">&nbsp; 身份证:</td>
<td height="25" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="18" name="idcard" size="20" value="<%=rs("idcard")%>" ><font color="#FF0000"> 
*</font></td>
</tr>
<tr> 
<td height="27" bgcolor="#F6F6F6" width="30%">
<p align="right">联系电话:</td>
<td height="25" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="24" name="dianhua" size="20" value="<%=rs("dianhua")%>" ><font color="#FF0000"> 
*</font></td>
</tr>
<tr> 
<td height="27" bgcolor="#F6F6F6" width="30%" align="right">
QQ:</td>
<td height="25" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="10" name="qq" size="20" value="<%=rs("qq")%>" ></td>
</tr>
<tr> 
<td height="27" bgcolor="#F6F6F6" width="30%">
<p align="right">通信地址:</td>
<td height="25" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="50" name="dizhi" size="35" value="<%=rs("dizhi")%>" ></td>
</tr>
<tr> 
<td height="50" bgcolor="#F3FDEA" colspan="2">
<p align="center">
<input type="submit" onclick="javascript:return CheckForm();" value="提交修改" name="edit"></td>
</tr>                                     
</table>
</form>
<%else 
if pass2="" or pass3="" then
username=request.cookies("cnmai")("username")
name=trim(request("name"))
password=trim(request("password"))
email=trim(request("email"))
idcard=trim(request("idcard"))
dianhua=trim(request("dianhua"))
qq=trim(request("qq"))
dizhi=trim(request("dizhi"))
'chkcnmai(name)
if not isnumeric(idcard) or len(idcard)<15 or len(idcard)>18 then
call errcnmai(6)
response.end
end if
set rs=server.createobject("adodb.recordset")
sql="select name,email,idcard,dianhua,qq,dizhi,zcdata from [jle_user] where username='"&username&"'"
rs.open sql,conn,1,3
rs("name")=name
rs("email")=email
rs("idcard")=idcard
rs("dianhua")=dianhua
rs("qq")=qq
rs("dizhi")=dizhi
rs("zcdata")=now()
rs.update
rs.close
set rs=nothing
closedb
response.write "<center>用户资料修改成功！！</center>"
response.write "<meta http-equiv=refresh content=""1;URL=u_editzl.asp"">"
else%>
<%
if pass2<>pass3 then
response.write "<script language=JavaScript>" & chr(13) & "alert('两次密码输入不同，返回重新输入！！');" & "window.location='usereditzl.asp'" & "</script>"
response.end
end if
username=request.cookies("cnmai")("username")
%>
<table border="0" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" width="582">
<tr>
<td valign="top" align="center" bgcolor="#FFFFFF">
<p align="left"><%
set rs=server.createobject("adodb.recordset")
sql="select password,username,email from [jle_user] where username='"&username&"'"
rs.open sql,conn,1,3
username=trim(rs("username"))
email=trim(rs("email"))
rs("password")=md5(pass2)
rs.update
response.write "<li>修改密码成功，同时我们已经将您的新密码发送到|<b>"&email&"</b>|，请保管好您的新密码！"
call mail()
response.write "<meta http-equiv=refresh content=""1;URL=u_editzl.asp"">"
Response.cookies("cnmai")=""
rs.close
set rs=nothing
closedb
%></td></tr></table><%
sub mail()
dim mailbody,Jmail
mailbody="您好,"&username&"!<br>您已成功修改了密码！现在资料为：登陆帐号：[<b>"&username&"</b>] 您的新密码是：[<b>"&pass2&"</b>]<br> 欢迎登陆<a target=_blank  href="&web&">"&title&""&web&"</a> 发布您的二手信息！<br>感谢您使用我们<a target=_blank  href="&web&">"&title&"</a>为您提供的真诚服务！<br>["&title&"]打造全国最大、最专业的二手信息发布平台"   '邮件内容
Set Jmail=server.createobject("Jmail.Message")
Jmail.Charset ="gb2312"
JMail.ContentType = "text/html"
Jmail.Silent =true
Jmail.Priority = 3
Jmail.MailServerUserName = mailname
Jmail.MailServerPassword = mailpass
Jmail.From = mailform
Jmail.FromName =""&title&""
Jmail.Subject ="密码修改成功！-"&title&""
Jmail.AddRecipient ""&email&""
Jmail.Body = mailbody
Jmail.Send(mailsmtp)
Set Jmail=nothing
end sub
%><%
end if
end if%></td></tr></table>
</div>
<!--#include file="foot.asp"-->
</body>
</html>