|
|
kerweroice
发表于 2010-11-18 23:13:54
|
显示全部楼层
<!--#include file="mdb.asp"-->
<%
if session("adminlogin")<>sessionvar then
Response.Write("<script language=javascript>alert('你尚未登录,或者超时了!请重新登录');this.location.href='admin_login.asp';</script>")
Response.End
End if
dim id
dim site,siteurl,email,copyright,qq,classtitle,classlist,description,sitefamous,siteintro,searchkey,keywords
Dim f
Dim strTitle,strContent,strOut
if Session("level")<2 then
Call outcome("你的权限不足")
Response.End
End if
sql="select * from CNSITE_title"
set rs=conn.execute(sql)
site=rs("site")
siteurl=rs("siteurl")
email=rs("email")
copyright=rs("copyright")
qq=rs("qq")
logo=rs("logo")
weburl=rs("weburl")
adurl=rs("adurl")
stats=rs("stats")
classlist=rs("classlist")
classtitle=rs("classtitle")
description=rs("description")
keywords=rs("keywords")
searchkey=rs("searchkey")
sitefamous=rs("sitefamous")
siteintro=rs("siteintro")
link=rs("link")
rs.close
set rs=Nothing
id=request("id")
if id="" then
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK REL="stylesheet" HREF="css/style_right.css" TYPE="text/css">
</head>
<body>
<table width="96%" border="0" cellspacing="1" cellpadding="8" align="center" class="b">
<tr>
<td align="center">生成通用页面</td>
</tr></table>
<table width="96%" border="0" cellspacing="1" cellpadding="8" align="center" class="t">
<tr>
<td>网页编号</td>
<td>网页名称</td>
<td>网页是否存在</td>
<td>生成网页</td>
</tr>
<%
sql="select * from CNSITE_template order by id"
set rs=conn.execute(sql)
if rs.bof or rs.eof then
Response.write "<tr><td colspan='4'><font color=red>暂无模板</font></td></tr>"
else
Call listit()
end if
function listit()
rs.movefirst
while not rs.eof
response.write "<tr>"
response.write "<td>"&rs("id")&"</td><td>"&rs("name")&"</td>"
response.write "<td>"
Dim Location, PathInfo,I,fso
For I = 1 To Len(Request.ServerVariables("PATH_TRANSLATED"))
If Mid(Request.ServerVariables("PATH_TRANSLATED"), I, 1) = "\" Then
Location = I
End if
Next
PathInfo = Mid(Request.ServerVariables("PATH_TRANSLATED") , 1, Location)
filename = PathInfo&"../"&rs("html")&""
Set fso = CreateObject("Scripting.FileSystemObject") '使用Server.CreateObject方法,创建FSO对象模式。
If fso.FileExists(filename) Then '利用FSO模型的FileExists方法检查文件是否存在
Response.Write "已经生成"
Else
Response.Write "<font color='#FF0000'>未生成</font>"
End If
Set fso = Nothing
response.write "</td>"
response.write "<td><a href='admin_template_html.asp?id="&rs("id")&"'>点击生成</a></td>"
response.write "</tr>"
rs.movenext
wend
end function
rs.close
set rs=nothing
%>
<tr>
<td align="center" colspan="4">[<a href="http://www.xxxxx.com" target="_blank">WWW.xxxxx.COM</a>]</td>
</tr>
</table>
</body>
</html>
<%
else
sql="select * from CNSITE_template where id="&id
set rs=conn.execute(sql)
if rs.bof or rs.eof then
Call outcome("非法操作")
Response.End
else
name=rs("name")
html=rs("html")
strOut=rs("template")
rs.close
set rs=Nothing
end if
sql="select * from CNSITE_map"
set rs=conn.execute(sql)
a=rs("a")
b=rs("b")
a_table_top=rs("a_table_top")
a_tr_Circulation=rs("a_tr_Circulation")
a_table_end=rs("a_table_end")
c=rs("c")
d=rs("d")
c_table_top=rs("c_table_top")
c_tr_top=rs("c_tr_top")
c_tr_Circulation=rs("c_tr_Circulation")
c_tr_Packing=rs("c_tr_Packing")
c_tr_end=rs("c_tr_end")
c_table_end=rs("c_table_end")
rs.close
set rs=nothing
CNSITE_class_index=c_table_top
sql="select top "&c&" * from CNSITE_class where level=1 and xian=1 order by topid asc,classid asc"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,1,3
jishu=1
while not rs.eof
if jishu=1 or jishu mod d=1 then
CNSITE_class_index=CNSITE_class_index&replace(replace(c_tr_top,"{$CNSITE_c_classlink}",weburl&classlist&classtitle&rs("classid")&"/"),"{$CNSITE_c_classname}",rs("classname"))
else
CNSITE_class_index=CNSITE_class_index&replace(replace(c_tr_Circulation,"{$CNSITE_c_classlink}",weburl&classlist&classtitle&rs("classid")&"/"),"{$CNSITE_c_classname}",rs("classname"))
end if
if jishu mod d=0 then CNSITE_class_index=CNSITE_class_index&c_tr_end&vbCrLf
jishu=jishu+1
rs.movenext
wend
jishu=jishu-1
if jishu mod d<>0 then
for i=1 to d-(jishu mod d)
CNSITE_class_index=CNSITE_class_index&c_tr_Packing
if i=d-(jishu mod d) then CNSITE_class_index=CNSITE_class_index&c_tr_end
next
end if
rs.close
set rs=Nothing
CNSITE_class_index=CNSITE_class_index&c_table_end
strOut=Replace(strOut,"{$CNSITE_class_index}",CNSITE_class_index)
CNSITE_url_index=a_table_top
sql="select top "&a&" * from CNSITE_class where verity=1 and index=1 order by topid asc,classid asc"
set rs=conn.execute(sql)
while not rs.eof
noooo=noooo+1
if noooo mod 2 = 1 then
bgcolor=""
else
bgcolor=" class='dl'"
end if
CNSITE_url_index=CNSITE_url_index&Replace(Replace(a_tr_Circulation,"{$CNSITE_a_classlink}",weburl&classlist&classtitle&rs("classid")&"/"),"{$CNSITE_a_trcolor}",bgcolor)&vbCrLf
if rs("simplify")<>"" then
CNSITE_url_index=Replace(CNSITE_url_index,"{$CNSITE_a_classname}",rs("simplify"))
else
CNSITE_url_index=Replace(CNSITE_url_index,"{$CNSITE_a_classname}",rs("classname"))
end if
CNSITE_a_urllist=""
sql="select top "&b&" * from CNSITE_website where verity=1 and index=1 and classid="&rs("classid")&" order by topid asc,id asc"
set r=conn.execute(sql)
while not r.eof
if stats=1 or stats=2 then
CNSITE_a_urllist=CNSITE_a_urllist&"<dd><a target='_blank' href='goto/url/?id="&r("id")&"' title='"&r("memo")&"'"&r("color")&""&r("title")&"</a></dd>"
else
CNSITE_a_urllist=CNSITE_a_urllist&"<dd><a target='_blank' href='"&r("url")&"' title='"&r("memo")&"'"&r("color")&""&r("title")&"</a></dd>"
end if
r.movenext
wend
CNSITE_url_index=Replace(CNSITE_url_index,"{$CNSITE_a_urllist}",CNSITE_a_urllist)
rs.movenext
wend
r.close
set r=Nothing
rs.close
set rs=Nothing
CNSITE_url_index=CNSITE_url_index&a_table_end
strOut=Replace(strOut,"{$CNSITE_url_index}",CNSITE_url_index)
sql="select * from CNSITE_An where id=1"
set rs=conn.execute(sql)
CNSITE_an="<a href='/inc/announcement/' target='_blank'title='("&rs("An_time")&")'><font color='"&rs("An_color")&"'>"&rs("An_name")&"</font></a>"
rs.close
set rs=nothing
strOut=Replace(strOut,"{$CNSITE_An}",CNSITE_An)
strOut=Replace(strOut,"{$CNSITE_site}",site)
strOut=Replace(strOut,"{$CNSITE_siteurl}",siteurl)
strOut=Replace(strOut,"{$CNSITE_email}",email)
strOut=Replace(strOut,"{$CNSITE_copyright}",copyright)
strOut=Replace(strOut,"{$CNSITE_qq}",qq)
strOut=Replace(strOut,"{$CNSITE_searchkey}",searchkey)
strOut=Replace(strOut,"{$CNSITE_sitefamous}",sitefamous)
strOut=Replace(strOut,"{$CNSITE_siteintro}",siteintro)
strOut=Replace(strOut,"{$CNSITE_logo}",logo)
strOut=replace(strOut,"{$CNSITE_classlist}",classlist)
strOut=replace(strOut,"{$CNSITE_classtitle}",classtitle)
strOut=replace(strOut,"{$CNSITE_keywords}",keywords)
strOut=replace(strOut,"{$CNSITE_link}",link)
strOut=replace(strOut,"{$CNSITE_description}",description)
strOut=replace(strOut,"{$CNSITE_weburl}",weburl)
strOut=replace(strOut,"{$CNSITE_adurl}",adurl)
strOut=replace(strOut,"{$CNSITE_creattime}",date())
menulist=""
sql="select top 28 id,url,title from CNSITE_website where verity=1 order by [id] asc"
set cs=conn.execute(sql)
do while not cs.eof
if stats=1 or stats=2 then
menulist=menulist&"<li><a target='_blank' href='goto/url/?id="&cs(0)&"'>"&cs(2)&"</a></li>"
else
menulist=menulist&"<li><a target='_blank' href='"&cs(1)&"'>"&cs(2)&"</a></li>"
end if
cs.movenext
loop
set cs=nothing
strOut=replace(strOut,"{$CNSITE_newsurl}",menulist)
menulist=""
sql="select top 28 id,url,title from CNSITE_website where verity=1 and recommend=1 order by [id] asc"
set cs=conn.execute(sql)
do while not cs.eof
if stats=1 or stats=2 then
menulist=menulist&"<li><a target='_blank' href='goto/url/?id="&cs(0)&"'>"&cs(2)&"</a></li>"
else
menulist=menulist&"<li><a target='_blank' href='"&cs(1)&"'>"&cs(2)&"</a></li>"
end if
cs.movenext
loop
set cs=nothing
strOut=replace(strOut,"{$CNSITE_recommendurl}",menulist)
Set fso=Server.CreateObject("Scripting.FileSystemObject")
Set f=fso.CreateTextFile(Server.MapPath("../"&html&""),true)
f.WriteLine strOut
f.close
set f=Nothing
set fso=Nothing
Call outcome("生成"&name&"成功")
Response.End
end if
%> |
|