www.gusucode.com > cso中国seo优化html整站源码程序 > manage/info/i_fei886.asp

    <!--#include file="../include/head.asp"-->
<%
flagstr = "i_fei886"
call checkflag(flagstr)
session("curpage") = "info/"&flagstr&".asp"
main_title = "产品文章"
%>
<table cellspacing="1">
	<thead><tr><th><%=main_title%>管理选项</th></tr></thead>
	<tbody><tr><td>
		<a class="add" href="?act=add">添加<%=main_title%></a>
		<a class="man" href="?act=man">管理<%=main_title%></a>
		<a class="del" href="?act=crt">生成全部<%=main_title%>路径[耗费资源,尽量少用!]</a>
	</td></tr></tbody>
<%
c = request.querystring("c")
s = request.querystring("s")
%>
	<tbody><tr><td>
		<a href="?act=man&c=&s="<%if c = "" then response.write " class=""cur"""%>>全部大类</a>
<%
sql = "select * from so_class where typestr = 'fei886' order by orderid desc,id asc"
rs.open sql,conn,1,1
do while not rs.eof
	if c = "" then
%>
		<a href="?act=man&c=<%=rs("id")%>&s="><%=rs("title")%></a>
<%
	else
%>
		<a href="?act=man&c=<%=rs("id")%>&s="<%if cint(c) = rs("id") then response.write " class=""cur"""%>><%=rs("title")%></a>
<%
	end if
rs.movenext
loop
rs.close
%>
	</td></tr></tbody>
	<%if c <> "" then%>
	<tbody><tr><td>
		<a href="?act=man&c=<%=c%>&s="<%if s = "" then response.write " class=""cur"""%>>全部小类</a>
<%
sql = "select * from so_class where typestr = 'fei886_small' and classid = "&c&" order by orderid desc,id asc"
rs.open sql,conn,1,1
do while not rs.eof
	if s = "" then
%>
		<a href="?act=man&c=<%=rs("classid")%>&s=<%=rs("id")%>"><%=rs("title")%></a>
<%
	else
%>
		<a href="?act=man&c=<%=rs("classid")%>&s=<%=rs("id")%>"<%if cint(s) = rs("id") then response.write " class=""cur"""%>><%=rs("title")%></a>
<%
	end if
rs.movenext
loop
rs.close
%>
	</td></tr></tbody>
	<%end if%>
</table>
<br />
<%
act = request.querystring("act")
nid = request.querystring("nid")
what = request.querystring("what")
page = int(request.querystring("page"))
select case request.querystring("act")
	case "all"
		call so_article_all()
	case "man"
		call so_article_man(page)
	case "add"
		call so_article_edit("add",0)
	case "edit"
		call so_article_edit("edit",nid)
	case "save"
		call so_article_save(what,nid)
	case "delete"
		call so_article_delete(nid)
	case "crt"
		sql = "select * from so_article where typestr = 'fei886'"
		rs.open sql,conn,1,1
		idlist = ""
		k = 1
		if not rs.eof then
		do while not rs.eof
			if k = 1 then
				idlist = rs("id")
			else
				idlist = idlist & "," & rs("id")
			end if
		k = k + 1
		rs.movenext
		loop
		end if
		rs.close
		call so_class_create(idlist)
end select


'创建静态路径
sub so_class_create(idlist)
sql = "select * from so_article where typestr = 'fei886' and id in ("&idlist&")"
rs.open sql,conn,2,2
if not rs.eof then
	do while not rs.eof
		'创建路径
		folderpath = "/article/"&id2formstr(rs("classid"),"so_class","nickname")&"/"
		call createfolder(folderpath)
		'是否有小分类
		if rs("smallid") <> 0 then
			folderpath = folderpath & id2formstr(rs("smallid"),"so_class","nickname") & "/"
			call createfolder(folderpath)
		end if
		folderpath = folderpath & rs("id") & "/"
		call createfolder(folderpath)
		filepath = folderpath & "index.html"
		call createfile(filepath)
		'写入状态
		rs("reg_html") = 1
		rs("url_html") = folderpath
		rs.update
		'读取参数
		curid = rs("id")
		title = rs("title")
		page_title = rs("page_title")
		page_keywords = rs("page_keywords")
		page_description = rs("page_description")
		
		datestr = formatdatetime(rs("datestr"),1)
		author = rs("author")
		url = rs("url")
		content = rs("content")
		page_keywords_split = replace(page_keywords,",","</strong> <strong>")
		lv2str = ">> <a href="""&id2formstr(rs("classid"),"so_class","url_html")&""">"&id2formstr(rs("classid"),"so_class","title")&"</a>"
		if rs("smallid") <> 0 then
			lv3str = ">> <a href="""&id2formstr(rs("smallid"),"so_class","url_html")&""">"&id2formstr(rs("smallid"),"so_class","title")&"</a>"
		else
			lv3str = ""
		end if
		
		nav_top = display_nav_top()
		nav_all = display_nav_all()
		class_title = id2formstr(rs("classid"),"so_class","title")
		hot_list = display_hot_list(rs("smallid"))
		rnd_list = display_rnd_list()
		'读取模板
		myhtml = readfile("/template/article.asp","gb2312")
		'替换模板中参数
		myhtml = replace(myhtml,"{$curid}",curid)
		myhtml = replace(myhtml,"{$title}",title)
		myhtml = replace(myhtml,"{$page_title}",page_title)
		myhtml = replace(myhtml,"{$page_keywords}",page_keywords)
		myhtml = replace(myhtml,"{$page_description}",page_description)
		
		myhtml = replace(myhtml,"{$datestr}",datestr)
		myhtml = replace(myhtml,"{$author}",author)
		myhtml = replace(myhtml,"{$url}",url)
		myhtml = replace(myhtml,"{$content}",content)
		myhtml = replace(myhtml,"{$page_keywords_split}",page_keywords_split)
		myhtml = replace(myhtml,"{$lv2str}",lv2str)
		myhtml = replace(myhtml,"{$lv3str}",lv3str)
		
		myhtml = replace(myhtml,"{$nav_top}",nav_top)
		myhtml = replace(myhtml,"{$nav_all}",nav_all)
		myhtml = replace(myhtml,"{$class_title}",class_title)
		myhtml = replace(myhtml,"{$hot_list}",hot_list)
		myhtml = replace(myhtml,"{$rnd_list}",rnd_list)
		'写入目标文件
		call write2file(filepath,myhtml,"gb2312")
	rs.movenext
	loop
end if
rs.close
call redir("?act=man")
end sub

'顶部导航
function display_rnd_list()
dim rs,sql,temp
set rs = server.createobject("adodb.recordset")
temp = ""
randomize(timer())
sql = "select top 10 * from so_article where typestr = 'fei886' order by rnd(-(id & "& int((10000 * rnd()) + 1)& "))"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
	temp = temp & "<li><a href="""&rs("url_html")&""" title="""&rs("page_title")&""">"&rs("title")&"</a></li>"
rs.movenext
loop
end if
rs.close
display_rnd_list = temp
end function

'顶部导航
function display_nav_top()
dim rs,sql,temp
temp = "<a href=""/"" title=""快速减肥首页"">快速减肥首页</a>"
set rs = server.createobject("adodb.recordset")
bigid = ""
sql = "select * from so_class where typestr = 'fei886' and reg = 1 order by orderid desc,id asc"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
	bigid = bigid & rs("id") & ","
rs.movenext
loop
end if
rs.close

bstr = split(bigid,",")
for i = 0 to ubound(bstr) - 1
	btitle = id2formstr(bstr(i),"so_class","title")
	burl = id2formstr(bstr(i),"so_class","url_html")
	temp = temp & " | <a href="""&burl&""" title="""&btitle&""">"&btitle&"</a>"
	sql = "select * from so_class where classid = "&bstr(i)&" and reg = 1 order by orderid desc,id asc"
	rs.open sql,conn,1,1
	if not rs.eof then
	do while not rs.eof
	temp = temp & " <span><a href="""&rs("url_html")&""" title="""&rs("title")&""">"&rs("title")&"</a></span>"
	rs.movenext
	loop
	end if
	rs.close
next
display_nav_top = temp
end function

'全部导航
function display_nav_all()
dim rs,sql,temp
temp = ""
set rs = server.createobject("adodb.recordset")
sql = "select * from so_class where typestr = 'fei886' order by orderid desc,id desc"
rs.open sql,conn,1,1
abig = ""
do while not rs.eof
abig = abig & rs("id") & "," & rs("title") & "$"
rs.movenext
loop
rs.close
bigstr = split(abig,"$")
for i = 0 to ubound(bigstr) - 1
	temp = temp & "<dl><dt><a href="""&id2formstr(split(bigstr(i),",")(0),"so_class","url_html")&""">"&split(bigstr(i),",")(1)&"</a></h2></dt><dd>"
	sql = "select * from so_class where classid = "&split(bigstr(i),",")(0)&" order by orderid desc,id desc"
	rs.open sql,conn,1,1
	if not rs.eof then
	do while not rs.eof
		temp = temp & " <a href="""&rs("url_html")&""" title="""&rs("page_title")&""">"&rs("title")&"</a>"
	rs.movenext
	loop
	end if
	rs.close 
	temp = temp & "</dd></dl>"
next
display_nav_all = temp
end function

'热门链接
function display_hot_list(smallid)
dim rs,sql,temp
temp = ""
set rs = server.createobject("adodb.recordset")
sql = "select top 10 * from so_article where smallid = "&smallid&" order by hits desc,id desc"
rs.open sql,conn,1,1
if not rs.eof then
do while not rs.eof
	temp = temp & "<li><a href="""&rs("url_html")&""" title="""&rs("page_title")&""">"&rs("title")&"</a></li>"
rs.movenext
loop
end if
rs.close
display_hot_list = temp
end function

'存储表单
sub so_article_save(what,nid)
select case what
	case "add"
		sql = "select * from so_article"
		rs.open sql,conn,1,3
		rs.addnew
		nid = rs.fields("id")
		rs("typestr") = "fei886"
		response.cookies(config_cname)("classid") = trim(request.form("classid"))
		response.cookies(config_cname)("smallid") = trim(request.form("smallid"))
	case "edit"
		sql = "select * from so_article where id = "&nid
		rs.open sql,conn,2,2
end select

rs("title") = trim(request.form("title"))
rs("datestr") = trim(request.form("datestr"))
rs("hits") = trim(request.form("hits"))
rs("page_title") = trim(request.form("page_title"))
rs("page_keywords") = trim(request.form("page_keywords"))
rs("page_description") = trim(request.form("page_description"))
rs("author") = trim(request.form("author"))
rs("url") = trim(request.form("url"))
rs("content") = request.form("content")
rs("pic_min") = trim(request.form("pic_min"))
rs("classid") = trim(request.form("classid"))
rs("smallid") = trim(request.form("smallid"))

rs.update
rs.close
call so_class_create(nid)
select case what
	case "add"
		call redir("?act=add")
	case "edit"
		call redir("?act=man")
end select
end sub

'编辑表单
sub so_article_edit(act,nid)
select case act
	case "edit"
		actstr = "编辑"
		sql = "select * from so_article where id = "&nid
		rs.open sql,conn,1,1
		title = rs("title")
		datestr = rs("datestr")
		hits = rs("hits")
		page_title = rs("page_title")
		page_keywords = rs("page_keywords")
		page_description = rs("page_description")
		author = rs("author")
		url = rs("url")
		pic_min = rs("pic_min")
		content = rs("content")
		classid = rs("classid")
		smallid = rs("smallid")
		rs.close
	case "add"
		actstr = "添加"
		title = ""
		datestr = now()
		hits = 0
		page_title = ""
		page_keywords = ""
		page_description = ""
		author = "本站整理"
		url = config_url
		pic_min = ""
		content = ""
		classid = cint(request.cookies(config_cname)("classid"))
		smallid = cint(request.cookies(config_cname)("smallid"))
end select
%>
<table cellspacing="1">
	<thead><tr><th colspan="2"><%=main_title%>——<%=actstr%></th></tr></th>
	<form method="post" name="add" action="?act=save&what=<%=act%>&nid=<%=nid%>">
	<tbody>
		<tr>
			<td><b>标题:</b></td>
			<td><input type="text" name="title" value="<%=title%>" size="26" /></td>
		</tr>
		<tr>
			<td><b>大分类:</b></td>
			<td id="classid"><%=classlist("fei886",classid)%></td>
		</tr>
		<tr>
			<td><b>小分类:</b></td>
			<td id="smallid"><script type="text/javascript">$(document).ready(function(){$("#smallid").load("/manage/ajax/smallid.asp?t=fei886&classid=<%=classid%>&smallid=<%=smallid%>");});</script></td>
		</tr>
		<tr>
			<td><b>发布时间:</b></td>
			<td><input type="text" name="datestr" value="<%=datestr%>" size="18" /></td>
		</tr>
		<tr>
			<td><b>点击次数:</b></td>
			<td><input type="text" name="hits" value="<%=hits%>" size="6" /><em>作弊用</em></td>
		</tr>
		<tr>
			<td><b>文章来源:</b></td>
			<td><input type="text" name="author" value="<%=author%>" size="26" /></td>
		</tr>
		<tr>
			<td><b>来源地址:</b></td>
			<td><input type="text" name="url" value="<%=url%>" size="48" /></td>
		</tr>
		<tr>
			<td><b>页面标题:</b></td>
			<td><input type="text" name="page_title" value="<%=page_title%>" size="48" /><em>title标签</em></td>
		</tr>
		<tr>
			<td><b>页面关键字:</b></td>
			<td><input type="text" name="page_keywords" value="<%=page_keywords%>" size="36" /><em>meta元素</em></td>
		</tr>
		<tr>
			<td><b>页面摘要:</b></td>
			<td><textarea name="page_description" cols="78" rows="4"><%=page_description%></textarea></td>
		</tr>
		<tr>
			<td><b>预览图片:</b></td>
			<td><input type="text" name="pic_min" value="<%=pic_min%>" size="36" />
			<input type="button" value="上传图片" name="upload" class="button" onclick="window.open('../upload.asp?uppath=<%=server.urlencode("/upload")%>&formname=add&editname=pic_min','upload','width=420,height=100')" /><em>图片大小:宽120像素、高120像素</em></td>
		</tr>
		<tr>
			<td><b>详细内容:</b></td>
			<td><textarea name="contentx" style="display:none;"><%=content%></textarea>
				<script type="text/javascript">
					var sBasePath = "/editor/";
					var oFCKeditor = new FCKeditor("FCKeditor1") ;
					oFCKeditor.BasePath	= sBasePath ;
					oFCKeditor.Config['CustomConfigurationsPath'] = sBasePath + "custom.config.js" ;
					oFCKeditor.ToolbarSet = "manage" ;
					oFCKeditor.InstanceName = "content" ;
					oFCKeditor.Width = 600;
					oFCKeditor.Height = 500;
					oFCKeditor.Value = document.add.contentx.value ;
					oFCKeditor.Create() ;
				</script>
			</td>
		</tr>
		<tr>
			<td width="20%"></td>
			<td width="80%"><input type="submit" value="确认提交" /></td>
		</tr>
	</tbody>
	</form>
</table>
<%
end sub

'管理列表
sub so_article_man(page)
%>
<table cellspacing="1">
	<thead><tr>
		<th width="5%">选择</th>
		<th width="5%">推荐</th>
		<th width="5%">静态</th>
		<th width="10%">分类</th>
		<th width="30%">标题</th>
		<th width="35%">路径</th>
		<th width="10%">操作</th>
	</tr></thead>
	<form action="?act=all" method="post" id="allc">
<%
if c = "" then
	str_c = ""
else
	str_c = " and classid = "&c
end if
if s = "" then
	str_s = ""
else
	str_s = " and smallid = "&s
end if
sql = "select * from so_article where typestr = 'fei886' "&str_c&str_s&" order by reg_top = 1,orderid desc,id desc"
rs.open sql,conn,1,1
if rs.eof then
%>
	<tbody><tr><td align="center" colspan="20">暂无内容!</td></tr></tbody>
<%
else
rs.pagesize = config_manpage
if page = 0 then page = 1
if page = "" then page = 1
rs.AbsolutePage = page
pagec = rs.pagecount
for i = 1 to rs.pagesize

if rs("reg_top") = 1 then
	topstr = "<u>推荐</u>"
else
	topstr = ""
end if
if rs("reg_html") = 1 then
	htmlstr = "<i>静态</i>"
	urlstr = rs("url_html")
else
	htmlstr = "<u>动态</u>"
	urlstr = "/article.asp?nid="&rs("id")
end if
%>
	<tbody><tr>
		<td align="center"><input type="checkbox" value="<%=rs("id")%>" name="allid" /></td>
		<td align="center"><%=topstr%></td>
		<td align="center"><%=htmlstr%></td>
		<td><%=id2formstr(rs("classid"),"so_class","title")%></td>
		<td><%if rs("smallid") <> 0 then%>[<%=id2formstr(rs("smallid"),"so_class","title")%>]<%end if%><a href="?act=edit&nid=<%=rs("id")%>" class="mod"><%=rs("title")%></a></td>
		<td><a href="<%=urlstr%>" target="_blank" class="add"><%=urlstr%></a></td>
		<td align="center">
			<a href="?act=edit&nid=<%=rs("id")%>" class="mod">编辑</a>
			<a href="?act=delete&nid=<%=rs("id")%>" class="del" onclick="return del()">删除</a>
		</td>
	</tr></tbody>
<%
rs.movenext
if rs.eof then exit for
next
%>
	<tbody><tr><td colspan="20"><div id="dispartpage"><%=dispartpage(page,pagec,"act=man&")%></div></td></tr></tbody>
	<tbody><tr><td colspan="20">
		<input type="button" value="全选" name="allid" id="allbtn" />
		<select name="opt">
			<option value="crt">生成静态路径</option>
			<option value="top">推荐</option>
			<option value="top_no">取消推荐</option>
			<option value="delete">删除</option>
		</select>
		<input type="submit" value="批量操作" />
	</td></tr></tbody>
	</form>
<%
end if
rs.close
%>
</table>
<%
end sub

sub so_article_all()
opt = request.form("opt")
allid = request.form("allid")
select case opt
	case "delete"
		conn.execute "delete * from so_article where id in ("&allid&")"
	case "top"
		conn.execute "update so_article set reg_top = 1 where id in ("&allid&")"
	case "top_no"
		conn.execute "update so_article set reg_top = 0 where id in ("&allid&")"
	case "crt"
		call so_class_create(allid)
end select
call redir("?act=man")
end sub

sub so_article_delete(nid)
conn.execute "delete * from so_article where id = "&nid
call redir("?act=man")
end sub
%>
<!--#include file="../include/foot.asp"-->