<!--#include file="conn.asp"-->
<!--#include file="config.asp"-->
<%
if session("admin")="" then
  response.redirect "admin_login.asp"
end if

'03 联盟作者管理
if not checkflag("03") then
  call mb("对不起，您没有联盟作者管理的权限！","",0)
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>作者管理相关</title>
<link href="admin.css" rel="stylesheet" type="text/css">
</head>

<body bgcolor="#FFFFCE" leftmargin="0" topmargin="0">
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" bgcolor="#000000" vspace="0" hspace="0">
  <tr bgcolor="#EFEBEF"> 
    <td height="27"><table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td width="86%"><font color="#FF3000">.:: 您可以在这里进行[作者管理]相关操作</font></td>
          <td width="14%" height="20" align="center"><a href="javascript:this.location.reload()"><img src="images/refresh.gif" alt="刷新" width="40" height="12" border="0"></a></td>
        </tr>
      </table></td>
  </tr>
  <tr > 
    <td height="1" bgcolor="#000000"></td>
  </tr>
</table>
<%
dim username
username=request("username")
if username="" then
   call mb("请指定要编辑的作者帐号！","",0)
end if

if request("action")="save" then
 dim password,sex,email,question,answer
 dim oicq,icq,msn,homepage,tel,zipcode,address,remark
 dim flashnum,grade,islock
 
 password=checkstr(trim(request.form("password")))
 sex=request.form("sex")
 email=checkstr(trim(request.form("email")))
 question=checkstr(trim(request.form("question")))
 answer=checkstr(trim(request.form("answer")))
 
 oicq=checkstr(trim(request.form("oicq")))
 icq=checkstr(trim(request.form("icq")))
 msn=checkstr(trim(request.form("msn")))
 homepage=checkstr(trim(request.form("homepage")))
 tel=checkstr(trim(request.form("tel")))
 zipcode=checkstr(trim(request.form("zipcode")))
 address=checkstr(trim(request.form("address")))
 remark=checkstr(trim(request.form("remark")))
 flashnum=checkstr(trim(request.form("flashnum")))
 grade=request.form("grade")
 islock=request.form("islock")
 
 '数据检查
 if password="" or strlength(password)>30 then
   call mb("密码不能为空或大于30字长！","",0)
 end if
  
 if sex="" then
   sex="男"
 end if
 
 if not isemail(email) then
   call mb("请正确输入电子邮件地址！","",0)
 end if
 
 if question="" or answer="" then
   call mb("请完整输入密码问题与答案！","",0)
 end if
 
 if not isinteger(flashnum) then
   call mb("请正确输入作者作品数目！","",0)
 end if
 
 if not isinteger(grade) then
   call mb("请选择作者等级！","",0)
 end if
 
 if islock="" then
   islock=true
 end if
 
 '保存数据
 set rs=server.createobject("adodb.recordset")
 sql="select * from author where username='"&username&"'"
 rs.open sql,conn,1,3
 
 if not(rs.bof and rs.eof) then
   rs("password")=password
   rs("sex")=sex
   rs("email")=email
   rs("question")=question
   rs("answer")=answer
   rs("oicq")=oicq
   rs("icq")=icq
   rs("msn")=msn
   rs("tel")=tel
   rs("homepage")=homepage
   rs("zipcode")=zipcode
   rs("address")=address
   rs("remark")=remark
   rs("flashnum")=flashnum
   rs("grade")=grade
   rs("islock")=islock
   rs.update
 else
   call mb("对不起，找不到要编辑的作者帐号！","",0)
 end if
 rs.close
 set rs=nothing 
 call mb("编辑作者资料成功！","admin_author.asp",1)
else
 set rs=conn.execute("select * from author where username='"&username&"'")
 if rs.bof and rs.eof then
  call mb("对不起，找不到您要编辑的作者信息","",0)
else
%>
<form action="?action=save" method="post" name="edit" id="edit">
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
    <tr align="center" bgcolor="#EFEBEF" > 
      <td height="25" colspan="2"><font color="#000000">作 者 资 料 - 资料修改</font></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="122" height="25" align="center">帐　　号：</td>
      <td width="378" height="25">&nbsp;&nbsp;<b><%=username%></b></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">密　　码：</td>
      <td height="25">&nbsp; 
        <input name="password" type="password" class="input" id="password" value="<%=rs("password")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">性　　别：</td>
      <td height="25">&nbsp; 
        <input name="sex" type="radio" value="男" <%if rs("sex")="男" then response.write " checked"%>>
        阳光男孩　 
        <input type="radio" name="sex" value="女" <%if rs("sex")="女" then response.write " checked"%>>
        青春女孩 </td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">电子邮件：</td>
      <td height="25">&nbsp; 
        <input name="email" type="text" class="input" id="email" value="<%=rs("email")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">密码问题：</td>
      <td height="25">&nbsp; 
        <input name="question" type="text" class="input" id="question" value="<%=rs("question")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">密码答案：</td>
      <td height="25"> &nbsp; 
        <input name="answer" type="text" class="input" id="answer" value="<%=rs("answer")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" colspan="2" align="center">以下为可选项</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">Oicq：</td>
      <td height="25"> &nbsp; 
        <input name="oicq" type="text" class="input" id="oicq" value="<%=rs("oicq")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">Icq：</td>
      <td height="25">&nbsp; 
        <input name="icq" type="text" class="input" id="icq" value="<%=rs("icq")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">Msn：</td>
      <td height="25">&nbsp; 
        <input name="msn" type="text" class="input" id="msn" value="<%=rs("msn")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">个人主页：</td>
      <td height="25">&nbsp; 
        <input name="homepage" type="text" class="input" id="homepage" value="<%=rs("homepage")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">联系电话：</td>
      <td height="25">&nbsp; 
        <input name="tel" type="text" class="input" id="tel" value="<%=rs("tel")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">邮政编码：</td>
      <td height="25">&nbsp; 
        <input name="zipcode" type="text" class="input" id="zipcode" value="<%=rs("zipcode")%>" size="30"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">详细地址：</td>
      <td height="25">&nbsp; 
        <input name="address" type="text" class="input" id="address" value="<%=rs("address")%>" size="40"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">个人简介：</td>
      <td height="25">&nbsp; 
        <textarea name="remark" cols="40" rows="10" class="input" id="remark"><%=rs("remark")%></textarea></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">作品数目：</td>
      <td height="25">&nbsp; 
        <input name="flashnum" type="text" class="input" id="flashnum" value="<%=rs("flashnum")%>" size="10">
        　一个整数</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="26" align="center">作者级别：</td>
      <td height="26">&nbsp; 
        <select name="grade" size="1" class="input" id="grade">
          <%dim rsg,sel
		 set rsg=conn.execute("select * from grade")
		  if rsg.bof and rsg.eof then
		    response.write "<option value='' selected>请先添加级别</option>"
	      else
		   do until rsg.eof
		     if rs("grade")=rsg("grade") then
			   sel=" selected"
			 else
			   sel=""
			 end if
		     response.write "<option value='"&rsg("grade")&"' "&sel&">"&rsg("gradename")&"</option>"
		   rsg.movenext
		   loop
		  end if
		  rsg.close
		  set rsg=nothing
		%>
        </select></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" align="center">是否锁定：</td>
      <td height="25">&nbsp; 
        <input type="radio" name="islock" value="true" <%if rs("islock") then response.write " checked"%>>
        锁定用户　 
        <input type="radio" name="islock" value="false" <%if not rs("islock") then response.write " checked"%>>
        正常状态</td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td height="25" colspan="2" align="center"> 
        <input name="Submit" type="submit" class="button" value=" 修 改 ">
        　 
        <input name="Submit2" type="reset" class="button" value=" 清 除 "> <input name="username" type="hidden" id="username" value="<%=username%>"></td>
    </tr>
  </table>
  <br>
</form>
<%
 end if
end if
%>
</body>
</html>
