这是完整代码,高手帮我一下:
<%
if Request.QueryString("cz")="" then
Response.Redirect"info.asp?info=错误的参数"
else
cz=Request.QueryString("cz")
end if
if cz="del" then
conn.execute "delete from desktop where id="&Request.QueryString("id")
Response.Redirect"admin.asp"
else
REM ------判断数据有效性------
founderr=false
if trim(Request.Form("name"))="" then
founderr=true
info=info+"
请填写文件名称"
end if
if trim(Request.Form("typeid"))="" then
founderr=true
info=info+"
请选择二级分类"
end if
if trim(Request.QueryString("classid"))="" then
founderr=true
info=info+"
请选择一级分类"
end if
if trim(Request.Form("pic"))="" then
founderr=true
info=info+"
请填写图片文件地址"
end if
REM ------如果数据是有效的则开始存储数据并显示相关信息------
if founderr=false then
set rs=server.createobject("adodb.recordset")
if cz="addfile" then
sql="select * from desktop where (id is null)"
rs.open sql,conn,1,3
rs.addnew
rs("time")=now()
else
sql="select * from desktop where id="&Request.QueryString("id")
rs.open sql,conn,1,3
end if
rs("name")=Request.Form("name")
rs("pic")=Request.Form("pic")
rs("typeid")=Request.Form("typeid")
rs("classid")=Request.QueryString("classid")
rs("hot")=Request.Form("hot")
rs("lx")=Request.Form("lx")
if Request.Form("url")<>"" then
rs("url")=Request.Form("url")
end if
if Request.Form("dx")<>"" then
rs("dx")=Request.Form("dx")&"KB"
end if
if Request.Form("jj")<>"" then
rs("jj")=HTMLEncode2(Request.Form("jj"))
rs("user_id")=session("u_id")
end if
rs.update
rs.close
if cz="addfile" then
rs_lar("img")=rs_lar("img")+1
rs_lar("huoli")=rs_lar("huoli")+1
end if
if cz="del" then
rs_lar("img")=rs_lar("img")-1
rs_lar("huoli")=rs_lar("huoli")-1
end if
rs_lar.update
rs_lar.close
set rs=nothing
conn.close
Set conn=Nothing
if cz="addfile" then
Response.Redirect"add.asp"
end if
if cz="editfile" then
Response.Redirect"admin.asp"
end if
REM ------如果数据是无效的则开始显示错误信息------
else
call infom()
end if
end if
function HTMLEncode2(fString)
fString = Replace(fString, CHR(13), "")
fString = Replace(fString, CHR(10) & CHR(10), "
")
fString = Replace(fString, CHR(10), "
")
HTMLEncode2 = fString
end function
%>