我的新闻发布系统不能发图片了,请大家帮忙!(在线等)

zds309 2004-01-08 10:08:23
我的新闻发布系统不能发图片了,下面是源代码,请大家帮帮忙,我急用呀,谢谢!

<%@LANGUAGE="VBSCRIPT"%>
<!--#include virtual="/Connections/showNews.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 & "?" & Request.QueryString
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form1") Then

MM_editConnection = MM_showNews_STRING
MM_editTable = "news"
MM_editRedirectUrl = "admin.asp"
MM_fieldsStr = "ntitle|value|pubdate|value|type|value|ncontent|value"
MM_columnsStr = "Ntitle|',none,''|Ntime|',none,NULL|Ntype|',none,''|Ncontent|',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)))
MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),"<","<")
MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),chr(13)&chr(10),"<br>")
MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),"~!","<")


Next
'oprate char




' 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
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues




If (CStr(Request("MM_insert")) <> "") Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
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_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"
session("url")=MM_editQuery
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.write "<script language=javascript>alert('新闻发布成功!');</script>"
'Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>

<%
if(session("zz")="")then
response.End()
end if
%>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../assets/common.css" rel="stylesheet" type="text/css">
</head>

<body><!--#include virtual="/import/head.htm" -->
<table width="770" height="250" border="0" align="center" cellpadding="0" cellspacing="0" class="out">
<tr>
<td valign="top"><!--#include file="toolbar.asp" -->
<form name="form1" method="POST" action="<%=MM_editAction%>">

<table width="80%" border="0" align="center" cellpadding="2" cellspacing="2">

<tr>
<td width="10%" align="center">标 题</td>
<td colspan="3"> <input name="ntitle" type="text" id="ntitle" size="50"></td>
</tr>
<tr>
<td align="center">时 间</td>
<td width="23%"> <input name="pubdate" type="text" id="pubdate" value="<%=date()%>" size="20"></td>
<td width="10%">新闻等级</td>
<td width="57%"> <input name="type" type="radio" value="BBB" checked>
普通新闻
<input type="radio" name="type" value="AAA">
重要新闻</td>
</tr>
<tr>
<td align="center">内 容</td>
<td colspan="3"> <textarea name="ncontent" cols="70" rows="20" id="ncontent"></textarea></td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="4" align="center">
<input type="submit" name="Submit" value="发布"> <input type="reset" name="Submit2" value="返回" onclick="window.location='admin.asp'"></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="form1">
</form></td>
</tr>
</table>
<!--#include virtual="/import/copyright.htm" -->
</body>
</html>
...全文
53 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
lymyx 2004-01-10
  • 打赏
  • 举报
回复
你的语句也太长了吧?
看的头晕
zds309 2004-01-09
  • 打赏
  • 举报
回复
怎么没有人帮忙呀?以前不是这样子的呀?这个问题我真的是很急的呀!
zds309 2004-01-08
  • 打赏
  • 举报
回复
怎么我的MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),"<","<")
    MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),"~!","<")
这两句哪个有问题了呀?
ffyd2000 2004-01-08
  • 打赏
  • 举报
回复
好像是这样的吧,在源码中用 "<"代替"<";
你把替换"<" 和 ">"的语句注掉试试,不过这样好像就有点不安全了哦!
zds309 2004-01-08
  • 打赏
  • 举报
回复
问题应该是在这几行吧

' 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)))
MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),"<","<")
MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),chr(13)&chr(10),"<br>")
MM_fields(MM_i+1)=Replace(MM_fields(MM_i+1),"~!","<")
好像是"<"符号被改了吧?
zds309 2004-01-08
  • 打赏
  • 举报
回复
怎么没人理我呀,我快急死了,大家帮帮忙了!谢谢大家了!
xieyj 2004-01-08
  • 打赏
  • 举报
回复
的确太长了,你自己跟踪一下哪里代码出错,附上错误判断代码:
使用异常处理,捕捉错误信息,具体方法如下:
On Error Resume Next '过滤错误
If Err.Number <> 0 Then '发现错误
Response.Write "发现错误,错误信息是:" & Err.Description '写出错误信息
Response.End '结束运行
End If
甘泉123 2004-01-08
  • 打赏
  • 举报
回复
长~~~
zds309 2004-01-08
  • 打赏
  • 举报
回复
我应该把哪几句注释掉才算是对的呀?

28,407

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧