m_userskin.asp

来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 477 行 · 第 1/2 页

ASP
477
字号
<!--#include file="inc/inc_sys.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>oBlog--后台管理</title>
<link rel="stylesheet" href="images/style.css" type="text/css" />
<script src="images/menu.js" type="text/javascript"></script>
</head>
<body>
<SCRIPT language=javascript>
function unselectall()
{
    if(document.form2.chkAll.checked){
	document.form2.chkAll.checked = document.form2.chkAll.checked&0;
    } 	
}

function CheckAll(form)
{
  for (var i=0;i<form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.Name != "chkAll")
       e.checked = form.chkAll.checked;
    }
}
</SCRIPT>
<%
Dim ispass
Action=trim(request("Action"))

select case Action
	case "saveconfig"
		call saveconfig()
	case "showskin"
		call showskin()
	case "modiskin"
		call modiskin()
	case "savedefault"
		call savedefault()
	case "delconfig"
		call delconfig()
	case "addskin"
		call addskin()
	case "saveaddskin"
		call saveaddskin()
	case "passskin"
		call passskin
	case "unpassskin"
		call unpassskin	
end select

sub showskin()
	dim rs,psql,sql
ispass=clng(request("ispass"))
if ispass=1 then
	G_P_FileName="m_userskin.asp?action=showskin&ispass=1"
	psql=" where ispass=1 "
else
	G_P_FileName="m_userskin.asp?action=showskin&ispass=0"
	psql=" where ispass=0 "
end if
	if request("page")<>"" then
	    G_P_This=cint(request("page"))
	else
		G_P_This=1
	end if
	set rs=Server.CreateObject("Adodb.RecordSet")
	sql="select id,userskinname,skinauthor,skinauthorurl,isdefault,ispass,skinpic from oblog_userskin "&psql&" order by id desc "
		rs.Open sql,Conn,1,1
	  	if rs.eof and rs.bof then
            showContent(rs)
			G_P_Guide=G_P_Guide & " (共有0个模板)</h1>"
			response.write "<div align='right'>"&G_P_Guide&"</div>"
		else
	    	G_P_AllRecords=rs.recordcount
			G_P_Guide=G_P_Guide & " (共有" & G_P_AllRecords & "个模板)</h1>"
			if G_P_This<1 then
	       		G_P_This=1
	    	end if
	    	if (G_P_This-1)*G_P_PerMax>G_P_AllRecords then
		   		if (G_P_AllRecords mod G_P_PerMax)=0 then
		     		G_P_This= G_P_AllRecords \ G_P_PerMax
			  	else
			      	G_P_This= G_P_AllRecords \ G_P_PerMax + 1
		   		end if
	    	end if
		    if G_P_This=1 then
	        	Call showContent(rs)
	        	response.write oblog.showpage(true,true,"个模板")
	   	 	else
	   	     	if (G_P_This-1)*G_P_PerMax<G_P_AllRecords then
	         	   	rs.move  (G_P_This-1)*G_P_PerMax
	         		dim bookmark
	           		bookmark=rs.bookmark            	
	        	else
		        	G_P_This=1           		           		
		    	end if
		    	Call showContent(rs)
		    	response.write oblog.showpage(true,true,"个模板")
			end if
		end if
end sub

sub showContent(rs)
	dim i
	i=0
%>
<div id="main_body">
	<ul class="main_top">
		<li class="main_top_left left">用户模板管理</li>
		<li class="main_top_right right"> </li>
	</ul>
	<div class="main_content_rightbg">
		<div class="main_content_leftbg">
<table cellpadding="2" cellspacing="1" border="0" width="98%" class="border" align=center>
  <tr align="center">
    <td  height=25 class="topbg" align="left"><strong>用户模板管理   <a href="m_userskin.asp?action=showskin&ispass=1">&gt;&gt;通过审核的模板</a>  <a href="m_userskin.asp?action=showskin&ispass=0">&gt;&gt;未通过审核的模板</a></strong>
  </tr>
</table>
<form name="form2" method="post" action="m_userskin.asp" onSubmit="return confirm('确定要执行选定的操作吗?');">
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" Class="border">
    <tr class="topbg">
      <td height="25" colspan="6" ><strong><%if ispass=1 then response.Write "通过审核的模板" else response.write "未通过审核的模板"%></strong></td>
    </tr>
  </table>
  <table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" Class="border">
  <tr class="topbg">
    <td align="center"><strong>选中</strong></td>
    <td align="center"><strong>模板名称</strong></td>
    <td><strong>操作</strong></td>
  </tr>
    <%
do while not rs.eof	
dim userskinname,skinpic
    userskinname=rs("userskinname")
	If rs("skinpic")= "" Or IsNull(rs("skinpic")) Then 
		skinpic="../images/nopic.gIf"
	Else 
		skinpic=rs("skinpic")
	End if
%>
  <tr class="topbg">
    <td width="30" valign="top">
	<div align="center"><input name="checkbox" type="checkbox" onClick="unselectall()" id= "checkbox" class="tdbg" value='<%=rs("id")%>'></div>
	<div align="center"><%= rs("id") %></div></td>
    <td width="140"><div align="center">
	  <a href="../showskin.asp?id=<%=rs("id")%>" target="_blank"><img style="width:120px;height:77px;border:1px #888 solid;" src="../<%=skinpic%>" /><br />
	  <%if rs("isdefault")=1 then
	  response.Write "<span style=""color:#f00;font-weight:600;"">默认模板:"&userskinname&"</span>"
	  else
	  response.Write userskinname
	  end if
	  %>
	  </a>
	  </div></td>
    <td><div>
	  <strong>模板作者:</strong>
	  <%if rs("skinauthorurl")="" or isnull(rs("skinauthorurl")) then
	  response.Write rs("skinauthor")
	  else
	  response.Write "<a href="""&oblog.filt_html(rs("skinauthorurl"))&""" target='_blank'>"&rs("skinauthor")&"</a>"
	  end if%>
	  </div>
	  <div><%if rs("ispass")=1 then response.Write("<span style=""color:#317531;font-weight:600;"">已审核</span>") else response.Write("<span style=""color:#F30;font-weight:600;"">未审核</span>")%>   		
	<%if ispass=0 then%>
	<a href="m_userskin.asp?action=passskin&id=<%=rs("id")%>">通过审核</a>
	<%else%>
	<a href="m_userskin.asp?action=unpassskin&id=<%=rs("id")%>">取消审核</a>
	<%end if%>
	</div>
	  <div><a href="../admin_edit.asp?action=modiskin&skintype=user&t=0&editm=1&skinorder=0&id=<%=rs("id")%>"  target="_blank">修改主模板</a> <a href="../admin_edit.asp?action=modiskin&skintype=user&t=0&editm=1&skinorder=1&id=<%=rs("id")%>"  target="_blank">修改副模板</a> <a href="m_userskin.asp?action=modiskin&id=<%=rs("id")%>">修改模板(文本方式)</a></div>
	  <div><a href="m_userskin.asp?action=delconfig&id=<%=rs("id")%>" style="color:#f00;font-weight:600;" onclick=return(confirm("确定要删除这个模板吗?"))>删除模板</a></div>
	  </td>
    </tr>
    <%
	i=i+1
	if i>=G_P_PerMax then exit do
	rs.movenext
loop
%>
</table>
  <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" Class="border">
    <tr>
      <td height="40" colspan="6" align="center" class="tdbg"> <div align="center">
	  <input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox" />
	  全选
	 <input type="radio" value="savedefault" name="action" checked>默认模板</option>
	 <%if ispass=0 then%>
	  <input type="radio" value="passskin" name="action" >通过审核</option>
	  <%else%>
	  <input type="radio" value="unpassskin" name="action">取消审核</option>
	  <%end if%>
	   <input type="radio" value="delconfig" name="action" >删除</option>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
          <input type="submit" name="Submit" value="保存设置">
        </div></td>
    </tr>
  </table>
</form>
		</div>
	</div>
	<ul class="main_end">
		<li class="main_end_left left"></li>
		<li class="main_end_right right"></li>
	</ul>
</div>
<%
	set rs=nothing
end sub

Sub ReCountSkins()
	Dim rst,rst1
	Set rst=Server.CreateObject("Adodb.Recordset")
	Set rst1=Server.CreateObject("Adodb.Recordset")
	'重新计数
	rst.Open "Select classid From oblog_skinclass",conn,1,3
	rst1.Open "Select Count(id) ,Classid From oblog_userskin Where ispass=1 Group By classid",conn,1,3
	Do While Not rst.Eof
		rst1.Filter="classid=" & rst(0)
		If Not rst1.Eof Then
			oblog.Execute "Update oblog_skinclass Set icount=" & rst1(0) & " Where classid=" & rst(0)
		Else
			oblog.Execute "Update oblog_skinclass Set icount=0 Where classid=" & rst(0)
		End If
		rst.MoveNext
	Loop
	Set rst=Nothing
	Set rst1=Nothing
End Sub

sub savedefault()
	dim isdefaultID
	isdefaultID=trim(request("checkbox"))
		if instr(isdefaultID,",")>0 then
		Response.Write("<script language=javascript>alert('用户默认模板只可以选择一个!');history.back();</script>")
		Response.End()
	elseif isdefaultID="" then

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?