<!--#include file="inc/conn.asp"-->
<!--#include file="usercookies.asp"-->
<!--#include file="inc/jle_sub.asp"-->
<!--#include file="inc/jle_fuction.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/function.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=title%>-会员管理中心-修改资料</title>
<link rel="icon" href="<%=web%>/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="<%=web%>/favicon.ico" type="image/x-icon" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
</head>
<SCRIPT language=javascript>
<!--
function CheckForm()
{
if(document.thisForm.username.value.length<1)
	{
	    alert("用户名没有填写!");
	    document.thisForm.username.focus();
	    return false;
	}
if(document.thisForm.password.value.length<6)
	{
	    alert("密码没有填写或小于6位!");
	    document.thisForm.password.focus();
	    return false;
	}
if (document.thisForm.name.value.length == 0) {
		alert("请您填写姓名！");
		document.thisForm.name.focus();
		return false;
	}
	var str="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ,./'[]{}`1234567890-=\~!@#$%^&*()_+|?><:";
	var errorChar
	errorChar = isCharsInBag(thisForm.name.value,str)
	if (errorChar != "" )
	{
		alert('姓名必须是中文！');
		thisForm.name.focus();
		return false;
	} 
function isCharsInBag (s, bag)
{ 
var i,c;
for (i = 0; i < s.length; i++)
{ 
c = s.charAt(i);//字符串s中的字符
if (bag.indexOf(c) > -1) 
return c;
}
return "";
}

if(document.thisForm.name.value.length<2||document.thisForm.name.value.length>4)
	{
	    alert("姓名不能少于2字多于4字！");
        document.thisForm.name.focus();
        document.thisForm.name.select();
	    return false;
	}

if(document.thisForm.dianhua.value.length<7)
	{
	    alert("联系电话没有填写或小于7位数!");
	    document.thisForm.dianhua.focus();
	    return false;
	}
}

//-->
</SCRIPT>
<body>
<%
dim edit,pass2,pass3
edit=Request.form("edit")
pass2=Request.form("pass2")
pass3=Request.form("pass3")
username=request.cookies("jle")("username")
set rs = Server.CreateObject("ADODB.RecordSet")
sql="select * from [user] where username='"&username&"'" 
rs.open sql,conn,1,1
if rs.eof then
response.write "<br>"
response.write "<li>参数错误！"
response.end
end if
%>
<%call top()%><div id="Fmain">


<div id="Uleft">
  <div id=FFTit class=F12bold>会员管理中心</div><div id=FFContent><div Class='FFdiv'>
  <!--#include file=userleft.asp-->
  </div></div></div>
<div id="Uright"> 
  <div id=FFTit class=F12bold>会员管理中心-修改资料</div><div id=FFContent><div Class='FFdiv'>
<%if edit="" then %>
<form method="POST" name="thisForm" action="user_edit.asp">
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="td">
<tr>
<td height="27" width="30%" align="right">
登陆帐号:</td>
<td height="25" width="68%"><font style="font-size: 11pt"> &nbsp;<%=rs("username")%></font></td>
</tr>                                                      
<tr>
<td height="27" width="30%" align="right">
原密码:</td>
<td height="25" width="68%">
&nbsp;<input name="pass1" size="20" value="<%=rs("password")%>" type="password"> 
不修改密码,保留不变</td>
</tr>                                                      
<tr>
<td height="27" width="30%" align="right">
新密码:</td>
<td height="25" width="68%">
&nbsp;<input type="password" name="pass2" size="20"> 
不修改密码,留空</td>
</tr>                                                      
<tr>
<td height="27" width="30%" align="right">
确认新密码:</td>
<td height="25" width="68%">
&nbsp;<input type="password" name="pass3" size="20"> 
不修改密码,留空</td>
</tr>                                                      
<tr>
<td height="23" width="30%" align="right">
<p>姓名:</td>
<td height="23" 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" width="30%" align="right">
<p align="right">邮件地址:</td>
<td height="31" width="68%">
&nbsp;<input type="text" maxlength="30" name="email" size="20" value="<%=rs("email")%>"></td>
</tr>
<tr> 
<td height="27" width="30%">
<p align="right">联系电话:</td>
<td height="25" 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" width="30%" align="right">
QQ:</td>
<td height="25" width="68%">
&nbsp;<input type="text" maxlength="10" name="qq" size="20" value="<%=rs("qq")%>" ></td>
</tr>
<tr> 
<td height="27" width="30%">
<p align="right">通信地址:</td>
<td height="25" width="68%">
&nbsp;<input type="text" maxlength="50" name="dizhi" size="35" value="<%=rs("dizhi")%>" ></td>
</tr>
<tr> 
<td height="50" 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("jle")("username")
name=HtmlEncode(trim(request("name")))
password=trim(request("password"))
email=HtmlEncode(trim(request("email")))
dianhua=HtmlEncode(trim(request("dianhua")))
qq=HtmlEncode(trim(request("qq")))
dizhi=HtmlEncode(trim(request("dizhi")))
chkjle(name)

set rs=server.createobject("adodb.recordset")
sql="select name,email,dianhua,qq,dizhi,zcdata from [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=user_edit.asp"">"
else%>
<%
if pass2<>pass3 then
response.write "<script language=JavaScript>" & chr(13) & "alert('两次密码输入不同，返回重新输入！！');" & "window.location='user_edit.asp'" & "</script>"
response.end
end if
username=request.cookies("jle")("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 [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=user_edit.asp"">"
Response.cookies("jle")=""
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&"]打造吉林最大、最专业的信息发布平台<br>如果您也想建一个这样的本地分类信息网，请联系服务热线:qq:173736282   QQ:173736282"   '邮件内容
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%>
 </div></div></div>
 <br style="clear:both;" />
</div>


<%
call bottom()
%>



</body>
</html>