📄 news_add.asp
字号:
<!--#include file="../inc/CheckAdmin.asp"-->
<!--#include file="../inc/Config.asp"-->
<!--#include file="../inc/Navtree.asp"-->
<!--#include file="../inc/Conn.asp"-->
<!--#include file="setting.asp"-->
<%
Dim Language,table,Sortid
Language=formatStr(Request("Language"))
if Language="" then Language="C"
table_behind="NewsSort_"
table=Get_Table(table_behind,Language)
Sortid=request("Sortid")
if Sortid="" or not isnumeric(Sortid) then
Sortid=0
else
Sortid=request("Sortid")
end if
if request.form("add")=1 then
rs.open"select top 1 * from News where N_Sortid="&sortid&" and N_Language='"&Language&"' order by N_Order desc",conn,1,1
if not rs.eof then
Order=rs("N_Order")+1
else
Order=1
end if
rs.close
N_Name=request("N_Name")
content1=request("content1")
if Trim(Request.Form("Commend2"))="1" then
filepath=AspToHtml(N_Name,content1,Sortid,session("admin"),request("textimg"))
end if
rs.open"News",conn,1,3
rs.addnew
rs("N_Order")=Order
rs("N_Name")=request("N_Name")
rs("N_Language")=language
rs("N_Sortid")=Sortid
rs("N_Content")=request("content1")
'rs("N_Power")=request("power")
rs("N_Pic")=request("textimg")
'rs("N_Pic2")=request("textimage")
'rs("N_Model")=request("N_Model")
'rs("N_Price")=request("N_Price")
'rs("N_Memo")=request("Others")
rs("N_Special")=request("Commend")
rs("N_Address")=filepath
rs("N_Editor")=session("admin")
rs.update
closeconn
response.redirect("News_Admin.asp?language="&language&"&sortid="&sortid)
response.end
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>网站管理系统</title>
<link href="../Css_Main.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {color: #FF0000}
.style1 {color: #CCCCCC}
-->
</style>
</head>
<script language="JavaScript">
function Check()
{
if (form.language.value == "")
{alert("请选择语言版本");
form.language.focus();
return false;
}
if (form.Sortid.value == "")
{alert("请选择类别");
form.Sortid.focus();
return false;
}
if (form.N_Name.value == "")
{alert("新闻标题不能为空");
form.N_Name.focus();
return false;
}
document.form.submit();
}
</script>
<body>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
<tr>
<td class="title_dh"><div align="center">新闻中心——添加新闻</div></td>
</tr>
</table>
<form name="form" action="" method="post" onSubmit="return Check()">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="1" class="border">
<tr class="title_top">
<td colspan="2"><div align="center">添加新闻</div></td>
</tr>
<tr class="tdbg">
<td width="20%">
<div align="right"><strong>语言版本:</strong></div></td>
<td><!--#include file="../inc/Language.asp"-->
<input type="hidden" name="add" value=1 id="add">
<font color="#FF0000">*</font></td>
</tr>
<tr class="tdbg">
<td height="26"><div align="right"><strong>所属分类:</strong></div></td>
<td><select name="Sortid" id="Sortid">
<% If table<>"None" Then %>
<option value="">类别列表</option>
<%showtreefornav table,"NS_",0,"rs","",SortId,isadd %>
<% Else %>
<option value="" selected>没有分类</option>
<% End If %>
</select>
<font color="#FF0000">*</font></td>
</tr>
<tr class="tdbg">
<td><div align="right"><strong>新闻标题:</strong></div></td>
<td><input name="N_Name" type="text" id="N_Name" size="40">
<font color="#FF0000">*</font></td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(4)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong>新闻预览图:</strong></div></td>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td id="hiddenframe"><a style="cursor:hand" onClick="document.all.showframe.style.display='';document.all.hiddenframe.style.display='none';"> 上传图片</a> <a style="cursor:hand" onClick="document.all.adddz.style.display='';document.all.hiddenframe.style.display='none';">插入图片URL</a>
<input name="textimg" type="hidden" id="textimg"></td>
</tr>
<tr>
<td height="17" id="showframe" style="display:none"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="245" height="15"><iframe src='../inc/uppic.asp?up=../../uploadfile/News_Title/&tup=textimg' frameborder=0 height=25 width="100%" scrolling="no"></iframe> </td>
<td align="left" valign="baseline"><a style="cursor:hand" onClick="document.all.showframe.style.display='none';document.all.hiddenframe.style.display='';">取消</a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="17" id="adddz" style="display:none">
<input name="dz" type="text" id="dz" onChange="document.all.textimg.value=this.value" size="30" > <a style="cursor:hand" onClick="document.all.adddz.style.display='none';document.all.hiddenframe.style.display='';">取消</a> </td>
</tr>
</table></td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(0)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong>浏览权限:</strong></div></td>
<td><input name="power" type="radio" value="0" checked>
所有浏览者
<input name="power" type="radio" value="1">
普通会员
<input name="power" type="radio" value="2">
商务会员
<input name="power" type="radio" value="3">
VIP会员</td>
</tr>
<tr class="tdbg">
<td><div align="right"><strong>新闻内容:</strong></div></td>
<td><input type="hidden" name="content1">
<iframe ID="eWebEditor1" src="../WebEditor/ewebeditor.asp?id=content1&style=SamYan" frameborder="0" scrolling="no" width="560" HEIGHT="350"></iframe> </td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(1)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong>特殊标记:</strong></div></td>
<td><input name="Commend" type="checkbox" id="Commend" value="1">
推荐</td>
</tr>
<tr class="tdbg" style="display:<% If newsRadio(2)=1 Then %>''<% Else %>none<% End If %>">
<td><div align="right"><strong>生成静态网页:</strong></div></td>
<td><label>
<input type="radio" name="Commend2" value="1">
是
<input name="Commend2" type="radio" value="0" checked>
否</label></td>
</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="40">
<div align="center"><span class="style1">
<input name="Submit" type="button" id="Submit" value="添加" onClick="Check()">
<input name="reset" type="reset" id="reset" value="取消">
</span> </div></td>
</tr>
</table></form>
</body>
</html>
<%function AspToHtml(N_Name2,content2,id,adder,pic)
sql="select top 1 * from Temple where tp_flag=1 and TP_Language like '%"&Language&"%' and TP_SortId="&id&" order by Tp_id desc"
set rs=Server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
rs.close
exit function
end if
mb_code=rs("Tp_temple")
rs.close
c_title=N_Name2
c_content=content2
'lan=Trim(Request.Form("language"))
'response.Write lan
'response.End()
fname = makefilename(now()) ''makefilename为自定义函数
folder = "../../NewsCenter/"
filepath = folder&fname
'sql = "Select * from asp2html"
'Set rs = Server.CreateObject ("ADODB.Recordset")
'rs.Open sql,conn,3,2
'rs.addnew
'rs("a_title")=c_title
'rs("a_content")=c_content
'rs("a_filepath")=fname
'rs("A_language")=lan
'rs.update
'rs.close
c_title=htmlencode(c_title)
c_content=htmlencode(c_content)
mb_code=replace(mb_code,"$newstitle$",c_title)
mb_code=replace(mb_code,"$newspic$",pic)
mb_code=replace(mb_code,"$newscontent$",c_content)
mb_code=replace(mb_code,"$newsEditor$",adder)
'response.Write mb_code&"<br>"
'response.End()
paths=Server.MapPath(filepath)
'response.Write paths
'response.End()
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set fout = fso.CreateTextFile(paths, True)
fout.WriteLine mb_code
fout.close
AspToHtml=fname
end function%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -