出错信息如下:错误类型:
Microsoft JScript 运行时错误 (0x800A138F)
'undefined' 为空或不是对象
D:\YU\ADMIN\../function/upload.asp, 第 10 行
浏览器类型:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Maxthon)
网页:
POST 1532 ??? /admin/savenews.asp
POST Data:
原文件代码如下:
<!--#include file="../function1/DBOpen.asp"-->
<!--#include file="../function/upload.asp"-->
<%
if session("purview")="" then
response.write "错误!!您没有权限或者连接超时,请重新登陆." %>
<a href="../login.asp" target="_top"><b>登陆</b></a>
<% response.end
end if
set rs=server.createobject("adodb.recordset") '查找审核员权限,文章默认状态
rs.open "select * from news_parameter where parameterid=1",conn,1,1
if not rs.bof and not rs.eof then
if rs("newsstatus")=1 then
newsstatus=1
else
newsstatus=0
end if
if rs("auditer")=1 then
auditer=1
else
auditer=0
end if
else
auditer=0
newsstatus=0
end if
rs.close
set rs=nothing
'以下的这段是要不要支持Html代码的代码
text=Ubbcode(text)
topic=trim(request.form("topic"))
text=Fields("text").Value
writer=trim(request.form("writer"))
nfrom=trim(request.form("nfrom"))
typeid=Fields("typeid").Value
page=Fields("page").Value
borderid=Fields("borderid").Value
newsid=Fields("newsid").Value
topic=Fields("topic").Value
index=Fields("index").Value
ntime=Fields("ntime").Value
keys=Fields("keys").Value
nfrom=Fields("nfrom").Value
yes=Fields("yes").Value
if topic="" or keys="" or content="" then
response.write "错误!!带<font color=red>*</font>号的为必填项! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
if (session("purview")="99998" and auditer=1) or session("purview")="99999" then
audit=Fields("audit").Value
end if
writer=Fields("writer").Value
index=Fields("index").Value
action=Fields("action").Value
hit=0
modify=cstr(session("name"))
if (session("purview")="99998" and auditer=1) or session("purview")="99999" or cstr(typeid)=cstr(session("purview")) then
if action="modify" then '*****************************修改文章******************************
set rs=server.createobject("ADODB.recordset")
rs.Open "SELECT * from news Where newsid=" & newsid,conn,1,3
if ntime="" then
response.write "错误!!时间不能为空!!! <a href='javascript:history.go(-1)'>返回</a>"
response.end
end if
rs("typeid")=typeid
rs("borderid")=borderid
rs("topic")=topic
rs("content")=content
rs("ntime")=ntime
rs("index")=index
rs("keys")=keys
rs("nfrom")=nfrom
if (session("purview")="99998" and auditer=1) or session("purview")="99999" then
rs("audit")=audit
end if
rs("writer")=writer
rs("modify")=modify
if session("purview")>"99997" then
rs("auditer")=cstr(session("name"))
end if
rs.update
rs.close
set rs=nothing
response.redirect "newsmanage.asp?typeid=" & typeid & "&borderid=" & borderid & "&newsid=" & newsid & "&page=" & page
end if 'action="modify"
if action="add" then '*****************************添加新文章******************************
set rs=server.createobject("ADODB.recordset")
rs.Open "SELECT * from news",conn,1,3
rs.addnew
rs("typeid")=typeid
rs("borderid")=borderid
rs("topic")=topic
rs("index")=index
rs("content")=content
rs("keys")=keys
rs("nfrom")=nfrom
rs("ntime")=now()
if (session("purview")="99998" and auditer=1) or session("purview")="99999" then
rs("audit")=audit
else
rs("audit")=newsstatus
end if
rs("writer")=writer
rs("modify")=modify
if session("purview")>"99997" then
rs("auditer")=cstr(session("name"))
end if
rs.update
rs.close
set rs=nothing
response.redirect "newsmanage.asp?typeid=" & typeid & "&borderid=" & borderid & "&newsid=" & newsid
end if 'action="add"
'if auditer=1 or session("purview")="99999" or cstr(request("typeid"))=cstr(session("purview"))
%>
<!--#include file="../function/DBclose.asp"--><%end if%>
总是出错.
附上add文件代码如下:
<% option explicit %>
<!--#include file="../function1/DBOpen.asp"-->
<%
if session("purview")<>"99999" then
response.write "错误!!您没有权限或者连接超时,请重新登陆." %>
<a href="../login.asp" target="_top">登陆</a>
<% response.end
end if
dim isedit '是否在编辑状态
dim color '表格颜色
dim userid
dim sql,rs,rsc
userid=request("userid")
color=1
isedit=false
if request("action")="edit" then
isedit=true
end if
if request("action")="modify" then '*****************修改用户*****************
if trim(request("userpassword"))="" then
response.write "错误!密码不能为空! <a href=usermanage.asp>返回</a>"
response.end
end if
sql="update users set name='" & cstr(trim(request("username"))) & "',pwd='" & cstr(trim(request("userpassword"))) & "',purview=" & cstr(request("purview")) & "where userid=" & cstr(request("userid"))
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else %>
<script language=vbscript>
msgbox "操作成功!用户 <%=trim(request("username"))%> 的信息已经更新!"
</script>
<%end if
end if
if request("action")="add" then '*******************添加新用户****************
if trim(request("username"))="" or trim(request("userpassword"))="" then
response.write "错误!用户名或密码不能为空! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
set rs=server.createobject("adodb.recordset") '检查用户是否重名
rs.open "select * from users where name='" & cstr(trim(request("username"))) & "'",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else if not rs.bof and not rs.eof then
response.write "错误!该用户名已存在! <a href=# onclick='javascript:window.history.go(-1)'>返回</a>"
response.end
end if
end if
rs.close
set rs=nothing
sql="insert into users(name,pwd,purview) values('" & cstr(trim(request("username"))) & "','" & cstr(trim(request("userpassword"))) & "'," & cstr(request("purview")) & ")"
conn.execute sql
if err.number <> 0 then
response.write "数据库操作出错:" + err.description
else %>
<script language=vbscript>
msgbox "操作成功!新用户 <%=trim(request("username"))%> 的信息添加成功!"
</script>
<%end if
end if
if request("action")="del" then '*******************删除用户******************
sql="delete from users where userid=" + cstr(userid)
conn.execute sql
if err.number <> 0 then
response.write "数据库操作错误:" + err.description
err.clear
else %>
<script language=vbscript>
msgbox "操作成功!用户 <%=trim(request("username"))%> 的信息已删除!"
</script>
<% end if
end if
%><html>
<head>
<title>用户管理</title>
<script language=javascript>
function SureDel(id)
{
if ( confirm("您确定要删除该用户吗?"))
{
window.location.href = "usermanage.asp?action=del&userid=" + id
}
}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<STYLE>TABLE {FONT-SIZE: 12px;COLOR: #000000; FONT-FAMILY: 宋体;LINE-HEIGHT: 180%}
.Shadow_white {FONT-SIZE: 14pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
.Shadow_white2 {FONT-SIZE: 10pt; FILTER: dropshadow(color:black, offx=1, offy=1, positive=1); WIDTH: 70%; COLOR: #000000; FONT-FAMILY: 宋体; POSITION: relative}
A:link {COLOR: #000000; TEXT-DECORATION: none}
A:active {COLOR: #000000; TEXT-DECORATION: none}
A:visited {COLOR: #000000; TEXT-DECORATION: none}
A:hover {COLOR: #ff0000; TEXT-DECORATION: underline}
</STYLE></head>
<body>
<table border="0" width="70%" bgcolor="#000000" cellpadding="0" cellspacing="1" align="center">
<tr bgcolor="#abb8d6">
<td colspan="3" height="50">
<div align="center"></div>
<div align="center"></div>
<div align="center"><b>用户管理</b></div>
</td>
</tr>
<tr bgcolor="#FFFFFF">
<td width="32%">
<div align="center">-----用 户 名-----</div>
</td>
<td width="58%">
<div align="center">-----权 限-----</div>
</td>
<td width="10%">
<div align="center">操作</div>
</td>
</tr>
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from users where userid<>1",conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else
if rs.bof and rs.eof then
rs.close
response.write "目前没有用户"
else
do while not rs.eof %>
<tr>
<td width="32%" height="21" bgcolor="<% if color mod 2=0 then
response.write "#F0E8F0"
else
response.write "#ffffff"
end if %>">
<div align="center"><a href='usermanage.asp?userid=<%=cstr(rs("userid"))%>&action=edit'><%=rs("name")%></a></div>
</td>
<td width="58%" height="21" bgcolor="<% if color mod 2=0 then
response.write "#F0E8F0"
else
response.write "#ffffff"
end if %>">
<div align="center">
<% if rs("purview")="99999" then
response.write "<b>管理员</b>"
else if rs("purview")="99998" then
response.write "<b>审核员</b>"
else
set rsc=server.createobject("adodb.recordset")
rsc.open "select typename from type where typeid=" & rs("purview"),conn,1,1
if err.number <> 0 then
response.write "数据库出错"
else
if rsc.bof and rsc.eof then
response.write "<font color=#990099>无效用户</font>"
else
response.write rsc("typename")&"录入员"
end if
end if
rsc.close
set rsc=nothing
end if
end if %>
</div>
</td>
<td width="10%" height="21" bgcolor="<% if color mod 2=0 then
response.write "#F0E8F0"
else
response.write "#ffffff"
end if %>">
<div align="center">
<% if trim(rs("name"))=trim(session("name")) then
response.write "----"
else
response.write "<a href='javascript:SureDel(" & cstr(rs("userid")) & ")'>删除</a>"
end if %>
</div>
</td>
</tr>
<% rs.movenext
color=color+1
loop
end if
end if
'rs.close
set rs=nothing %>
</table>
<table width="70%" border="0" cellspacing="0" cellpadding="0" align="center" bgcolor="#abb8d6" style="border: 1px solid #000000">
<tr>
<td height="40">
<div align="center">
<% if isedit then
set rs=server.createobject("adodb.recordset")
set rsc=server.createobject("adodb.recordset")
rs.open "select * from users where userid=" & cstr(request("userid")),conn,1,1
rsc.open "select * from type where typeid=" & cstr(rs("purview")),conn,1,1
response.write "编 辑 用 户<br>"
else
response.write "添 加 新 用 户<br>"
end if %>
</div>
</td>
</tr>
<tr>
<td>
<form action="usermanage.asp" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td height="40">
<div align="center">
<input type="Hidden" name="action" value='<% If isedit then%>modify<% Else %>add<% End If %>'>
<%If isedit then%>
<input type="Hidden" name="userid" value='<%=cstr(request("userid"))%>'>
<%End If%>
用户账号:
<input type="text" name="username" class=input maxlength=14 size="16" value='<% if isedit then
response.write trim(rs("name"))
end if %>'
<% if isedit then
response.write " readonly"
end if %>>
用户密码:
<input type="password" name="userpassword" class=input maxlength=12 size="16" value='<% if isedit then
response.write trim(rs("pwd"))
end if %>'>
</div>
</td>
</tr>
<tr>
<td height="40">
<div align="center">用户权限:
<select name="purview" class=select>
<% if isedit then %>
<option value="99999" <% if rs("purview")="99999" then
response.write "selected"
end if %>> 管 理 员</option>
<option value="99998" <% if rs("purview")="99998" then
response.write "selected"
end if %>> 审 核 员</option>
<% if not rsc.bof and not rsc.eof then %>
<option value='<%=rsc("typeid")%>' selected ><%=rsc("typename")%>录入员</option>
<% end if
rsc.close
set rsc=nothing
set rsc=server.createobject("adodb.recordset")
rsc.open "select * from type where typeid<>" & cstr(rs("purview")),conn,1,1
if not rsc.bof and not rsc.eof then
do while not rsc.eof %>
<option value='<%=rsc("typeid")%>'><%=rsc("typename")%>录入员</option>
<% rsc.movenext
loop
end if
rsc.close
set rsc=nothing
rs.close
set rs=nothing
else
set rsc=server.createobject("adodb.recordset")
rsc.open "select * from type",conn,1,1 %>
<option value="99998"> 审 核 员</option>
<option value="99999"> 管 理 员</option>
<% if not rsc.eof and not rsc.bof then
do while not rsc.eof %>
<option value='<%=rsc("typeid")%>'><%=rsc("typename")%>录入员</option>
<% rsc.movenext
loop
end if
rsc.close
set rsc=nothing
end if %>
</select>
<input type=submit value="确 定" class=button name="submit">
<input type="reset" name="Submit" value="重 设">
</div>
</td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<p align="center"> </p>
<p> </p>
</body>
</html>
<!--#include file="../function/DBclose.asp"-->
再附上upload.asp代码如下:
<script language="javascript1.2" Runat=Server>
function Ubb(strtemp) {
strtemp = strtemp.replace(/\r/ig, "");
strtemp = strtemp.replace(/\n/ig, "<BR>");
return strtemp;
}
function Ubbcode(strtemp) {
strtemp = strtemp.replace(/\r/ig, "");
// strtemp = strtemp.replace(/\r\n/ig, "<BR> ");
// strtemp = strtemp.replace(/\n\r\n/ig, "<P>");
// strtemp = strtemp.replace(/\n/ig, "<BR>");
strtemp = strtemp.replace(/\n/ig, "");
strtemp = strtemp.replace(/(^|\s)(http|https|ftp)(:\/\/[^\";,<>]+)/ig, "<a href=\"$2$3\" target=_blank class=sy>$2$3</a>");
strtemp = strtemp.replace(/([^\//]])(www\.[^\";,<>]+)/ig, "<a href=\"http:\/\/$2\" target=_blank class=sy>$2</a>");
strtemp = strtemp.replace(/(^|\s)(www\.[^\";,<>&]+)/ig, "<a href=\"http:\/\/$2\" target=_blank class=sy>$2</a>");
strtemp = strtemp.replace(/(\[URL\])(http|https|ftp)(:\/\/[^\[]*)(\[\/URL\])/ig, "<A HREF=\"$2$3\" TARGET=_blank class=sy>$2$3</A>");
strtemp = strtemp.replace(/(\[URL\])([^\[]*)(\[\/URL\])/ig, " <A HREF=\"http:\/\/$2\" TARGET=_blank class=sy>$2</A>");
strtemp = strtemp.replace(/(\[URL=)(http|https|ftp)(:\/\/[^\[]*)(\])([^\[]*)(\[\/URL\])/ig, "<A HREF=\"$2$3\" TARGET=_blank class=sy>$5</A>");
strtemp = strtemp.replace(/(\[URL=)([^\[]*)(\])([^\[]*)(\[\/URL\])/ig, "<A HREF=\"http:\/\/$2\" TARGET=_blank class=sy>$4</A>");
strtemp = strtemp.replace(/(\[code\])([^\[]*)(\[\/code\])/ig, "<BR><BLOCKQUOTE><strong>Code</strong>:<HR Size=1>$2<HR SIZE=1><\/BLOCKQUOTE>");
strtemp = strtemp.replace(/(\[COLOR=)([^\[]*)(\])([^\[]*)(\[\/COLOR\])/ig, "<FONT COLOR=\"$2\">$4<\/FONT>");
strtemp = strtemp.replace(/(\[font=)([^\[]*)(\])([^\[]*)(\[\/FACE\])/ig, "<FONT FACE=\"$2\">$4<\/FONT>");
strtemp = strtemp.replace(/(\[SIZE=)([^\[]*)(\])([^\[]*)(\[\/SIZE\])/ig, "<FONT SIZE=\"$2\">$4<\/FONT>");
strtemp = strtemp.replace(/(\[list\])([^\[]*)(\[\/list\])/ig, "<UL>$2<\/UL>");
strtemp = strtemp.replace(/(\[list=1\])([^\[]*)(\[\/list\])/ig, "<ol type=1>$2<\/ol id=1>");
strtemp = strtemp.replace(/(\[list=A\])([^\[]*)(\[\/list\])/ig, "<ol type=A>$2<\/ol id=A>");
strtemp = strtemp.replace(/(\[i\])([^\[]*)(\[\/i\])/ig, "<I>$2<\/I>");
strtemp = strtemp.replace(/(\[\*\])([^\[]*)(\[\/\*\])/ig, "<LI>$2<\/LI>");
strtemp = strtemp.replace(/(\[b\])([^\[]*)(\[\/b\])/ig, "<b>$2</b>");
// strtemp = strtemp.replace(/(\w+\@\w+.[\w.]+)/ig, "<a href=\"mailto:$1\" class=sy>$1</a>");
strtemp = strtemp.replace(/(\[IMG=)([^\[]*)(\])([^\[]*)(\[\/IMG\])/ig, "<IMG SRC=\"$2\" ALT=\"$4\">");
strtemp = strtemp.replace(/(\[IMG\])([^\[]*)(\[\/IMG\])/ig, "<IMG SRC=\"$2\">");
strtemp = strtemp.replace(/(\[EMAIL=)([^\[]*)(\])([^\[]*)(\[\/EMAIL\])/ig, "<A HREF=\"mailto:$2\" class=sy>$4<\/A>");
strtemp = strtemp.replace(/(\[EMAIL])([^\[]*)(\[\/EMAIL\])/ig, "<A HREF=\"mailto:$2\">$2<\/A>");
strtemp = strtemp.replace(/(\[U])([^\[]*)(\[\/U\])/ig, "<U>$2<\/U>");
strtemp = strtemp.replace(/(\[FLY])([^\[]*)(\[\/FLY])/ig, "<marquee width=90% behavior=alternate scrollamount=3>$2<\/marquee>");
strtemp = strtemp.replace(/(\[MOVE])([^\[]*)(\[\/MOVE])/ig, "<marquee scrollamount=3>$2<\/marquee>");
strtemp = strtemp.replace(/(\[QUOTE\])([^\[]*)(\[\/QUOTE\])/ig, "<BR><BLOCKQUOTE><strong>引用<\/strong>:<HR Size=1>$2<HR SIZE=1><\/BLOCKQUOTE>");
return strtemp;
}
function unUbbcode(strtemp){
strtemp = strtemp.replace(/<br>/ig, "\n");
strtemp = strtemp.replace(/<p>/ig, "\n\r\n");
strtemp = strtemp.replace(/""/ig, "\r");
strtemp = strtemp.replace(/<B>([^\[]*)<\/B>/ig, "\[B\]$1\[\/B\]");
strtemp = strtemp.replace(/<I>([^\[]*)<\/I>/ig, "\[I\]$1\[\/I\]");
strtemp = strtemp.replace(/<U>([^\[]*)<\/U>/ig, "\[U\]$1\[\/U\]");
strtemp = strtemp.replace(/<marquee scrollamount=3>([^\[]*)<\/marquee>/ig, "\[MOVE\]$1\[\/MOVE\]");
strtemp = strtemp.replace(/<BR><BLOCKQUOTE><strong>([^\[]*)<\/strong>:<HR Size=1>$2<HR SIZE=1><\/BLOCKQUOTE>/ig, "\[QUOTE\]$1\[\/QUOTE\]");
strtemp = strtemp.replace(/<marquee width=90% behavior=alternate scrollamount=3>([^\[]*)<\/marquee>/ig, "\[FLY\]$1\[\/FLY\]");
strtemp = strtemp.replace(/<LIST>([^\[]*)<\/LIST>/ig, "\[LIST\]$1\[\/LIST\]");
strtemp = strtemp.replace(/<ol type=1>([^\[]*)<\/ol id=1>/ig, "\[LIST=1\]$1\[\/LIST\]");
strtemp = strtemp.replace(/<ol type=A>([^\[]*)<\/ol id=A>/ig, "\[LIST=A\]$1\[\/LIST\]");
strtemp = strtemp.replace(/<LI>([^\[]*)<\/LI>/ig, "\[\*\]$1\[\/\*\]");
strtemp = strtemp.replace(/</ig, "<");
strtemp = strtemp.replace(/>/ig, ">");
return strtemp;
}
function formation(strtemp){
strtemp = strtemp.replace(/"/ig, "\\\"");
return strtemp;
}
</script>
[此贴子已经被作者于2006-1-11 17:05:59编辑过]