<!--#include file=conn.asp-->
<!--#include file=config.asp-->
<!--#include file=const.asp-->
<!--#include file=char.asp-->
<%
 '=========================================================
' File: favlist.asp
' Version:3.0
' Date: 2005-11-6
' Script Written by xmrxw
'=========================================================
' Copyright (C) 2004,2005 Xmrxw.Com All rights reserved.
' Web: http://www.xmrxw.com,http://www.xmzxw.com
' Email: info@mssky.com,super@mssky.com
' QQ：10689579　Msn：zdlmicr@hotmail.com
'=========================================================
response.buffer=true
stats="用户收藏夹"
if not founduser then
	Errmsg=Errmsg+"<br>"+"<li>您还没有<a href=login.asp>登陆</a>，不能查看收藏。如果您还没有<a href=reg.asp>注册</a>，请先<a href=reg.asp>注册</a>！"
	Founderr=true
end if
if Cint(GroupSetting(158))<>0 and dateadd("n",Cint(GroupSetting(158)),myjoinDate)>=Now() then
  	errmsg=errmsg+"<br>"+"<li>新注册用户"&Cint(GroupSetting(158))&"分钟后才能使用收藏夹，请稍后<a href=login.asp target=_blank>登录</a>。"
	founderr=true
end if
call nav()
if founderr=true then
	call head_var("","")
	call Mslove_error()
else
	call head_var(membername & "的帐号","mycount.asp")
Dim Groupcount,Group_select,search,Keyword
search=checkStr(Request("search"))
Keyword=checkStr(Request("Keyword"))
strFileName="favlist.asp?action="&request("action")&"&search="&search&"&Keyword="&Keyword&""
'统计会员组个数
sql="select count(GID) from [Ms_BookGroup] where Username='"&membername&"'"
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
Groupcount=rs(0)
else
Groupcount=0
end if
rs.close

'所属组列表
Group_select=Group_select+"<option>请选择...</option>"
Set Rs=conn.Execute("Select GID,GroupName From [Ms_BookGroup] Where Username='"&membername&"'")
	If Not (Rs.eof or Rs.bof) then
	do while not rs.eof
	Group_select=Group_select+"<option value="""&rs(0)&""" >"&rs(1)&"</option>"
	rs.movenext
	loop
	else
	Group_select=Group_select+"<option value="""" >请创建...</option>"
	end if
	rs.close
%>
<table cellpadding=3 cellspacing=1 align=center class=tableborder1>
<tr>
<th width=12% height=25 id=tabletitlelink><a href=mycount.asp>我的帐号</a></th>
<th width=11%  id=tabletitlelink><a href=mymodify.asp>基本资料</a></th>
<th width=11%  id=tabletitlelink><a href=modifypsw.asp>密码修改</a></th>
<th width=11%  id=tabletitlelink><a href=modifyfd.asp>交友资料</a></th>
<th width=11%  id=tabletitlelink><a href=modifyadd.asp>联系资料</a></th>
<th width=11%  id=tabletitlelink><a href=usersms.asp>短信服务</a></th>
<th width=11%  id=tabletitlelink><a href=friendlist.asp>我的好友</a></th>
<th width=11%  id=tabletitlelink><a href=favlist.asp>我的收藏</a></th>
<th width=11%  id=tabletitlelink><a href=userphoto.asp>我的相册</a></th>
</tr>
</table>
<%
call tumppages()
Select Case Trim(Request("action"))
	Case "creat"
		Stats="创建分组"
		Call creat_Group()
	case "addGroup"
		Stats="保存分组"
		Call save_Group()
	Case "editGroup"
		Stats="修改分组"
		Call editGroup()
	Case "saveeditG"
		Stats="修改分组"
		Call saveeditG()
	Case "delGroup"
		Stats="删除分组"
		Call del_Group()
	Case "myGroup"
		Stats="我的分组"
		Call my_Group()
	Case "editU"
		Stats="编辑网址"
		Call editU()
	Case "addU"
		Stats="添加网址"
		Call addU()
	Case "saveU"
		Stats="保存网址"
		Call saveU()
	Case "saveeditU"
		Stats="修改网址"
		Call saveeditU()
	Case "设置"
		Stats="共享/取消共享网址"
		Call ShareU()
	Case "设置分组"
		Stats="共享/取消共享分组"
		Call ShareG()
	Case "清空分组"
		Stats="清空分组"
		Call AllDelG()
	Case "移动"
		Stats="批量移动网址"
		Call MovUrl()
	Case "删除"
		Stats="删除网址"
		Call DelUrl()
	Case "删除分组"
		Stats="删除分组"
		Call DelG()
	Case "清空"
		Stats="清空网址"
		Call AllDelUrl()
	Case "allshare"
		Stats="所有共享网址"
		Call allshare()
	Case "gopage"
	Stats="访问网站"
	Call gopage()
	case else
	call main()
	call favnote()
End Select
if founderr then call Mslove_error()
end if
call activeonline()
call footer()

sub gopage()'点击访问网站
dim Uid,Pageurl
	Uid=cint(Request("UID"))
	if not isnull(session("hitstime")) or cint(Regtimes)>0 then'限制刷新时间
		if DateDiff("s",session("hitstime"),Now())>cint(Regtimes) then
   		conn.execute("update Ms_BookUrl set hits=hits+1 where Uid="&Uid&"")
		end if
	end if
	Set rs= Server.CreateObject("ADODB.Recordset")
	   sql="select Pageurl,Hits from Ms_BookUrl where Uid="&Uid
       rs.Open sql,conn,1,1
	   Pageurl=rs("Pageurl")
	   rs.close
	   session("hitstime")=Now()
response.redirect""&Pageurl&""
end sub

sub main()
call favlist()%>
<br>
<table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
  <form action="favlist.asp" method=post name=favform>
    <tr align="center"> 
      <th width="40%" height="28">网站名称</th>
      <th width="8%">修改</th>
      <th width="14%">组别</th>
      <th width="8%">共享</th>
      <th width="8%">人气</th>
      <th width="15%">时间</th>
      <th width="7%">操作</th>
    </tr>
    <tr> 
      <%dim Uid
	set rs=server.createobject("adodb.recordset")
  sql="select * from Ms_BookUrl u inner join Ms_BookGroup g on u.BookGroupID=g.GID where u.Username='"&trim(membername)&"'"
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
Uid=rs("Uid")
%>
      <td class=tablebody1><a href="favlist.asp?action=gopage&Uid=<%=Uid%>"><%=rs("UrlName")%></a></td>
      <td align="center" class=tablebody1><a href=favlist.asp?action=editU&Uid=<%=Uid%>>修改</a></td>
      <td align="center" class=tablebody1><%=rs("GroupName")%></td>
      <td align="center" class=tablebody1><%if rs("Share")=1 then
	response.Write("<font color=#0076EC>√</font>")
	else
	response.Write("<font color=red>X</font>")
	end if%></td>
      <td align="center" class=tablebody1><%=rs("hits")%></td>
      <td class=tablebody1><%=rs("Addtime")%></td>
      <td align="center" class=tablebody1> <input type=checkbox name=id value=<%=Uid%>> 
      </td>
    </tr>
    <%page_count=page_count+1
  rs.movenext
  loop
  end if
  %>
    <tr align="center"> 
      <td height="24" colspan="7" class=tablebody2> <%if totalrec>0 then
		  	call showpage(strFileName)
		  end if%></td>
    </tr>
    <tr align="center"> 
      <td height="29" colspan="7" class=tablebody1> <input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">
        选中所有显示记录&nbsp; <input type=button name=action onclick="location.href='favlist.asp?action=addU'" value="添加网址"> 
        &nbsp; <input type=submit name=action onclick="{if(confirm('确定移动选定的网址吗?')){this.document.favform.submit();return true;}return false;}" value="移动">
        -> <select name="BookGroupID" id="BookGroupID">
          <%=Group_select%> </select> &nbsp; <select name="Share" id="Share">
          <option value="1">共享</option>
          <option value="0">不共享</option>
        </select> <input type=submit name=action onclick="{if(confirm('确定设置选定的网址吗?')){this.document.favform.submit();return true;}return false;}" value="设置"> 
        &nbsp; <input type=submit name=action onclick="{if(confirm('确定清空所有网址吗?')){this.document.favform.submit();return true;}return false;}" value="清空"> 
        &nbsp; <input type=submit name=action onclick="{if(confirm('确定删除选定的网址吗?')){this.document.favform.submit();return true;}return false;}" value="删除"> 
      </td>
    </tr>
  </form>
</table>

<%rs.close
end sub
sub favlist()'菜单导航
response.write "<TABLE cellpadding=6 cellspacing=1 align=center class=tableborder1><TBODY>"&_
				"<TR>"&_
				"<TD align=center class=tablebody1><a href=favlist.asp>我的收藏</a> | <a href=favlist.asp?action=creat>创建新组</a> | <a href=favlist.asp?action=addU>添加网址</a> | <a href=favlist.asp?action=allshare&search=0>所有共享网址</a> | <a href=favlist.asp?action=myGroup>我的组别</a>"&_
                           "</td></tr></TBODY></TABLE>"
end sub
sub favnote()
response.write "<TABLE cellpadding=6 cellspacing=1 align=center class=tableborder1><TBODY>"&_
				"<TR>"&_
				"<TD class=tablebody1>注意：</br>１您可以创建<font color=red>"
if GroupSetting(166)=0 then
				response.Write("无限")
				else
				response.Write(GroupSetting(166))
end if
response.write"</font>个分组，随用户等级升级而增加；<br>２目前您共有分组"&Groupcount&"个；<br>３每个组最多可以添加<font color=red>"
if GroupSetting(167)=0 then
				response.Write("无限")
				else
				response.Write(GroupSetting(167))
end if
response.write"</font>个网址；<br>４移动网址大于组限制网址数，将自动不移动多余记录"&_
                           "</td></tr></TBODY></TABLE>"
end sub

sub allshare()'列出所有共享网址
if Cint(GroupSetting(157))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有查看别人共享收藏夹的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
dim Gid
call favlist()%>
<table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
  <tr> 
    <th width="43%" height="26" align="center" class=tablebody1>网站名称</th>
    <th width="18%" align="center" class=tablebody1>组别</th>
    <th width="10%" align="center" class=tablebody1>共享</th>
    <th width="9%" align="center" class=tablebody1>人气</th>
    <th width="20%" align="center" class=tablebody1>时间</th>
  </tr>
  <%dim Uid
	set rs=server.createobject("adodb.recordset")
if search=1 then
  sql="select * from Ms_BookUrl u inner join Ms_BookGroup g on u.BookGroupID=g.GID where u.Share=1 and (UrlName like '%"&Keyword&"%' or PageUrl like '%"&Keyword&"%' or Content like '%"&Keyword&"%')"
  elseif search=2 then
  sql="select * from Ms_BookUrl u inner join Ms_BookGroup g on u.BookGroupID=g.GID where U.BookGroupID="&Cint(checkStr(request("Gid")))&""
  else
  sql="select * from Ms_BookUrl u inner join Ms_BookGroup g on u.BookGroupID=g.GID where u.Share=1"
  end if
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
Uid=rs("Uid")
%>
  <tr> 
    <td height="24" class=tablebody1><a href="favlist.asp?action=gopage&Uid=<%=Uid%>"><%=rs("UrlName")%></a></td>
    <td height="12" align="center" class=tablebody1><%=rs("GroupName")%></td>
    <td height="12" align="center" class=tablebody1> <%if rs("Share")=1 then
	response.Write("<font color=#0076EC>√</font>")
	else
	response.Write("<font color=red>X</font>")
	end if%> </td>
    <td height="12" align="center" class=tablebody1><%=rs("hits")%></td>
    <td height="12" align="left" class=tablebody1><%=rs("Addtime")%></td>
  </tr>
  <%page_count=page_count+1
  rs.movenext
  loop
  end if
  %>
  <tr> 
    <td height="22" colspan="5" align="center" class=tablebody2> <%if totalrec>0 then
		  	call showpage(strFileName)
		  end if%></td>
  </tr>
  <form action="favlist.asp" method=post name=messager>
    <tr> 
      <td height="27" colspan="5" align="center" class=tablebody1>搜索： 
        <input name="Keyword" type="text" id="Keyword"> <input name=action type=hidden value=allshare> 
        <input name=search type=hidden value=1> &nbsp; <input name=Submit type=Submit class=2 id="Submit" value="搜索">
        (支持网址、网站名称、简介搜索)</td>
    </tr>
  </form>
</table>
<%call favnote()
end sub

sub my_Group()'我的分组
call favlist()%>
<table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
  <form action="favlist.asp" method=post name=messager>
    <tr> 
      <th width="6%" height="26" align="center" class=tablebody1>&nbsp;</th>
      <th width="37%" height="26" align="center" class=tablebody1>组别名称</th>
      <th width="17%" align="center" class=tablebody1>列出所有网址</th>
      <th width="18%" align="center" class=tablebody1>共享</th>
      <th width="12%" align="center" class=tablebody1>修改</th>
      <th width="10%" align="center" class=tablebody1>操作</th>
    </tr>
    <%dim GID
	set rs=server.createobject("adodb.recordset")
  sql="select * from Ms_BookGroup where Username='"&trim(membername)&"'"
rs.Open sql,conn,1,1
if not (rs.eof and rs.bof) then
call rspages()
do while not rs.eof and page_count<Cint(MaxPerPage)
GID=rs("GID")
%>
    <tr> 
      <td height="24" align="center" class=tablebody1><img src="Skins/Default/openfold.gif" width="17" height="14"></td>
      <td class=tablebody1><a href="favlist.asp?action=allshare&search=2&GID=<%=GID%>"><%=rs("GroupName")%></a></td>
      <td align="center" class=tablebody1><a href="favlist.asp?action=allshare&search=2&GID=<%=GID%>">列出所有网址</a></td>
      <td height="12" align="center" class=tablebody1> <%if rs("BookShare")=1 then
	response.Write("<font color=#0076EC>√</font>")
	else
	response.Write("<font color=red>X</font>")
	end if%> </td>
      <td height="12" align="center" class=tablebody1><a href=favlist.asp?action=editGroup&Gid=<%=Gid%>>修改</a></td>
      <td height="12" align="center" class=tablebody1><input name=id type=checkbox id="id" value=<%=Gid%>></td>
    </tr>
    <%page_count=page_count+1
  rs.movenext
  loop
  end if
  %>
    <tr> 
      <td height="22" colspan="6" align="center" class=tablebody2> <%
		  	call showpage(strFileName)
		  %></td>
    </tr>
    <tr> 
      <td height="27" colspan="6" align="center" class=tablebody1><input type=checkbox name=chkall value=on onclick="CheckAll(this.form)">
        选中所有显示记录&nbsp; <input type=button name=action onclick="location.href='favlist.asp?action=addU'" value="添加网址"> 
        &nbsp; <select name="BookShare" id="BookShare">
          <option value="1">共享</option>
          <option value="0">不共享</option>
        </select> <input type=submit name=action onclick="{if(confirm('确定设置选定的分组吗?')){this.document.favform.submit();return true;}return false;}" value="设置分组"> 
        &nbsp; <input type=submit name=action onclick="{if(confirm('确定清空所有分组吗?')){this.document.favform.submit();return true;}return false;}" value="清空分组"> 
        &nbsp; <input type=submit name=action onclick="{if(confirm('确定删除选定的分组吗?')){this.document.favform.submit();return true;}return false;}" value="删除分组"> 
      </td>
    </tr>
  </form>
</table>
<%call favnote()
end sub

sub creat_Group()''创建组
if Cint(GroupSetting(165))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有创建新组的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
call favlist()%>
<form action="favlist.asp" method=post name=messager>
  <table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
    <input type=hidden name="action" value="addGroup">
    <tr align="center"> 
      <th height="24" colspan="2" align="center">创建新组--请完整输入下列信息</th>
    </tr>
    <tr align="center"> 
      <td width="20%" height="26" align="center" class=tablebody1>组　名： </td>
      <td width="80%" align="left" class=tablebody1><input type=text name="Groupname" size=30></td>
    </tr>
    <tr align="center"> 
      <td height="26" align="center" class=tablebody1>共　享：</td>
      <td height="26" align="left" class=tablebody1> 
        <input type="radio" name="BookShare" value="1">
        是 
        <input name="BookShare" type="radio" value="0" checked>
        否</td>
    </tr>
    <tr align="center"> 
      <td height="24" colspan="2" align="center" class=tablebody1> <input class=2 type=Submit value="保存" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"> </td>
    </tr>
  </table>
</form>
<%call favnote()
end sub
sub Save_Group()
dim Groupname,BookShare
if Cint(GroupSetting(165))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有创建新组的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
if Cint(GroupSetting(166))<>0 and Groupcount>=Cint(GroupSetting(166)) then
	ErrMsg=ErrMsg+"<Br>"+"<li>您最多可以建立"&GroupSetting(166)&"个组，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
	Groupname=checkStr(Request("Groupname"))
	BookShare=checkStr(Request("BookShare"))
	if Groupname="" or strLength(request("Groupname"))>50 then
		errmsg=errmsg+"<br>"+"<li>请输入组别名称(长度不能大于50)。"
		founderr=true
		exit sub
end if
sql="insert into Ms_BookGroup (Username,GroupName,BookShare) values ('"&trim(MemberName)&"','"&Groupname&"',"&BookShare&")"
conn.execute(sql)
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，您已成功创建新组。</b>"
call Mslove_suc()
end sub

sub saveeditG()
dim Groupname,BookShare,Gid
	Groupname=checkStr(Request("Groupname"))
	BookShare=checkStr(Request("BookShare"))
	Gid=checkStr(Request("Gid"))
	if Gid="" or not isnumeric(Gid) then
	errmsg=errmsg+"<br>"+"<li>参数错误。"
		founderr=true
		exit sub
		end if
	if Groupname="" or strLength(request("Groupname"))>50 then
		errmsg=errmsg+"<br>"+"<li>请输入组别名称(长度不能大于50)。"
		founderr=true
		exit sub
end if
sql="update Ms_BookGroup set GroupName='"&Groupname&"',BookShare="&BookShare&" where Username='"&trim(membername)&"' and Gid="&Gid&""
conn.execute(sql)
sucmsg=sucmsg+"<br>"+"<li><b>恭喜您，您已成功修改分组。</b>"
call Mslove_suc()
end sub

sub editGroup()
call favlist()
dim Gid
Gid=checkStr(Request("Gid"))
	if Gid="" or not isnumeric(Gid) then
		errmsg=errmsg+"<br>"+"<li>请选择组别ID。"
		founderr=true
		exit sub
end if
sql="select * from [Ms_BookGroup] where GID="&GID&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
%>
<form action="favlist.asp" method=post name=messager>
  <table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
    <input type=hidden name="action" value=saveeditG>
	<input type=hidden name="GID" value=<%=GID%>>
    <tr align="center"> 
      <th height="24" colspan="2" align="center">修改分组--请完整输入下列信息</th>
    </tr>
    <tr align="center"> 
      <td width="20%" height="26" align="center" class=tablebody1>组　名： </td>
      <td width="80%" align="left" class=tablebody1><input type=text name="Groupname" size=30 value="<%=rs("GroupName")%>"></td>
    </tr>
    <tr align="center"> 
      <td height="26" align="center" class=tablebody1>共　享：</td>
      <td height="26" align="left" class=tablebody1> 
        <input type="radio" name="BookShare" value="1" <%if rs("BookShare")=1 then%>checked<%end if%>>
        是 
        <input name="BookShare" type="radio" value="0" <%if rs("BookShare")=0 then%>checked<%end if%>>
        否</td>
    </tr>
    <tr align="center"> 
      <td height="24" colspan="2" align="center" class=tablebody1> <input class=2 type=Submit value="保存" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"> </td>
    </tr>
  </table>
</form>
<%
end if
set rs=nothing
call favnote()
end sub

sub addU()'添加网址
if Cint(GroupSetting(168))=0 then
	ErrMsg=ErrMsg+"<Br>"+"<li>您没有添加新网址的权限，请与管理员联系。"
   	FoundErr=True
	exit sub
end if
call favlist()%>
  <table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
  <form action="favlist.asp" method=post name=messager>
    <input type=hidden name="action" value="saveU">
    <tr align="center"> 
      <th height="24" colspan="2" align="center">添加网址--请完整输入下列信息</th>
    </tr>
    <tr align="center"> 
      <td width="20%" height="26" align="center" class=tablebody1>网站名称： </td>
      <td width="80%" align="left" class=tablebody1><input name="UrlName" type=text id="UrlName" size=30></td>
    </tr>
	    <%if Cint(Codeshow(9))=1 then%>
    <tr> 
      <td height="27" align="center"  class=tablebody1>检验码：</td>
      <td align="left"  class=tablebody1> <input type="text" name="codestr" maxlength="4" size="4"> 
        &nbsp;<%=GetCode()%>&nbsp;</td>
    </tr>
    <%end if%>
    <tr align="center"> 
      <td height="-2" align="center" class=tablebody1>共　　享：</td>
      <td height="12" align="left" class=tablebody1> <input type="radio" name="Share" value="1">
        是 
        <input name="Share" type="radio" value="0" checked>
        否</td>
    </tr>
    <tr align="center">
      <td height="-1" align="center" class=tablebody1>网　　址：</td>
      <td height="13" align="left" class=tablebody1><input name="PageUrl" type="text" id="PageUrl" size="30" value="<%=Request.ServerVariables("HTTP_REFERER")%>"></td>
    </tr>
    <tr align="center">
      <td height="0" align="center" class=tablebody1>所 属 组：</td>
      <td height="26" align="left" class=tablebody1><select name="BookGroupID" id="BookGroupID">
          <%=Group_select%>
        </select></td>
    </tr>
    <tr align="center">
      <td height="26" align="center" class=tablebody1>说　　明：</td>
      <td height="26" align="left" class=tablebody1><textarea name="Content" cols="60" rows="5" ID="IDContent"></textarea>
        <a style=cursor:hand onclick="if (parseInt(IDContent.rows)-3>0)(IDContent.rows=parseInt(IDContent.rows)-3)"><img src="Skins/Default/minus.gif" unselectable="on" border='0'></a> 
        <a style=cursor:hand onclick="if (parseInt(IDContent.rows)+3>3)(IDContent.rows=parseInt(IDContent.rows)+3)"><img src="Skins/Default/plus.gif" unselectable="on" border='0'></a><br>
        网址简介不能大于200个字符。</td>
    </tr>
    <tr align="center"> 
      <td height="24" colspan="2" align="center" class=tablebody1> <input class=2 type=Submit value="保存" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"> </td>
    </tr></form>
  </table>

<%call favnote()
end sub

sub saveU()
if Not ChkPost then'查检提交数据
	ErrMsg=ErrMsg+"<Br>"+"<li>您提交的数据不合法，请不要从外部提交发言。"
   	FoundErr=True
end if

if Cint(Codeshow(9))=1 then
	if Not CodeIsTrue() then
		errmsg=errmsg+"<br>"+"<li>验证码校验失败，请返回刷新页面后再输入验证码。"
		founderr=true
	end if
end if
if Cint(GroupSetting(168))=0 then
	errmsg=errmsg+"<br>"+"<li>您没有添加网址的权限，请联系管理员。"
		founderr=true
end if
Dim PageUrl,BookGroupID,UrlName,Content,Share,Uid,countUID
	PageUrl=checkStr(Request("PageUrl"))
	UrlName=checkStr(Request("UrlName"))
	Content=checkStr(Request("Content"))
If Request("Share")=1 then
		Share=1
	Else
		Share=0
	End If
if UrlName="" or strLength(request("UrlName"))>100 then
		errmsg=errmsg+"<br>"+"<li>请输入网址名称(长度不能大于100)。"
		founderr=true
end if
if PageUrl="" or strLength(request("PageUrl"))>100 then
		errmsg=errmsg+"<br>"+"<li>请输入网址(长度不能大于100)。"
		founderr=true
end if
if Content<>"" and strLength(request("Content"))>200 then
		errmsg=errmsg+"<br>"+"<li>请输入网址简介(长度不能大于200)。"
		founderr=true
end if
If Request("BookGroupID")<>"" And IsNumeric(Request("BookGroupID")) then 
	BookGroupID=cint(Request("BookGroupID"))
Else
	errmsg=errmsg+"<br>"+"<li>请选择网址所属组别。"
	founderr=true
	exit sub
End If

'检查单一组别中的网址多少
sql="select count(UID) from [Ms_BookUrl] where Username='"&trim(membername)&"' and BookGroupID="&BookGroupID&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
countUID=rs(0)
else
countUID=0
end if
rs.close
if cint(GroupSetting(167))<>0 and countUID>=(cint(GroupSetting(167))) then
errmsg=errmsg+"<br>"+"<li>您的一组最多只能添加"&GroupSetting(167)&"个网址。"
	founderr=true
end if

If Request("Uid")<>"" And IsNumeric(Request("Uid")) then 
	Uid=cint(Request("Uid"))
Else
	Uid=0
End If
if Chkvalue(1,GroupSetting(159),Cint(GroupSetting(160)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的金币不够请确认。"
	founderr=true
end if
if Chkvalue(2,GroupSetting(161),Cint(GroupSetting(162)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的魅力值不够请确认。"
	founderr=true
end if
if Chkvalue(3,GroupSetting(163),Cint(GroupSetting(164)))=false then
	errmsg=errmsg+"<br>"+"<li>对不起，您的经验值不够请确认。"
	founderr=true
end if
if founderr=true then exit sub
	sql="Insert into Ms_BookUrl (Username,UrlName,PageUrl,Content,BookGroupID,Share,Addtime) VALUES ('"&trim(MemberName)&"','"&UrlName&"','"&PageUrl&"','"&Content&"',"&BookGroupID&","&Share&",'"&now()&"')"
	conn.execute("update Ms_user set UserWealth=UserWealth "&GroupSetting(159)&Cint(GroupSetting(160))&"),UserEP=UserEP  "&GroupSetting(161)&(CintGroupSetting(162))&",UserCP=UserCP  "&GroupSetting(163)&Cint(GroupSetting(164))&" where Userid="&Userid&"")
	conn.execute(sql)
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功添加网址记录。"
		call Mslove_suc()
end sub

sub editU()'修改网址
call favlist()
dim UID,BookGroupID
Uid=checkStr(Request("Uid"))
if Uid="" or not isnumeric(Uid) then
errmsg=errmsg+"<br>"+"<li>您没有选择正确的网站ID。"
	founderr=true
	exit sub
end if
sql="select * from [Ms_BookUrl] where Username='"&trim(membername)&"' and UID="&UID&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
BookGroupID=rs("BookGroupID")%>
<form action="favlist.asp" method=post name=messager>
  <table width="100%" cellpadding=3 cellspacing=1 align=center class=tableborder1>
    <input type=hidden name="action" value="saveeditU">
	<input name="UID" type=hidden value="<%=UID%>">
    <tr align="center"> 
      <th height="24" colspan="2" align="center">修改网址--请完整输入下列信息</th>
    </tr>
    <tr align="center"> 
      <td width="20%" height="26" align="center" class=tablebody1>网站名称： </td>
      <td width="80%" align="left" class=tablebody1><input name="UrlName" type=text id="UrlName" size=30 value="<%=rs("UrlName")%>"></td>
    </tr>
    <tr align="center"> 
      <td height="-2" align="center" class=tablebody1>共　　享：</td>
      <td height="12" align="left" class=tablebody1> <input type="radio" name="Share" value="1" <%if rs("Share")=1 then%>checked<%end if%>>
        是 
        <input name="Share" type="radio" value="0" <%if rs("Share")=0 then%>checked<%end if%>>
        否</td>
    </tr>
    <tr align="center">
      <td height="-1" align="center" class=tablebody1>网　　址：</td>
      <td height="13" align="left" class=tablebody1><input name="PageUrl" type="text" id="PageUrl" size="30" value="<%=rs("PageUrl")%>"></td>
    </tr>
    <tr align="center">
      <td height="0" align="center" class=tablebody1>所 属 组：</td>
      <td height="26" align="left" class=tablebody1><select name="BookGroupID" id="BookGroupID">
	  <%dim rsg
	  Set Rsg=conn.Execute("Select GID,GroupName From [Ms_BookGroup] Where Username='"&membername&"'")
	If Not (Rsg.eof or Rsg.bof) then
	do while not rsg.eof
	if rsg(0)=BookGroupID then
	response.Write("<option value="""&rsg(0)&""" selected>"&rsg(1)&"</option>")
	else
	response.Write("<option value="""&rsg(0)&""">"&rsg(1)&"</option>")
	end if	
	rsg.movenext
	loop
	else
	response.Write("<option value="""" >请创建...</option>")
	end if
	rsg.close%>
        </select></td>
    </tr>
    <tr align="center">
      <td height="26" align="center" class=tablebody1>说　　明：</td>
      <td height="26" align="left" class=tablebody1><textarea name="Content" cols="60" rows="5" ID="IDContent"><%=rs("Content")%></textarea>
        <a style=cursor:hand onclick="if (parseInt(IDContent.rows)-3>0)(IDContent.rows=parseInt(IDContent.rows)-3)"><img src="Skins/Default/minus.gif" unselectable="on" border='0'></a> 
        <a style=cursor:hand onclick="if (parseInt(IDContent.rows)+3>3)(IDContent.rows=parseInt(IDContent.rows)+3)"><img src="Skins/Default/plus.gif" unselectable="on" border='0'></a><br>
        网址简介不能大于200个字符。</td>
    </tr>
    <tr align="center"> 
      <td height="24" colspan="2" align="center" class=tablebody1> <input class=2 type=Submit value="修改" name=Submit> 
        &nbsp; <input class=2 type="reset" name="Clear" value="清除"> </td>
    </tr>
  </table>
</form>
<%else
errmsg=errmsg+"<br>"+"<li>参数错误，请重新选择。"
	founderr=true
	exit sub
end if
rs.close
call favnote()
end sub

sub saveeditU()
Dim PageUrl,BookGroupID,UrlName,Content,Share,Uid
	PageUrl=checkStr(Request("PageUrl"))
	UrlName=checkStr(Request("UrlName"))
	Content=checkStr(Request("Content"))
If Request("Share")=1 then
		Share=1
	Else
		Share=0
	End If
if UrlName="" or strLength(request("UrlName"))>100 then
		errmsg=errmsg+"<br>"+"<li>请输入网址名称(长度不能大于100)。"
		founderr=true
end if
if PageUrl="" or strLength(request("PageUrl"))>100 then
		errmsg=errmsg+"<br>"+"<li>请输入网址(长度不能大于100)。"
		founderr=true
end if
if Content<>"" and strLength(request("Content"))>200 then
		errmsg=errmsg+"<br>"+"<li>请输入网址简介(长度不能大于200)。"
		founderr=true
end if
If Request("BookGroupID")<>"" And IsNumeric(Request("BookGroupID")) then 
	BookGroupID=cint(Request("BookGroupID"))
Else
	errmsg=errmsg+"<br>"+"<li>请选择网址所属组别。"
	founderr=true
	exit sub
End If

If Request("Uid")<>"" And IsNumeric(Request("Uid")) then 
	Uid=cint(Request("Uid"))
Else
	Uid=0
End If
if founderr=true then exit sub
	sql="Update Ms_BookUrl set UrlName='"&UrlName&"',PageUrl='"&PageUrl&"',Content='"&Content&"',BookGroupID="&BookGroupID&",Share="&Share&" where Uid="&Uid
	sucmsg=sucmsg+"<br>"+"<li><b>您已经成功修改网址记录。"
		call Mslove_suc()
conn.execute(sql)
end sub

sub MovUrl()'移动网址
dim delid,FixID,BookGroupID,countuid,splitid
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
BookGroupID=checkStr(request("BookGroupID"))
BookGroupID=Cint(BookGroupID)
if BookGroupID="" or not isNumeric(BookGroupID) then
Errmsg=Errmsg+"<li>"+"没有选择移动到哪一个组别。"
Founderr=true
end if
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关网站。"
Founderr=true
end if
if Founderr=true then exit sub
sql="select Count(UID) from [Ms_BookUrl] where BookGroupID="&BookGroupID&""
set rs=conn.execute(sql)
if not (rs.eof and rs.bof) then
countuid=rs(0)
else
countuid=0
end if
set rs=nothing
splitid=split(delid,",")
for i=0 to ubound(splitid)
if Cint(GroupSetting(167))<>0 and i>(Cint(GroupSetting(167))-1-countuid) then
	errmsg=errmsg+"<br>"+"<li>该组只能添加"&GroupSetting(167)&"个网址"
	founderr=true
	exit sub
	exit for
end if
	conn.execute("update Ms_BookUrl set BookGroupID="&BookGroupID&" where Username='"&trim(membername)&"' and UID="&replace(splitid(i),"'","")&"")
next
	sucmsg=sucmsg+"<br>"+"<li>您已成功移动该网址到指定组中。"
	call Mslove_suc()
end sub

sub ShareU()'共享网址设置
dim delid,FixID,Share
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关网站。"
Founderr=true
end if
Share=checkStr(request("Share"))
if Share="" or not isNumeric(Share) then
Errmsg=Errmsg+"<li>"+"请选择共享与不共享。"
Founderr=true
end if
if Founderr=true then exit sub
conn.execute("update Ms_BookUrl set Share="&Share&" where Username='"&trim(membername)&"' and UID in("&delid&")")
sucmsg=sucmsg+"<br>"+"<li>您已成功对该网址进行设置操作。"
	call Mslove_suc()
end sub

sub ShareG()'共享分组设置
dim delid,FixID,BookShare
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关网站。"
Founderr=true
end if
BookShare=checkStr(request("BookShare"))
if BookShare="" or not isNumeric(BookShare) then
Errmsg=Errmsg+"<li>"+"请选择共享与不共享。"
Founderr=true
end if
if Founderr=true then exit sub
conn.execute("update Ms_BookGroup set BookShare="&BookShare&" where Username='"&trim(membername)&"' and GID in("&delid&")")
sucmsg=sucmsg+"<br>"+"<li>您已成功对该分组进行设置操作。"
	call Mslove_suc()
end sub

sub DelUrl()'批量删除网址
dim delid,FixID,splitid
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关网站。"
Founderr=true
end if
splitid=split(delid,",")
splitid=ubound(splitid)
if founderr=true then exit sub
conn.execute("delete from Ms_BookUrl where Username='"&trim(membername)&"' and UID in("&delid&")")
conn.execute("update Ms_user set UserWealth=UserWealth-("&GroupSetting(18)&(Cint(GroupSetting(19))*(splitid+1))&"),UserEP=UserEP-("&GroupSetting(20)&(Cint(GroupSetting(21))*(splitid+1))&"),UserCP=UserCP-("&GroupSetting(22)&(Cint(GroupSetting(23))*(splitid+1))&") where Userid="&Userid&"")
sucmsg=sucmsg+"<br>"+"<li>您已成功删除该网址。"
	call Mslove_suc()
end sub

sub DelG()'批量删除分组
dim delid,FixID
delid=replace(request("id"),"'","")
delid=replace(delid,";","")
delid=replace(delid,"--","")
delid=replace(delid,")","")
fixid=replace(delid,",","")
fixid=Trim(replace(fixid," ",""))
If Not IsNumeric(fixid) Then
	Errmsg=Errmsg+"<br><li>错误的参数。"
	founderr=true
End If
if delid="" or isnull(delid) then
Errmsg=Errmsg+"<li>"+"请选择相关分组。"
Founderr=true
end if
if founderr=true then exit sub
conn.execute("delete from Ms_BookGroup where Username='"&trim(membername)&"' and GID in("&delid&")")
conn.execute("delete from Ms_BookUrl where Username='"&trim(membername)&"' and BookGroupID in ("&delid&")")
sucmsg=sucmsg+"<br>"+"<li>您已成功删除该分组。"
sucmsg=sucmsg+"<br>"+"<li>您已成功删除该分组所有网址。"
	call Mslove_suc()
end sub

sub AllDelUrl()'清空网址
conn.execute("delete from Ms_BookUrl where Username='"&trim(membername)&"'")
sucmsg=sucmsg+"<br>"+"<li>您已成功清空网址。"
	call Mslove_suc()
end sub

sub AllDelG()'清空所有组
conn.execute("delete from Ms_BookGroup where Username='"&trim(membername)&"'")
conn.execute("delete from Ms_BookUrl where Username='"&trim(membername)&"'")
sucmsg=sucmsg+"<br>"+"<li>您已成功清空所分组。"
sucmsg=sucmsg+"<br>"+"<li>并且也清空所有网址。"
	call Mslove_suc()
end sub
%>