<!--#include file="connn.asp"-->
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>管理</title>
<script language="JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
<%
dim selectm,selectkey,selectid
selectkey=request.form("selectkey")
selectm=request.form("selectm")
if selectkey="" then
selectkey=request("selectkey")
end if
if selectm="" then
selectm=request("selectm")
end if

selectid=request.form("selectid")
if selectid<>"" then
path = "../"
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set rs= Server.CreateObject("ADODB.Recordset")
	sql="select id,pic from FOX_xiao where id in ("&selectid&")"
	rs.open sql,conn,1
	if not rs.eof then
	response.write "总共删除记录和文件"&rs.recordcount&"个。<br>"
	do while not rs.eof
		
		F_filename=path&rs("pic")
		IF F_filename = "../images/Buy2buylogo.gif" Then
		F_filename = ""
		End If
		if objFSO.fileExists(Server.MapPath(F_filename)) then
		objFSO.DeleteFile(Server.MapPath(F_filename))
		end if
		conn.Execute("delete from FOX_xiao where id="&rs(0))
		response.write "已经删除文件"&F_filename&" ！<br>"
	rs.movenext
	loop
	end if
	rs.close
	set rs=nothing
set objFSO=nothing


response.Redirect "editxiao.asp"
response.End
end if

downid=request("downid")
if Trim(Request("action")) = "Down" then
	Sql = "Update FOX_xiao set recommend = 3 where id="&downid
	conn.execute(sql)
	response.write "<script>alert('商盟隐藏成功！');window.location.href='editxiao.asp';</Script>"
	response.end
end if

CID=Request("CID")
If CID<> "" Then
strCat = "Where categoryid= "&CID&" order by adddate desc"
Else
strCat = "order by adddate desc"
End if
%>
<style type=text/css>
BODY{
	margin:0px;
	FONT-SIZE: 12px;
	FONT-FAMILY: "宋体", "Verdana", "Arial", "Helvetica", "sans-serif";
	background-color: #CCCC99; 
	scrollbar-highlight-color: #CC9933; 
	scrollbar-arrow-color: #FFFFFF; 
	scrollbar-base-color: #CC9933
}
table { border:0px; }
td { font:normal 12px 宋体; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 宋体; color:#111111; text-decoration:none; }
a:hover { color:#384780;text-decoration:underline; }
.sec_menu { border-left:2px solid #CC3300; border-right:2px solid #CC3300; border-bottom:2px solid #CC3300; overflow:hidden; background:#ffffff; }
.menu_title {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title span { position:relative; top:2px; left:8px; color:#FFFF00; font-weight:bold; }
.menu_title2 {background-color: #335EA8;color: white;font-size: 12px;font-weight:bold;height: 25; }
.menu_title2 span { position:relative; top:2px; left:8px; color:#FEFEFE; font-weight:bold; }
input,select,Textarea{
font-family:宋体,Verdana, Arial, Helvetica, sans-serif; font-size: 12px;}
</style>
<div align="center">
<table width="99%" border="0" cellspacing="1" bgcolor="#CC3300">
  <tr>  
    <td height="24" align="right"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="65%" height="24" align="center"><span class="STYLE1"><span class="STYLE3">管理商盟 商盟列表</span></span></td>
        <td width="35%"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td align="right"><span class="STYLE3">分类过滤</span>              <select name="state" onchange="var jmpURL=this.options[this.selectedIndex].value ; if(jmpURL!='') {window.location=jmpURL;} else {this.selectedIndex=0 ;}">
                <option value="-1" selected="selected" >--请选择商盟分类--</option>
                <%
sort(0)
dim ii
ii=0
sub sort(selec)
	sql="select * from FOX_category where ParentID = "&selec&" order by categoryorder"
	Set Rs1=Conn.Execute(sql)
	do while not rs1.eof
if selec=0 then
%>
                <option value="editxiao.asp?cid=<%=int(rs1("categoryid"))%>" <% if int(rs1("categoryid"))="&CID&" Then Response.write("Selected") %>><%=rs1("category")%></option>
                <%
else
%>
                <option value="editxiao.asp?cid=<%=int(rs1("categoryid"))%>" <% if int(rs1("categoryid"))="&CID&" Then Response.write("Selected") %>><%=string(ii*2,"　")%><%=rs1("category")%></option>
                <%
end if
ii=ii+1
	sort rs1("categoryid")
ii=ii-1
	rs1.movenext
	loop
rs1.close
Set Rs1 = Nothing
end sub

%>
              </select></td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
  <tr> 
    <form name="form1" method="post" action="">
      <td height="100" bgcolor="#FFFFFF"> 
        <%
				Const MaxPerPage=30
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim rs,sql
    			if Not isempty(Request("page")) then
      				currentPage=Cint(Request("page"))
   				else
      				currentPage=1
   				end if 
			set rs=server.CreateObject("adodb.recordset")
			select case selectm
			case ""
            rs.open "select * from FOX_xiao " & strCat & " ",conn,1,1
		    case "0"
			response.write "<center>请返回选择您要查询的方式！<br><br><a href=javascript:history.go(-1)>点击返回上一页</a></center>"
			response.End
			case "name"
			rs.open "select * from FOX_xiao where name like '%"&selectkey&"%' order by adddate desc",conn,1,1
			case "mark"
			rs.open "select * from FOX_xiao where mark like '%"&selectkey&"%' order by adddate desc",conn,1,1
			case "vipprice"
			rs.open "select * from FOX_xiao where vipprice like '%"&selectkey&"%' order by adddate desc",conn,1,1
			case "detail"
			rs.open "select * from FOX_xiao where detail like '%"&selectkey&"%' order by adddate desc",conn,1,1
			case "code"
			rs.open "select * from FOX_xiao where code like '%"&selectkey&"%' order by adddate desc",conn,1,1
		  end select
		   	if err.number<>0 then
				response.write "数据库中暂时无数据"
				end if
				
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' class='contents'> 数据库中暂时无数据！</p>"
   				else
	  				totalPut=rs.recordcount

      				if currentpage<1 then
          				currentpage=1
      				end if

      				if (currentpage-1)*MaxPerPage>totalput then
	   					if (totalPut mod MaxPerPage)=0 then
	     					currentpage= totalPut \ MaxPerPage
	   					else
	      					currentpage= totalPut \ MaxPerPage + 1
	   					end if
      				end if

       				if currentPage=1 then
            			showContent
            			showpage totalput,MaxPerPage,"editxiao.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"editxiao.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"editxiao.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0%>
        <br>
        <table width="98%" border="2" align="center" cellpadding="1" cellspacing="1" bordercolor="#FFFFFF" bgcolor="#CCCCCC">
          <tr bgcolor="#f7f7f7" align="center" height="20">
            <td width="16%" background="images/topbg.gif"><strong>商盟名称</strong></td>
            <td width="32%" background="images/topbg.gif"><strong>商盟地址</strong></td>
            <td width="11%" background="images/topbg.gif"><strong>联系人</strong></td>
            <td width="9%" background="images/topbg.gif"><strong>会员类型</strong></td>
            <td width="25%" height="25" background="images/topbg.gif"><strong>相关操作(</strong><img border="0" src="images/pic23.gif" width="17" height="13" align="absmiddle" />为显示状态)</td>
            <td width="5%" background="images/topbg.gif"><strong>选择</strong></td>
          </tr>
          <%
		  do while not rs.eof%>
          <tr bgcolor="#FFFFFF" align="center">
            <td align="left" bgcolor="#F7F7F7"><a href="editxiaos.asp?id=<%=rs("id")%>">
              <% if len(trim(rs("name")))>80 then
			response.write left(trim(rs("name")),18)&"..."
			else
			response.write trim(rs("name"))
			end if%>
            </a></td>
            <td align="left" bgcolor="#F7F7F7"><%=rs("pweight")%></td>
            <td height="25" align="center" bgcolor="#FFFFFF"><%response.write rs("Code")%></td>
            <td height="25" align="center" bgcolor="#FFFFFF"><%response.write rs("mark")%></td>
            <td height="25" nowrap bgcolor="#F7F7F7"><%if rs("recommend")=3 then%><img border="0" src="images/pic26.gif" width="17" height="13" align="absmiddle" /><%else%>
			<img border="0" src="images/pic23.gif" width="17" height="13" align="absmiddle" /><%end if%> <a href="..\shangjiainfo.asp?id=<%=rs("id")%>" target="_blank"><img src="images/pic7.gif" width="18" height="15" border="0" align="absmiddle" />预览</a> <a href="editxiao.asp?action=Down&downid=<%=rs("id")%>"><img src="images/pic8.gif" width="18" height="15" border="0" align="absmiddle" />隐藏</a> <img src="images/pic9.gif" width="18" height="15" align="absmiddle" /><a href="editxiaos.asp?id=<%=rs("id")%>">修改</a><img border="0" src="images/pic12.gif" width="20" height="15"><a href="sj_delt.asp?id=<%=rs("id")%>">删图</a></td>
            <td height="25" align="center" bgcolor="#F7F7F7"><input name="selectid" type="checkbox" id="selectid" value="<%=rs("id")%>" /></td>
          </tr>
          <%i=i+1
			if i>=MaxPerPage then Exit Do
			rs.movenext
		  loop
		  rs.close
		  set rs=nothing%>
          <tr bgcolor="#FFFFFF">
            <td height="30" colspan="7" align="right">全选
              <input type="checkbox" name="checkbox2" value="Check All" onclick="mm()" />
              &nbsp;
              <input name="Submit2" type="submit" class="input_bot" onclick="return test();" value="删除－－之前要确认所有图片已经删除" />
              &nbsp;&nbsp; </td>
          </tr>
        </table>
        <br>
        <%  
				End Sub   
  
				Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
  				
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				
				Response.Write "<form method=Post action="&filename&"?selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" >"  
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>首 页 上一页</font> "  
				Else  
					Response.Write "<a href="&filename&"?page=1&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>首 页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>上一页</a> "  
				End If
				
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>下一页 末 页</font>"  
				Else  
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&"&selectm="&selectm&"&selectkey="&selectkey&"&cid="&trim(Request("cid"))&" class='contents'>末 页</a>"  
				End If  
					Response.Write "<font class='contents'> 页次：</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
					Response.Write "<font class='contents'> 共有"&totalnumber&"种商盟 " 
					Response.Write "<font class='contents'>转到第：</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">页"  
					Response.Write "&nbsp;<input type='submit' class='input_bot' value='跳转' name='cndok' ></form>"  
				End Function  
			%></td>
    </form>
  </tr>
</table>
</div>
<br>
<div align="center">
<table width="99%" border="0" cellspacing="1" bgcolor="#CC3300">
  <tr> 
    <td height="24" align="center"><span class="STYLE1"><span class="STYLE3">商盟搜索</span></span></td>
  </tr>
  <tr bgcolor="#FFFFFF"> 
    <form name="form2" method="post" action="editxiao.asp">
      <td>
	    <br>
	    <table width="80%" border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
          <tr bgcolor="#F7F7F7" align="center"> 
            <td width="35%" height="25"> <input name="selectkey" type="text" class="input_sr" id="selectkey" onFocus="this.value=''" value="请输入关健字">            </td>
            <td width="45%" height="25"> <select name="selectm" id="select">
                <OPTION VALUE="name">按商盟名称</OPTION>
                <OPTION VALUE="zuozhe">按商盟品牌</OPTION>
                <OPTION VALUE="chubanshe">按商盟简介</OPTION>
				<OPTION VALUE="code">按商盟编号</OPTION>
            </select> </td>
            <td width="20%" height="25"><input name="Submit" type="submit" class="input_bot" onClick="return chkkey();" value="查 询"></td>
          </tr>
      </table>
      <br></td>
    </form>
  </tr>
</table>


</div>


<script language=javascript>
function test()
{
  if(!confirm('确认删除吗？')) return false;
}

function chkkey()
{
	if(document.form2.selectkey.value.length ==0){
	document.form2.selectkey.focus();
	alert("请输入查询关键字")
	return false;
	}
}
 
function mm()
{
   var a = document.getElementsByTagName("input");
   if(a[0].checked==true){
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = false;
   }
   else
   {
   for (var i=0; i<a.length; i++)
      if (a[i].type == "checkbox") a[i].checked = true;
   }
}
</script></body></html>