"插入資料庫連接檔案
<!--#include file="conn.asp"-->
"插入解釋HTM代碼檔案,下一節將為大家介紹,主要是對HTM代碼進行轉化,以免出現頁面格式上的混亂,而且也更方便對技術性文章的發表
<!--#include file="articlechar.inc"-->
"如果不是從管理頁面進入,則轉到驗證管理員資訊頁面
<%
if request.cookies("adminok")="" then
response.redirect "login.asp"
end if
%>
<%
dim typename
dim title
dim content
dim sql
dim rs
dim articleid
dim typeid
"接受從addarticle.asp處返回的文章內容資訊,這裡的htmlencode2是對HTM代碼進行轉化的程式,包含在articlechar.inc裡面
title=htmlencode2(request.form("txttitle"))
content=htmlencode2(request.form("txtcontent"))
typeid=request.form("typeid")
"開啟指定記錄集,並具有寫的許可權
set rs=server.createobject("adodb.recordset")
sql="select * from article where (articleid is null)"
rs.open sql,conn,1,3
"對指定記錄集進行增加,這裡的addnew就是增加資料庫內容的對象,如果沒有addnew只有update那麼就是對其進行更新
rs.addnew
rs("title")=title
rs("content")=content
rs("typeid")=typeid
rs("date")=date()
rs.update
articleid=rs("articleid")
"關閉開啟的記錄集和資料庫連接
rs.close
set rs=noting
conn.close
set conn=nothing
%>
<head>
</head>