<!--#include file="function.asp"-->
<!--#include file="md5.asp"-->
<%
checkLogin()

header("基本信息 &gt; 管理员设置")
select case Request.QueryString("action")
case "submit"

	m_id=request.Form("m_id")
	m_user=request.Form("m_user")
	m_pass=request.Form("m_pass")
	m_realname=request.Form("m_realname")
	m_tel=request.Form("m_tel")
	m_email=request.Form("m_email")
	m_qq=request.Form("m_qq")
	
	if m_user="" then
	response.Write ErrMsg("请输入用户名")
	elseif m_realname="" then
	response.Write ErrMsg("请输入真实姓名")
	end if
	
	set rs=server.CreateObject("adodb.recordset")
	rs.open "select * from p3t_manage where m_id="&m_id,conn,1,3
	if rs.eof then
	rs.addnew
	end if
	rs("m_user")=m_user
	if m_pass<>"" then
		rs("m_pass")=md5(m_pass)
	end if
	rs("m_realname")=m_realname
	rs("m_tel")=m_tel
	rs("m_email")=m_email
	rs("m_qq")=m_qq
	rs.update
	rs.close
	set rs=nothing
	
	p3t "<script>alert('操作成功');parent.location.reload();</script>"
	p3t_end
case else
	call main_()
end select
footer()

sub main_()
%>
<div class="main_body">
	<table cellspacing="1">
    <form name="form1" action="?action=submit" method="post" target="yukiiak">
      <tr>
        <th colspan="2" class="left">管理员设置</th>
      </tr>
    <%
	set rs=conn.execute("select * from p3t_manage where m_id="&session("m_id"))
	if not rs.eof then
	%>
      <tr>
        <td width="100" class="right">用户名</td>
        <td><input type="text" name="m_user" class="input" size="40" value="<%=rs("m_user")%>" /></td>
      </tr>
      <tr>
        <td class="right">密码</td>
        <td><input type="password" name="m_pass" class="input" size="40" /> 不修改请留空</td>
      </tr>
      <tr>
        <td class="right">姓名</td>
        <td><input type="text" name="m_realname" class="input" size="40" value="<%=rs("m_realname")%>" /></td>
      </tr>
      <tr>
        <td class="right">电话</td>
        <td><input type="text" name="m_tel" class="input" size="40" value="<%=rs("m_tel")%>" /></td>
      </tr>
      <tr>
        <td class="right">邮箱</td>
        <td><input type="text" name="m_email" class="input" size="40" value="<%=rs("m_email")%>" /></td>
      </tr>
      <tr>
        <td class="right">QQ</td>
        <td><input type="text" name="m_qq" class="input" size="40" value="<%=rs("m_qq")%>" /></td>
      </tr>
      <tr>
        <td></td>
        <td>
			<input name="m_id" type="hidden" value="<%=rs("m_id")%>">
        	<input type="submit" name="submit" class="button" value=" 提 交 " />
        	<input type="reset" name="reset" class="button" value=" 重 置 " />
        </td>
      </tr>
    <%
	end if
	set rs=nothing
	%>
    </form>
    </table>
</div>
<%
end sub
%>