|
国外空间网站开始生成静态页面乱码,我将<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> 加入到asp中,静态页面可以生成但是是空白页,请求帮助{:2_224:}
<% @language=vbscript codepage=936%>
<!--#Include File="../Include/HH_Main.Asp" -->
<%
Dim Rs,SQL
dim Title,Content,Newfrom,Typeid,Typename,Author,HotNew,BestNew,Flag,SQL_Data,TT_FenYe
'//检测是否跨站访问
Call Check_url()
'//检测管理员是否有权限操作该页面
If Instr(1,Session("TT_Power"),"160") <= 0 Then
Call ConnClose()
Response.write "对不起!您没有访问该页面的权限..."
Response.End()
End If
Title = Replace_Text(Request.Form("Title"))
Content = Request.Form("n_Content")
Newfrom = Replace_Text(Request.Form("Newfrom"))
Typeid = Replace_Text(Request.Form("Typeid"))
Author = Replace_Text(Request.Form("Author"))
TypeName = TT_Typename(Typeid)
'//检测参数是否为空值
If Request("title")="" Then
response.write "错误提示:请输入文章标题!"
response.end
End if
If Request("n_content")="" Then
response.write "错误提示:请未输入文章内容!"
response.end
End if
'//判断使用哪个模板,也就是判断分页字符在新闻中出现的次数
FenYe=split(Content,"{$分页$}")
FenYe_Count=Ubound(FenYe)
'//判断使用哪个模板,结束,FenYe_Count=0则使用../Aqcs/Aqcs_MoBan.htm"否则使用../Aqcs/Aqcs_MoBan1.htm"
'--------------------------------------------------------
If FenYe_Count=0 Then
m_path = Server.mappath("../Aqcs/Aqcs_moban/Aqcs_MoBan.htm")
Else
m_path = Server.mappath("../Aqcs/Aqcs_moban/Aqcs_MoBan1.htm")
End If
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If Not(fso.FileExists(m_path)) Then%>
<script language=javascript>
alert( "生成失败,模板文件不存在!" );
location.href = "javascript:history.back()"
</script>
<%
Else
Set fso_line = fso.opentextfile(m_path,1,True)
mynews = fso_line.readall
End if
Set Fso = Nothing
'//生成文件名
F = TypeId&Makefilename(now())
Fname=F&".html"
mydate = year(now()) & "年" & month(now()) & "月" & day(now()) & "日"
'//替换内容
If FenYe_Count=0 Then
mynews=replace(mynews,"{$TT_Title$}",title)
mynews=replace(mynews,"{$TT_ZuoZhe$}",author)
mynews=replace(mynews,"{$TT_AddDate$}",mydate)
mynews=replace(mynews,"{$TT_Content$}",Content)
mynews=replace(mynews,"{$TT_Meta$}",TypeName)
FilePath = Server.mappath("../Aqcs/News")
'----------------------------------------------------------
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile (filePath& "\" & fname)
fout.WriteLine mynews
fout.close
Set Fso = Nothing
'//插入记录
SQL = "Insert Into [HH_News] (Title,FileName,Path,Content,Typeid,Author,NewFrom,Hits,DateAndTime) Values ('"&Title&"','"&Fname&"','Aqcs/News','"&Content&"',"&Typeid&",'"&Author&"','"&NewFrom&"',0,'"&Now()&"')"
Conn.Execute(SQL)
Else
'//先计算出来分页的内容
'//生成页
mynews1=mynews
For SQL_Data=0 To FenYe_Count
TT_FenYe=""
For SQL_Data1=0 To FenYe_Count
If SQL_Data=SQL_Data1 Then
TT_FenYe=TT_FenYe&" "&"[<strong>"&SQL_Data1+1&"</strong>]</font> "
Else
TT_FenYe=TT_FenYe&" "&"<a href="&F&"_"&SQL_Data1+1&".html>["&SQL_Data1+1&"]</a> "
End If
next
mynews=mynews1
mynews=replace(mynews,"{$TT_Title$}",title)
mynews=replace(mynews,"{$TT_ZuoZhe$}",author)
mynews=replace(mynews,"{$TT_AddDate$}",mydate)
mynews=replace(mynews,"{$TT_Content$}",FenYe(SQL_Data))
mynews=replace(mynews,"{$TT_Meta$}",TypeName)
mynews=replace(mynews,"{$TT_FenYe$}",TT_FenYe)
FilePath = Server.mappath("../Aqcs/News")
'----------------------------------------------------------
Set fso = Server.CreateObject("Scripting.FileSystemObject")
fname_=F&"_"&SQL_Data+1&".html"
Set fout = fso.CreateTextFile (filePath& "\" & fname_)
fout.WriteLine mynews
fout.close
Set Fso = Nothing
next
'//插入记录
Fname=F&"_1.html"
SQL = "Insert Into [HH_News] (Title,FileName,Path,Content,Typeid,Author,NewFrom,Hits,DateAndTime) Values ('"&Title&"','"&Fname&"','Aqcs/News','"&Content&"',"&Typeid&",'"&Author&"','"&NewFrom&"',0,'"&Now()&"')"
Conn.Execute(SQL)
End If
Call ConnClose()
%>
<html>
<head>
<title>保存爱情测试</title>
<LINK href="Css/Css_M.css" type=text/css rel=stylesheet>
<style type="text/css">
<!--
.STYLE1 {
font-size: 14px;
font-weight: bold;
}
-->
</style>
</head>
<BODY bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" text="#FFFFFF">
<div align="center">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5"></td>
</tr>
<tr>
<td height="25" bgcolor="fb7a03"> <font color="#FFFFFF">::<strong>添加爱情测试</strong></font></td>
</tr>
<tr>
<td height="10"></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1">
<tr>
<td align="left"> <table width="100%" border="0" align="left" cellpadding="0" cellspacing="1" bgcolor="eff0eb">
<tr>
<td bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr bgcolor="eff0eb">
<td height="25" align="left"><table width="50%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25"> </td>
</tr>
<tr>
<td height="25">添加爱情测试成功...</td>
</tr>
<tr>
<td height="25">文件标题:<%= Title %>
</td>
</tr>
<tr>
<td height="25" align="center">>> <a href="New_Aqcs_Manage.asp">爱情测试管理</a>
| >> <a href="New_Aqcs_Add.asp">继续添加</a></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="5"></td>
</tr>
</table>
</div>
</body>
</html>
|
|