<!--#include file="conn.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="bbsuser.asp"-->
<%
userid=request.cookies("clubuser_id")
id=request("id")
if request.form("haoyouname")<>"" then
   dim haoyouname,gn,msg
   haoyouname=CheckStr(trim(request.form("haoyouname")))
   gn=CheckStr(request.form("gn"))
   str="select top 1 clubuser_name from clubuser where clubuser_name='"& haoyouname &"'"
   set rs=server.createobject("adodb.recordset")
   rs.open str,conn,1,1
   if not rs.eof then
      sql="select top 1 * from haoyou where haoyouname='"& haoyouname & "' and id="& id &" and userid="&userid
      set rs1=server.createobject("adodb.recordset")
      rs1.open sql,conn,1,3
	  rs1("userid")=userid
	  rs1("haoyouname")=haoyouname
	  if gn="创建新分组" or isNull(gn) or gn="" then
	  rs1("groupname")="我的好友"
	  else
	  rs1("groupname")=gn
	  end if
	  rs1("sign")=0
	  rs1.update
	  rs1.close
      msg="(<font color=red>好友修改成功!</font>)"
   else
    msg="(<font color=red>你所添加的用户名不存在!</font>)"
   end if
   rs.close
end if
sql="select top 1 * from haoyou where id="&id
set rs1=server.createobject("adodb.recordset")
rs1.open sql,conn,1,3
%>
<!--#include file="memberinfo.asp" -->
<html><head><meta http-equiv=content-type content="text/html; charset=gb2312">
</head>
<script language="javascript">
<!--
   function checkClick(obj){
    if(obj.checked){
 	  document.f.gn.disabled = false;
 	  document.f.gn.focus();
 	  document.f.gn.value="<%=rs1("groupname")%>";
 	}else{
 	  document.f.gn.value="创建新分组";
 	  document.f.gn.disabled = true;	
     }
    }
	function f_submit(form)
	{
    if (form.haoyouname.value=="")
    	{
    	 alert("请填写好友的用户名！");
    	 form.haoyouname.focus();
    	 return false;
  	}
     return true;
	}
//-->
</script>
<body>
<center>
<title>编辑好友</title>
<link rel="stylesheet" type="text/css" href="<%=cssfile%>">
<!--#include file="usernav.asp" -->
<!--#include file="haoyouhead.asp" -->
<div class="stage">
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="layout">
<tr>
<td width="22%" valign="top" class="c2t3">
<div id="mod_profile" class="mod" rel="drag">
<!--#include file="usercalog.asp" -->
</div>
</td>
<td width="78%" valign="top" class="c2t1">
<div id="m_blog" class="modbox"><br>
              <br>
              <br>
              <br>
              <table width="80%" border="0" align="center">
                <form name="f" method=post action="" onsubmit="return f_submit(this)">
                  <tr> 
                    <td height="30"><div align="center"></div></td>
                    <td height="30" class="f14"><strong>编辑好友<%=msg%></strong></td>
                  </tr>
                  <tr> 
                    <td width="27%" height="35" align="right">用户名：</td>
                    <td width="73%"> 
                      <input name="haoyouname" type="text" id="haoyouname" value="<%=rs1("haoyouname")%>"></td>
                  </tr>
                  <tr> 
                    <td height="35" align="right">选择分组：</td>
                    <td><input type="checkbox" name="xn" onclick="checkClick(this)">
					<input name="gn" type="text" disabled value="创建新分组" size="17">
                      <input name="id" type="hidden" id="id" value="<%=id%>"></td>
                  </tr>
                  <tr> 
                    <td height="40"></td>
                    <td><input type="submit" name="Submit" value="确认修改"></td>
                  </tr>
                </form>
              </table>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
              <br>
            </div>
</td>
</tr></table>
</div>
</div>
<br><center>
    <!--#include file="tail.asp" -->
  </center>
</center>
</body>
</html>
<%closedb%>