<% Option Explicit %>
<!--#include file="../../Inc/Const.asp" -->
<!--#include file="../../Inc/Cls_DB.asp" -->
<!--#include file="../../Inc/Md5.asp" -->
<%
Dim DBC,Conn
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="../../Inc/Session.asp" -->
<!--#include file="../../Inc/CheckPopedom.asp" -->
<%
if Not JudgePopedomTF(Session("Name"),"P0803") then Call ReturnError()
	Dim UserIDP,UserModifyObj,TempUserName
	UserIDP = Request("ID")
	Set UserModifyObj = Conn.Execute("Select * from Members where ID="&Clng(UserIDP)&"")
	If UserModifyObj.eof then
		Response.Write("<script>alert(""参数传递错误"");window.close();</script>")
		Response.End
	End If
	TempUserName = UserModifyObj("MemName")
%>
<html>
<head>
<link href="../Inc/ModeWindow.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改会员信息</title>
</head>

<body leftmargin="0" topmargin="0">
<form action="" method="post" name="UserAddSForm">
<table width="100%"  border="0" cellspacing="5" cellpadding="0">
  <tr>
    <td height="10" colspan="5"></td>
    </tr>
  <tr>
    <td width="3%">&nbsp;</td>
    <td width="9%">会&nbsp;员&nbsp;名</td>
    <td width="37%"><input name="MemName" type="text" id="MemName" style="width:90%" value="<%=UserModifyObj("MemName")%>"></td>
    <td width="12%">会&nbsp;员&nbsp;组</td>
    <td width="39%"><select name="GroupID" id="GroupID" style="width:90%">
      <option value="0" <%If UserModifyObj("GroupID") = "" or  UserModifyObj("GroupID") = "0" then Response.Write("selected") end if%>> </option>
      <%
		Dim SelGroupObj
		Set SelGroupObj = Conn.Execute("Select GroupID,Name from MemGroup order by PopLevel desc")
		do while not SelGroupObj.eof 
	%>
      <option value="<%=SelGroupObj("GroupID")%>" <%If Cstr(UserModifyObj("GroupID"))=Cstr(SelGroupObj("GroupID")) then Response.Write("selected") end if%>><%=SelGroupObj("Name")%></option>
      <%
		SelGroupObj.MoveNext
		Loop
		SelGroupObj.Close
		Set SelGroupObj = Nothing
	%>
    </select></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>密&nbsp;&nbsp;&nbsp;&nbsp;码</td>
    <td><input name="Password" type="password" id="Password" style="width:90%"></td>
    <td>确认密码</td>
    <td><input name="PasswordTF" type="password" id="PasswordTF2" style="width:90%"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>真实姓名</td>
    <td><input name="Name" type="text" id="Name2" style="width:90%" value="<%=UserModifyObj("Name")%>"></td>
    <td>电话号码</td>
    <td><input name="Telephone" type="text" id="Telephone2" style="width:90%" value="<%=UserModifyObj("Telephone")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>E_Mail</td>
    <td><input name="Email" type="text" id="Email2" style="width:90%" value="<%=UserModifyObj("Email")%>"></td>
    <td>OICQ</td>
    <td><input name="Oicq" type="text" id="Oicq2" style="width:90%" value="<%=UserModifyObj("Oicq")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>MSN</td>
    <td><input name="MSN" type="text" id="MSN2" style="width:90%" value="<%=UserModifyObj("MSN")%>"></td>
    <td>个人主页</td>
    <td><input name="HomePage" type="text" id="HomePage2" style="width:90%" value="<%=UserModifyObj("HomePage")%>"></td>
  </tr>
  <tr>
    <td><div align="center">
      </div></td>
    <td>地&nbsp;&nbsp;&nbsp;&nbsp;址</td>
    <td><input name="Address" type="text" id="Address2" style="width:90%" value="<%=UserModifyObj("Address")%>"></td>
    <td>区域国家</td>
    <td><input name="Corner" type="text" id="Corner2" style="width:90%" value="<%=UserModifyObj("Corner")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>省&nbsp;&nbsp;&nbsp;&nbsp;份</td>
    <td><input name="Province" type="text" id="Province2" style="width:90%" value="<%=UserModifyObj("Province")%>"></td>
    <td>城&nbsp;&nbsp;&nbsp;&nbsp;市</td>
    <td><input name="City" type="text" id="City2" style="width:90%" value="<%=UserModifyObj("City")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>职&nbsp;&nbsp;&nbsp;&nbsp;业</td>
    <td><input name="Vocation" type="text" id="Vocation2" style="width:90%" value="<%=UserModifyObj("Vocation")%>"></td>
    <td>学&nbsp;&nbsp;&nbsp;&nbsp;历</td>
    <td><input name="EduLevel" type="text" id="EduLevel2" style="width:90%" value="<%=UserModifyObj("EduLevel")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>登录次数</td>
    <td><input name="LoginNum" type="text" id="LoginNum2" style="width:90%" value="<%=UserModifyObj("LoginNum")%>"></td>
    <td>积&nbsp;&nbsp;&nbsp;&nbsp;分</td>
    <td><input name="Point" type="text" id="Point2" style="width:90%" value="<%=UserModifyObj("Point")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>密码提示</td>
    <td><input name="PassQuestion" type="text" id="PassQuestion2" style="width:90%" value="<%=UserModifyObj("PassQuestion")%>"></td>
    <td>问题答案</td>
    <td><input name="PassAnswer" type="text" id="PassAnswer2" style="width:90%" value="<%=UserModifyObj("PassAnswer")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>介 绍 人</td>
    <td><input name="AddUser" type="text" id="AddUser2" style="width:90%" value="<%=UserModifyObj("AddUser")%>"></td>
    <td>头像图片</td>
    <td><input name="HeadPic" type="text" id="HeadPic2" style="width:90%" value="<%=UserModifyObj("HeadPic")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>签&nbsp;&nbsp;&nbsp;&nbsp;名</td>
    <td><input name="UnderWrite" type="text" id="UnderWrite2" style="width:90%" value="<%=UserModifyObj("UnderWrite")%>"></td>
    <td>生&nbsp;&nbsp;&nbsp;&nbsp;日</td>
    <td><input name="Birthday" type="text" id="Birthday2" style="width:90%" value="<%=UserModifyObj("Birthday")%>"></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>最后登录</td>
    <td><input name="LastLoginIP" type="text" id="LastLoginIP2" style="width:90%" value="<%=UserModifyObj("LastLoginIP")%>" readonly></td>
    <td>登录时间</td>
    <td><input name="LastLoginTime" type="text" id="LastLoginTime2" style="width:90%" value="<%=UserModifyObj("LastLoginTime")%>" readonly></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>锁&nbsp;&nbsp;&nbsp;&nbsp;定</td>
    <td><input type="radio" name="Lock" value="1" <%If UserModifyObj("Lock") = "1" then Response.Write("checked") end if%>>
是
  <input name="Lock" type="radio" value="0" <%If UserModifyObj("Lock") = "0" or UserModifyObj("Lock") = "" then Response.Write("checked") end if%>>
否</td>
    <td>性&nbsp;&nbsp;&nbsp;&nbsp;别</td>
    <td><input name="Sex" type="radio" value="0" <%If UserModifyObj("Sex") = "0" or UserModifyObj("Sex") = "" then Response.Write("checked") end if%>>
男
  <input type="radio" name="Sex" value="1" <%If UserModifyObj("Sex") = "1" then Response.Write("checked") end if%>>
女</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>开放资料</td>
    <td><input name="OpenInfTF" type="radio" value="1" <% if UserModifyObj("OpenInfTF")="1" then Response.Write("checked") end if%>>
是
  <input type="radio" name="OpenInfTF" value="0" <% if UserModifyObj("OpenInfTF")="0" then Response.Write("checked") end if%>>
否</td>
    <td>订阅信息</td>
    <td><input name="SubInfTF" type="radio" value="1" <% if UserModifyObj("SubInfTF")="1" then Response.Write("checked") end if%>>
是
  <input type="radio" name="SubInfTF" value="0" <% if UserModifyObj("SubInfTF")="0" then Response.Write("checked") end if%>>
否</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>个人介绍</td>
    <td colspan="3"><textarea name="SelfIntro" id="SelfIntro" style="width:90%"><%=UserModifyObj("SelfIntro")%></textarea></td>
    </tr>
  <tr>
    <td height="10" colspan="5"></td>
  </tr>
  <tr>
    <td colspan="5"><div align="center">
        <input type="submit" name="Submit" value=" 修 改 ">
        <input name="action" type="hidden" id="action" value="mod">
&nbsp;&nbsp;
<input type="reset" name="Submit3" value=" 还 原 ">
&nbsp;&nbsp;&nbsp;
  <input type="button" name="Submit2" value=" 取 消 " onClick="window.close();">
    </div></td>
  </tr>
</table>
</form>
</body>
</html>
<%
If  Request.Form("action") = "mod" then
    Dim UserAddObj,UserAddSql,ChooseMemNameObj,MemNameStr
	If Request.Form("MemName")="" or isnull(Request.Form("MemName")) then
		Response.Write("<script>alert(""请填写会员登录名"");</script>")
		Response.End
	Else
		MemNameStr = Replace(Replace(Request.Form("MemName"),"""",""),"'","")
	End If
	Set ChooseMemNameObj = Conn.Execute("Select count(ID) from Members where MemName='"&MemNameStr&"'")
	If Cstr(UserModifyObj("MemName"))=Cstr(MemNameStr) and ChooseMemNameObj(0)>1 then
		Response.Write("<script>alert(""此会员登录名已经存在,请修改"");</script>")
		Response.End
	Elseif Cstr(UserModifyObj("MemName"))<>Cstr(MemNameStr) and ChooseMemNameObj(0)<>0 then
		Response.Write("<script>alert(""此会员登录名已经存在,请修改"");</script>")
		Response.End
	End If
	ChooseMemNameObj.Close
	Set ChooseMemNameObj = Nothing
	If Request.Form("Password")<>"" and Cstr(Request.Form("Password"))<>Cstr(Request.Form("PasswordTF")) then
		Response.Write("<script>alert(""密码与确认密码不同"");</script>")
		Response.End
	End If
	If Request.Form("Name")="" or isnull(Request.Form("Name")) then
		Response.Write("<script>alert(""请填写会员真实姓名"");</script>")
		Response.End
	End If
	Set UserAddObj = Server.CreateObject("Adodb.RecordSet")
		UserAddSql = "Select * from Members where ID="&UserIDP&""
		UserAddObj.Open UserAddSql,Conn,3,3
		UserAddObj("MemName") = Replace(Replace(Request.Form("MemName"),"""",""),"'","")
		If Request.Form("Password")<>"" then
			UserAddObj("Password") = md5(Request.Form("Password"),16)
		End If
		UserAddObj("GroupID") = Request.Form("GroupID")
		UserAddObj("Name") = Replace(Replace(Request.Form("Name"),"""",""),"'","")
		UserAddObj("Email") = Request.Form("Email")
		UserAddObj("Telephone") = Request.Form("Telephone")
		UserAddObj("Oicq") = Request.Form("Oicq")
		UserAddObj("HomePage") = Request.Form("HomePage")
		UserAddObj("LoginNum") = Request.Form("LoginNum")
		UserAddObj("Address") = Request.Form("Address")
		UserAddObj("SelfIntro") = Request.Form("SelfIntro")
		UserAddObj("AddUser") = Request.Form("AddUser")
		if Request.Form("Point") <> "" then
			UserAddObj("Point") = Request.Form("Point")
		end if
		UserAddObj("HeadPic") = Request.Form("HeadPic")
		If Request.Form("Birthday")<>"" then
			UserAddObj("Birthday") = Request.Form("Birthday")
		End If
		UserAddObj("MSN") = Request.Form("MSN")
		UserAddObj("Corner") = Request.Form("Corner")
		UserAddObj("Province") = Request.Form("Province")
		UserAddObj("City") = Request.Form("City")
		UserAddObj("Vocation") = Request.Form("Vocation")
		UserAddObj("EduLevel") = Request.Form("EduLevel")
		If Request.Form("OpenInfTF") = "0" then
			UserAddObj("OpenInfTF") = "0"
		Else
			UserAddObj("OpenInfTF") = "1"
		End If
		If Request.Form("SubInfTF") = "0" then
			UserAddObj("SubInfTF") = "0"
		Else
			UserAddObj("SubInfTF") = "1"
		End If
		UserAddObj("PassQuestion") = Request.Form("PassQuestion")
		UserAddObj("PassAnswer") = Request.Form("PassAnswer")
		UserAddObj("UnderWrite") = Request.Form("UnderWrite")
		If Request.Form("Lock") = "0" then
			UserAddObj("Lock") = "0"
		Else
			UserAddObj("Lock") = "1"
		End If
		If Request.Form("Sex") = "0" then
			UserAddObj("Sex") = "0"
		Else
			UserAddObj("Sex") = "1"
		End If
		UserAddObj.Update
		UserAddObj.Close
		Set UserAddObj = Nothing
		If Cstr(TempUserName) <> Cstr(Replace(Replace(Request.Form("MemName"),"""",""),"'","")) then
			Conn.Execute("Update Message set MeRead='"&Replace(Replace(Request.Form("MemName"),"""",""),"'","")&"' where MeRead='"&TempUserName&"'")
		End If
		Response.Write("<script>alert(""会员修改成功"");dialogArguments.location.reload();window.close();</script>")
		Response.End
End If
%>