📄 admin_news_modi.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
'=========================================================
' 学校机房作业管理系统 V 1.0 [创建于200812122100]
' 授权发布网站:清远ABC-http://www.qyabc.com/
' 客服QQ:418322257 E-Mail:qystu@163.com
' 注意:如想得到关于本程序免费的技术支持,
' 必须承诺使用一周后,用平邮回寄“相关文件”文件夹中的“学校机房作业管理系统调查反馈表”表格。
' 作者博客:http://www.qyabc.com/u/qin/Default.aspx
'=========================================================
%>
<!--#include file="inc/config.asp" -->
<!--#include file="Connections/master.asp" -->
<%
' *** Edit Operations: declare variables
Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd
Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId
Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i
MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If
' boolean to abort record edit
MM_abortEdit = false
' query string to execute
MM_editQuery = ""
%>
<%
' *** Update Record: set variables
If (CStr(Request("MM_update")) = "form1" And CStr(Request("MM_recordId")) <> "") Then
MM_editConnection = MM_master_STRING
MM_editTable = "news"
MM_editColumn = "ID"
MM_recordId = "" + Request.Form("MM_recordId") + ""
MM_editRedirectUrl = "admin_news_modi_success.asp"
MM_fieldsStr = "Topic|value|content|value|theachername|value|theacherid|value|UpIp|value"
MM_columnsStr = "Topic|',none,''|Content|',none,''|postname|',none,''|postid|',none,''|PostIP|',none,''"
' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|")
MM_columns = Split(MM_columnsStr, "|")
' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
Next
' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
End If
End If
End If
%>
<%
' *** Update Record: construct a sql update statement and execute it
If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "") Then
' create the sql update statement
MM_editQuery = "update " & MM_editTable & " set "
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),",")
MM_delim = MM_typeArray(0)
If (MM_delim = "none") Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none") Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none") Then MM_emptyVal = ""
If (MM_formVal = "") Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "") Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'") Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_editQuery = MM_editQuery & ","
End If
MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
Next
MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId
If (Not MM_abortEdit) Then
' execute the update
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
%>
<%
Dim modi_news__MMColParam
modi_news__MMColParam = "1"
If (Request.QueryString("id") <> "") Then
modi_news__MMColParam = Request.QueryString("id")
End If
%>
<%
Dim modi_news
Dim modi_news_numRows
Set modi_news = Server.CreateObject("ADODB.Recordset")
modi_news.ActiveConnection = MM_master_STRING
modi_news.Source = "SELECT * FROM news WHERE ID = " + Replace(modi_news__MMColParam, "'", "''") + ""
modi_news.CursorType = 0
modi_news.CursorLocation = 2
modi_news.LockType = 1
modi_news.Open()
modi_news_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>修改公告-<%=WebName%></title>
<link rel="SHORTCUT ICON" href="favicon.ico"/>
<link href="<%= SysCss %>" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
function checkform(){
if(document.form1.Topic.value=="")
{
alert("必须填写公告主题!");
document.form1.Topic.focus();
return false;
}
if(document.form1.Content.value=="")
{
alert("必须填写公告内容!");
document.form1.Content.focus();
return false;
}
}
//-->
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="16%" valign="top"><table width="97%" border="0" align="center" cellpadding="5" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><a href="admin_news_index.asp">公告列表</a></td>
</tr>
<tr>
<td align="center"><a href="admin_news_index.asp"></a></td>
</tr>
<tr>
<td align="center"><a href="admin_news_add.asp">添加公告</a></td>
</tr>
<tr>
<td align="center"><a href="admin_news_add.asp"></a></td>
</tr>
<tr>
<td align="center"><a href="admin_news_add.asp"></a></td>
</tr>
</table></td>
<td width="84%" valign="top">
<br>
<% If cint(modi_news.Fields.Item("postid").Value)=session("QYABC_userid") Then '是否是他自己发布的公告,否则不可修改%>
<form ACTION="<%=MM_editAction%>" METHOD="POST" name="form1" target="_self" id="form1" onsubmit="return checkform()">
<div align="center">
<table width="80%" align="center">
<tr valign="baseline">
<td height="20" colspan="3" align="right" nowrap></td>
</tr>
<tr valign="baseline">
<td width="160" align="right" nowrap><div align="right">公告主题:</div></td>
<td width="416" colspan="2" align="right" nowrap><div align="left">
<input name="Topic" type="text" id="Topic" value="<%=(modi_news.Fields.Item("Topic").Value)%>" size="85" maxlength="38">
</div></td>
</tr>
<tr valign="baseline">
<td rowspan="2" align="right" valign="top" nowrap>公告内容::
<div align="center"> </div></td>
<td colspan="2" align="left" nowrap> <textarea name="content" style="display:none"><%=(modi_news.Fields.Item("Content").Value)%></textarea>
<iframe ID="eWebEditor1" src="editor/ewebeditor.asp?id=content&style=news_system&originalfilename=d_originalfilename&savefilename=d_savefilename&savepathfilename=d_savepathfilename" frameborder="0" scrolling="no" width="650" HEIGHT="350"></iframe></td>
</tr>
<tr valign="baseline">
<td colspan="2" align="right" nowrap> </td>
</tr>
<tr valign="baseline">
<td nowrap align="right"><input name="theachername" type="hidden" id="theachername" value="<%= session("QYABC_username") %>">
<input name="theacherid" type="hidden" id="theacherid" value="<%= session("QYABC_userid") %>">
<input name="UpTime" type="hidden" id="UpTime" value="<%=now()%>">
<input name="UpIp" type="hidden" id="UpIp" value="<%=Request.ServerVariables("Remote_Addr")%>"></td>
<td colspan="2"><div align="right">
<input type="submit" value="修改公告">
</div></td>
</tr>
</table>
</div>
<input type="hidden" name="MM_recordId" value="<%= modi_news.Fields.Item("ID").Value %>">
<input type="hidden" name="MM_update" value="form1">
</form>
<% Else%>
<div align="center"><br><br><br><br><br>你只可修改自己发布的公告!<a href="javascript:history.back(-1)">返回上一页</a><br><br><br><br><br></div>
<% End If%>
</td>
</tr>
</table>
<!--#include file="inc/bot.asp" -->
</body>
</html>
<%
modi_news.Close()
Set modi_news = Nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -