📄 admin_add.asp
字号:
<!--#include file="Include/Gaobei_setup.asp"-->
<!--#include file="Conn.asp"-->
<!--#include file="include/char.asp" -->
<!--#include file="Include/check.asp"-->
<!--#include FILE="Include/Admin_Function.asp"-->
<%CheckAdmin1%>
<%
'信息的添加----------------
If Request("action")="add" Then
SortID=trim(Request.Form("SortId"))
If SortID="isnull" Then
Response.Write "<script>alert(""请选择信息类型!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
if SortID="null" Then
Response.Write "<script>alert(""你选的类别有二级分类,请选一个二级分类!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
if Request.form("title")="" Then
Response.Write "<script>alert(""请输入信息标题!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
if Request.form("Content")="" Then
Response.Write "<script>alert(""请输入信息内容!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
if Request.form("Key")="" Then
Response.Write "<script>alert(""请输入关键字!"");location.href=""javascript:history.back()"";</script>"
Response.end()
end if
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from Info"
rs.open sql,conn,1,3
rs.addnew
SortID=Request.Form("SortId")
Sort1=left(SortID,Instr(SortID,"|")-1) '到字符“|”的长度减去1取得ID长度
Sort2=right(SortID,len(SortID)-Instr(SortID,"|")) '总长减去到字符“|”的长度
rs("Sort1")=Sort1
rs("Sort2")=Sort2
rs("Title")=Server.HTMLEncode(Trim(Request("Title")))
rs("Pic")=Request("Pic")
if request("SavePic")=1 then
sContent = Request("Content")
sContent = eWebEditor_ReplaceRemoteUrl(sContent, "UploadFile/", "bmp|jpg|gif")
rs("Content")=sContent
else
rs("Content")= request("content")
end if
rs("Key")=server.HTMLEncode(Trim(Request("Key")))
rs("Date")=server.HTMLEncode(Trim(Request("Date")))
rs("writer")=server.HTMLEncode(Trim(Request("writer")))
rs("writefrom")=server.HTMLEncode(Trim(Request("writefrom")))
rs("ReadGrade")=server.HTMLEncode(Trim(Request("ReadGrade")))
if Request("Pw_Good")<>"" then
rs("Pw_Good")=Request("Pw_Good")
else
rs("Pw_Good")=False
end if
rs("author")=Session(GaobeiManageUser)
rs("AddDate")=DATE()
if Request("Pic")<>""then
rs("Ispic")=1
else
rs("Ispic")=0
end if
rs.update
rs.close
Response.Write "<script>alert(""发布成功"");location.href=""Admin_Add.asp"";</script>"
Response.End
end if
%>
<!--ADD-->
<link href="other/admin.css" rel="stylesheet" type="text/css">
<!--#include file="Admin_all_article.asp"-->
<script language="JavaScript" type="text/JavaScript">
// 信息表单提交客户端检测
function doSubmit(){
if (document.form.SortID.value=="Add"){
alert("请先添加信息类型!");
return false;
}
if (document.form.SortID.value=="isnull"){
alert("请选择信息类型!");
return false;
}
if (document.form.SortID.value=="null"){
alert("你选的类别有二级分类,请选一个二级分类!!");
return false;
}
if (document.form.title.value==""){
alert("信息标题不能为空!");
return false;
}
if (document.form.key.value==""){
alert("关键字不能为空!");
return false;
}
if (Content.getHTML()==""){
alert("新闻内容不能为空!");
return false;
}
return true;
}
</script>
<body leftmargin="1" topmargin="8">
<form action="?action=add" method="POST" name="form" id="form" onsubmit="return doSubmit()">
<table width="590" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#CCCCCC">
<tr valign="middle" bgcolor="#EAEAEA">
<td height="25" align="center">添 加 信 息</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23" align="left" valign="middle"> 信息类型:
<select name="SortID" id="SortID">
<%
Sql = "select * from Sort where B_id=0 and setting<>4 and setting<>5 order by S_Order "
Set Rs=Conn.Execute(Sql )
if rs.eof and rs.bof then
response.write "<option selected value='Add' selected>===请先添加栏目===</option>"
else
%>
<option value="isnull">===请选择栏目===</option>
<%
do while not rs.eof
%>
<option value=<%if Rs("Setting")<3 then%>"null"<%end if%><%if Rs("Setting")=3 then%>"<%=trim(RS("Id"))%>|0"<%end if%>><%=trim(rs("Names"))%></option>
<% if Rs("Setting")<3 then%>
<%
SqlClass = "Select * from Sort where B_ID= "& Rs("ID") &" and setting<>3 order by S_Order "
Set RsClass = Conn.Execute(SqlClass)
if RsClass.eof and RsClass.bof then
Response.write("")
else
do while not RsClass.eof
%>
<option value="<%=trim(RS("Id"))%>|<%=trim(RsClass("Id"))%>">├<%=trim(RsClass("Names"))%></option>
<%
RsClass.movenext
loop
end if
RsClass.close
set RsClass=nothing
%>
<%end if %>
<%
rs.movenext
loop
end if
rs.close
set rs = nothing
conn.Close
set conn = nothing
%>
</select> </td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23" align="left" valign="middle"> 信息标题:
<input type="text" name="title" size="40" id="信息标题" maxlength="100">
<input name="Pw_Good" type="checkbox" id="Pw_Good" style="border:0px" value="True"> 推荐 (首页图文显示)</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23" align="left" valign="middle"> 内容/图片:
<input name="pic" type="text" id="pic" size="39" >
[<a href="JavaScript:openem()">上传图片</a>][<a href="javascript:preview()">图片预览</a>]
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td align="left" valign="middle">
<textarea name="Content" id="Content" style="display:none"></textarea>
<IFRAME ID="Content1" SRC="editor.asp?id=Content" FRAMEBORDER="0" SCROLLING="no" WIDTH="590" HEIGHT="425"></IFRAME>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23" valign="middle"> 相关信息:
<input name=Key type="text"class="smallinput" ID=Key value="关键字" size="23" maxlength="50">
来源:
<input type="text" name="writefrom" size="20"
class="smallinput" maxlength="100" value="" id="来源"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="23" align="left" valign="middle"> 发布日期:
<input name="Date" type="text" id="时间" value="<%=Date()%>" size="23" readonly>
作者:
<input type="text" name="writer" size="20"
class="smallinput" maxlength="100" value="" id="writer"></td>
</tr>
<tr bgcolor="#FFFFFF">
<td height="26" align="left" valign="middle"> <strong>保存远程图片</strong>:
<input name="SavePic" type="checkbox" style="border:0px" value="1">
是
<strong>阅读等级</strong>:
<select name="ReadGrade" id="ReadGrade">
<option value="0" selected>游客可读</option>
<option value="1">普通用户</option>
<option value="2">VIP 用户</option>
</select></td>
</tr>
<tr bgcolor="#EAEAEA">
<td height="23" align="center"> <input name="cmdok" type="submit" class="buttonface" value=" 添 加 " onClick="return doSubmit()">
<input type="reset" value=" 清 除 "
name="cmdcancel" class="buttonface"> </td>
</tr>
</table>
</form>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -