<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="admin.asp"-->
<!--#include file="../inc/conn.asp"-->
<!--#include file="../inc/function.asp"-->
<!--#include file="../inc/md5.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-Type" content="text/html; charset=gb2312" />
<title>用户信息 - <%=cf_name%></title>
<link href="images/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="images/us.js"></script>
</head>

<body>
<!--#include file="top.asp"-->
<div class="con bian">
   <div class="bd_l"><!--#include file="left.asp"--></div>
   <div class="bd_r">
      <div class="title">联系方式</div>
	  <%
'//修改
if request("action")=2 then
set rs=server.CreateObject("adodb.recordset")
sql="select * from cw_user where id="&request("id")&""
rs.open sql,conn,1,3
rs("names")=trim(request("names"))
rs("tel")=trim(request("tel"))
rs("qq")=trim(request("qq"))
rs("address")=trim(request("address"))
rs.update
rs.close
set rs=nothing
response.Write("<div class='msg'><h1 class='msg_t'>恭喜您，资料修改成功！</h1></div>")  
response.Write("<script>var url='cw_pro.asp'; setTimeout('location.href=(url)',2000)</script>")
response.End()
end if

if request("action")=1 then
set rs=server.CreateObject("adodb.recordset")
sql="select * from cw_user where id="&request("id")&""
rs.open sql,conn,1,3
if md5(trim(request("pass1")))<>rs("pass") then
   response.Write("<script>alert('原密码错误！');history.back();</script>")
   response.End()
else
   rs("pass")=md5(trim(request("pass3")))
end if
rs.update
rs.close
set rs=nothing
response.Write("<div class='msg'><h1 class='msg_t'>恭喜您，密码修改成功！</h1></div>")  
response.Write("<script>var url='cw_pro.asp?act=1'; setTimeout('location.href=(url)',2000)</script>")
response.End()
end if

if request("act")="" then
set rr=server.CreateObject("adodb.recordset")
rq="select * from cw_user where id="&session("userid")
rr.open rq,conn,1,1
if rr("id")<>session("userid") then response.write("<script>alert('非法操作！');parent.admin()</script>")
%>
<table width="99%" border="0">
<form method="post" name="form1" action="cw_pro.asp?action=2" onsubmit="return Check_pro(this)">  
  <tr>
    <td width="100" height="20" align="right">联系姓名：</td>
    <td width="412"><input name="names" type="text" id="names" value="<%=rr("names")%>" maxlength="100" /></td>
    <td width="233" rowspan="5" align="center"><img src="<%=rr("pic")%>" width="100" height="100" /><br />
      <br />
      头像(100*100像素)</td>
  </tr>
  <tr>
    <td height="20" align="right">联系电话：</td>
    <td><input name="tel" type="text" id="tel" value="<%=rr("tel")%>" maxlength="30" /></td>
    </tr>
  <tr>
    <td height="20" align="right">联系 Q Q：</td>
    <td><input name="qq" type="text" id="qq" value="<%=rr("qq")%>" maxlength="11" /></td>
    </tr>  
  <tr>
    <td height="20" align="right">联系地址：</td>
    <td><input name="address" type="text" id="address" value="<%=rr("address")%>" size="50" /></td>
  </tr>
  <tr>
    <td height="20" align="right">&nbsp;</td>
    <td><input type="submit" name="Submit3" value="提交修改" class="btn" />
      <input name="id" type="hidden" id="id" value="<%=session("userid")%>" /></td>
    </tr>
  </form>
</table>
  <%
  rr.close
  set rr=nothing
  else
  %>
  <table width="99%" border="0">
<form method="post" name="form1" action="cw_pro.asp?action=1" onsubmit="return Check_edpass(this)">  
  <tr>
    <td width="100" height="20" align="right">原密码：</td>
    <td width="662"><input name="pass1" type="password" id="pass1" maxlength="100" /></td>
  </tr>
  <tr>
    <td height="20" align="right">新密码：</td>
    <td><input name="pass2" type="password" id="pass2" maxlength="30" /></td>
  </tr>
  <tr>
    <td height="20" align="right">确认密码：</td>
    <td><input name="pass3" type="password" id="pass3" maxlength="11" /></td>
  </tr>
  <tr>
    <td height="20" align="right">&nbsp;</td>
    <td><input type="submit" name="Submit3" value="修改密码" class="btn"  />
      <input name="id" type="hidden" id="id" value="<%=session("userid")%>" /></td>
  </tr>
  </form>
</table>
<%end if%>

   </div>
   <div class="clear"></div>
</div>
<div class="line"></div>
<!--#include file="foot.asp"-->
<%call closes()%>
</body>
</html>
