📄 savearticle.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
' Project Name: Simple Blog
' Version: 1.1
' Author: James Tang
' Email: fwsous@gmail.com
' Web site: www.fwso.cn
' Copyright (C) 2008 James Tang. All Rights Reserved.
'
' Note: This program can be used for any purpose for free.
'
%>
<!--#include file="isLogin.asp"-->
<!--#include file="../lib/util.asp"-->
<!--#include file="../lib/const.asp"-->
<%
If isLogin() = false then
Response.Redirect("../register.asp")
End If
%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Save Artilce</title>
</head>
<body>
<%
Dim articleTitle, articleContent, catID, articleSQL, errorMsg, responseData, enableHTML
enableHTML = true
articleTitle = Replace(cleanHtml(Request.Form("articleTitle")), "'", "''")
articleContent = Replace(Request.Form("articleContent"), "'", "''")
catID = Request.Form("articleCategory")
articleSQL = "INSERT INTO articles (article_title, article_content, cat_id, user_id) VALUES ('" + articleTitle + "', '" + articleContent + "', " + catID + ", " + cStr(Session("userID")) + ")"
On Error Resume Next
conn.execute articleSQL
If Err <> "" Then
errorMsg = "Error Number: " + Err.Number + " Error Description: " + Err.Description
Err.Clear
End IF
responseData = "{"
responseData = responseData + """Title"": """ + articleTitle + ""","
' The following commented out line is just used to trace the program
'responseData = responseData + """Content"": """ + articleContent + ""","
responseData = responseData + """Category ID: "": """ + catID + ""","
responseData = responseData + """User ID"": """ + Session("userID") + ""","
responseData = responseData + """Error"": """ + errorMsg + """"
responseData = responseData + "}"
' The following commented out line is just used to trace the program
'Response.Write(responseData)
Response.Write("Published Successfully.<a href=""admin.asp"" title=""Back To Dashboard"">Back To Dashboard</a>")
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -