<!--#include file="inc/conn.asp"-->
<!--#include file=usercookies.asp-->
<!--#include file="config.asp"-->
<!--#include file=inc/ipt.asp-->
<!--#include file=inc/md5.asp-->
<!--#include file=mail.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.Formcome.com.value.length<3)
	{
	    alert("商家/店铺名称没有填写或小于3位!");
	    document.Formcome.com.focus();
        document.Formcome.com.select();
        return false;
	}
if(document.Formcome.comabout.value.length<3)
	{
	    alert("商家/店铺简介没有填写或小于3位!");
	    document.Formcome.comabout.focus();
        document.Formcome.comabout.select();
        return false;
	}

if(document.Formcome.name.value.length<2)
	{
	    alert("商家姓名没有填写或不正确!");
	    return false;
        document.Formcome.name.focus();
        document.Formcome.name.select();
	}
if(document.Formcome.idcard.value.length<1)
	{
	    alert("商家身份证号码没有填写!");
	    return false;
	}
	  var filter=/^\s*[0-9]{15,18}\s*$/;
        if (!filter.test(document.Formcome.idcard.value)) { 
                alert("身份证号码填写不正确,请重新填写！"); 
                document.Formcome.idcard.focus();
                document.Formcome.idcard.select();
                return (false); 
                }  
if(document.Formcome.dianhua.value.length<1)
	{
	    alert("联系电话没有填写!");
	    return false;
	}
if(document.Formcome.email.value.length<1)
	{
	    alert("电子邮箱没有填写!");
	    return false;
	}
        var filter=/^\s*([A-Za-z0-9_-]+(\.\w+)*@(\w+\.)+\w{2,3})\s*$/;
        if (!filter.test(document.Formcome.email.value)) { 
                alert("邮件地址不正确,请重新填写！"); 
                document.Formcome.email.focus();
                document.Formcome.email.select();
                return (false); 
                }  
if(document.Formcome.dizhi.value.length<1)
	{
	    alert("通信地址没有填写!");
	    return false;
	}
}

//-->
</SCRIPT>
<body topmargin="0">
<!--#include file="topcnmai.asp"-->
<%
dim rs,sql,username,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 [com] 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="760"bgcolor="#FFFFFF" style="border-left:1px solid #CCCCCC; border-right:1px solid #CCCCCC; padding:1px; " cellspacing="0" cellpadding="0">
<tr>
<td width="160" height="25" class=td4_muen>
<p align="center">会员管理系统</td>
<td width="1" height="322" rowspan="3">　</td>
<td height="25" class=td2_muen>
<p align="center"><font color=white>会员管理中心-修改资料</font></td>
</tr>
<tr>
<td bgcolor="#F6F6F6" valign="top"><!--#include file=com_userleft.asp--></td>
<td valign="top"><%if edit="" then %><form method="POST" name="Formcome" action="com_usereditzl.asp">
<table width="100%" border="0" cellspacing="0" bordercolor="#FFFFFF" cellpadding="0">
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
登陆帐号：</td>
<td height="26" bgcolor="#F6F6F6" width="68%"><font style="font-size: 11pt"> &nbsp;<%=rs("username")%></font></td>
</tr>                                                      
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
原密码：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
&nbsp;<input name="pass1" size="20" value="<%=rs("password")%>" type="password"> 
不修改密码,保留不变</td>
</tr>                                                      
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
新密码：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="password" name="pass2" size="20"> 
不修改密码,留空</td>
</tr>                                                      
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
确认新密码：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="password" name="pass3" size="20"> 
不修改密码,留空</td>
</tr>                                                      
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
所属行业：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
<%
dim rsc,sqlc,class1
set rsc=server.createobject("adodb.recordset")
sqlc = "select * from class1 order by paixu desc"
rsc.open sqlc,conn,1,1
if rsc.eof and rsc.bof then
response.write "请先添加栏目。"
response.end
else
%>&nbsp;<SELECT name="class1"  size="1">
<OPTION selected value="">类别选择</OPTION>
<%do while not rsc.eof
%><OPTION <%if rsc("id")=rs("class1") then%>selected<%end if%> value="<%=trim(rsc("id"))%>"><%=trim(rsc("class1"))%></OPTION>
<%
        rsc.movenext
        loop
	    end if
        rsc.close
        set rsc=nothing
%></SELECT>
<font color="#FF0000">*</font></td>
</tr>                                                      
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
商家/店铺名称：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="12" name="com" size="24" value="<%=rs("com")%>"></td>
</tr>                                                      
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
商家/店铺简介：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
&nbsp;<textarea rows="8" name="comabout" cols="43"><%=rs("comabout")%></textarea></td>
</tr>                                                      
<tr>
<td height="26" bgcolor="#F6F6F6" width="30%" align="right">
<p>商家姓名：</td>
<td height="26" 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="26" bgcolor="#F6F6F6" width="30%" align="right">
<p align="right">&nbsp;商家身份证：</td>
<td height="26" 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="26" bgcolor="#F6F6F6" width="30%" align="right">
<p align="right">邮件地址：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="30" name="email" size="20" value="<%=rs("email")%>"><font color="#FF0000"> 
*</font>&nbsp;&nbsp; QQ：<input type="text" maxlength="10" name="qq" size="20" value="<%=rs("qq")%>" ></td>
</tr>
<tr> 
<td height="26" bgcolor="#F6F6F6" width="30%">
<p align="right">联系电话：</td>
<td height="26" bgcolor="#F6F6F6" width="68%">
&nbsp;<input type="text" maxlength="24" name="dianhua" size="20" value="<%=rs("dianhua")%>" ><font color="#FF0000"> 
* </font>传真：<input type="text" maxlength="30" name="fax" size="20" value="<%=rs("fax")%>" ></td>
</tr>
<tr> 
<td height="26" bgcolor="#F6F6F6" width="30%">
<p align="right">商家/店铺地址：</td>
<td height="26" 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
dim email,name,idcard,password
username=request.cookies("cnmai")("username")
name=trim(request("name"))
password=trim(request("password"))
email=trim(request("email"))
idcard=trim(request("idcard"))

set rs=server.createobject("adodb.recordset")
sql="select * from [com] where username='"&username&"'"
rs.open sql,conn,1,3
rs("com")=trim(request("com"))
rs("comabout")=trim(request("comabout"))
rs("name")=name
rs("email")=email
rs("idcard")=idcard
rs("dianhua")=trim(request("dianhua"))
rs("fax")=trim(request("fax"))
rs("qq")=trim(request("qq"))
rs("dizhi")=trim(request("dizhi"))
rs.update
rs.close
set rs=nothing
closedb
response.write "<center>用户资料修改成功！！</center>"
response.write "<meta http-equiv=refresh content=""1;URL=com_usereditzl.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"><%
set rs=server.createobject("adodb.recordset")
sql="select password,username,email from [com] 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=com_usereditzl.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&">河南供求信息网</a> 发布供求信息！"   '邮件内容
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="endcnmai.asp"-->
</body>
</html>