📄 addnews.asp
字号:
if UploadRequest.Item(name) then
UploadFormRequest = UploadRequest.Item(name).Item("Value")
end if
End Function
'Process the upload
UploadQueryString = Replace(Request.QueryString,"GP_upload=true","")
if mid(UploadQueryString,1,1) = "&" then
UploadQueryString = Mid(UploadQueryString,2)
end if
GP_uploadAction = CStr(Request.ServerVariables("URL")) & "?GP_upload=true"
If (Request.QueryString <> "") Then
if UploadQueryString <> "" then
GP_uploadAction = GP_uploadAction & "&" & UploadQueryString
end if
End If
If (CStr(Request.QueryString("GP_upload")) <> "") Then
GP_redirectPage = ""
If (GP_redirectPage = "") Then
GP_redirectPage = CStr(Request.ServerVariables("URL"))
end if
RequestBin = Request.BinaryRead(Request.TotalBytes)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin, "images/news", "file", "9999999", "over"
'*** GP NO REDIRECT
end if
if UploadQueryString <> "" then
UploadQueryString = UploadQueryString & "&GP_upload=true"
else
UploadQueryString = "GP_upload=true"
end if
%>
<%
' *** Restrict Access To Page: Grant or deny access to this page
MM_authorizedUsers="admin,news"
MM_authFailedURL="adminloginerr.asp"
MM_grantAccess=false
If Session("MM_Username") <> "" Then
If (false Or CStr(Session("MM_UserAuthorization"))="") Or _
(InStr(1,MM_authorizedUsers,Session("MM_UserAuthorization"))>=1) Then
MM_grantAccess = true
End If
End If
If Not MM_grantAccess Then
MM_qsChar = "?"
If (InStr(1,MM_authFailedURL,"?") >= 1) Then MM_qsChar = "&"
MM_referrer = Request.ServerVariables("URL")
if (Len(Request.QueryString()) > 0) Then MM_referrer = MM_referrer & "?" & Request.QueryString()
MM_authFailedURL = MM_authFailedURL & MM_qsChar & "accessdenied=" & Server.URLEncode(MM_referrer)
Response.Redirect(MM_authFailedURL)
End If
%>
<!--#include file="ScriptLibrary/incPureUpload.asp" -->
<%
' *** Edit Operations: (Modified for File Upload) declare variables
MM_editAction = CStr(Request.ServerVariables("URL")) 'MM_editAction = CStr(Request("URL"))
If (UploadQueryString <> "") Then
MM_editAction = MM_editAction & "?" & UploadQueryString
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: (Modified for File Upload) set variables
If (CStr(UploadFormRequest("MM_insert")) <> "") Then
MM_editConnection = MM_conn_STRING
MM_editTable = "news"
MM_editRedirectUrl = "managenews.asp"
MM_fieldsStr = "title|value|file|value|imagesm|value|radiobutton|value|neirong|value"
MM_columnsStr = "title|',none,''|images|',none,''|imagessm|',none,''|shifouimg|none,none,NULL|neirong|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(i+1) = CStr(UploadFormRequest(MM_fields(i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If
End If
%>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it
If (CStr(UploadFormRequest("MM_insert")) <> "") Then
' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For i = LBound(MM_fields) To UBound(MM_fields) Step 2
FormVal = MM_fields(i+1)
MM_typeArray = Split(MM_columns(i+1),",")
Delim = MM_typeArray(0)
If (Delim = "none") Then Delim = ""
AltVal = MM_typeArray(1)
If (AltVal = "none") Then AltVal = ""
EmptyVal = MM_typeArray(2)
If (EmptyVal = "none") Then EmptyVal = ""
If (FormVal = "") Then
FormVal = EmptyVal
Else
If (AltVal <> "") Then
FormVal = AltVal
ElseIf (Delim = "'") Then ' escape quotes
FormVal = "'" & Replace(FormVal,"'","''") & "'"
Else
FormVal = Delim + FormVal + Delim
End If
End If
If (i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End if
MM_tableValues = MM_tableValues & MM_columns(i)
MM_dbValues = MM_dbValues & FormVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command")
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close
If (MM_editRedirectUrl <> "") Then
Response.Redirect(MM_editRedirectUrl)
End If
End If
End If
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="ddd.css" type="text/css">
<script language="JavaScript">
<!--
function checkdata() {
if (document.form1.title.value=="") {
window.alert ("请输新闻标题!")
return false
}
if (document.form1.neirong.value=="") {
window.alert ("请输入新闻内容!")
return false
}
return true
}
//-->
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<!--#include file="manage.asp" -->
<!--#include file="top.asp" -->
<table width="771" border="0" cellspacing="0" cellpadding="0" align="center" class="bk">
<tr>
<td>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" enctype="multipart/form-data" onSubmit="return checkdata()">
<table width="392" border="1" cellspacing="2" cellpadding="0" align="center" bordercolor="#FFFFFF" class="dfont">
<tr>
<td bordercolor="#000000" bgcolor="#99CC00" height="17">
<div align="center"><font color="#FFCC00"><b><font size="2" color="#FF0000">增加新闻</font></b></font></div>
</td>
</tr>
<tr>
<td bordercolor="#000000" height="19"> 标题:
<input type="text" name="title" size="50">
</td>
</tr>
<tr>
<td bordercolor="#000000" height="0"> 图片:
<input type="file" name="file">
</td>
</tr>
<tr>
<td bordercolor="#000000" height="0">图片说明:
<input type="text" name="imagesm">
</td>
</tr>
<tr>
<td bordercolor="#000000" height="47">是否首页图片:
<input type="radio" name="radiobutton" value="-1">
是
<input type="radio" name="radiobutton" value="0" checked>
否</td>
</tr>
<tr>
<td bordercolor="#000000" height="22">内容: </td>
</tr>
<tr>
<td bordercolor="#000000" height="10">
<textarea name="neirong" cols="60" rows="7"></textarea>
</td>
</tr>
<tr>
<td bordercolor="#000000" height="11">
<div align="center">
<input type="submit" name="Submit" value="增加">
</div>
</td>
</tr>
</table>
<br>
<input type="hidden" name="MM_insert" value="true">
</form>
</td>
</tr>
</table>
<br><!--#include file="bottom.asp" -->
</body>
</html>
<html></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -