<!-- #include file="conn.asp"-->
<!--#include file="checkUser_free.asp"-->
<%

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 produce where id="&Request.QueryString("id")
Response.Redirect"adminfile.asp"

else

REM ------判断数据有效性------

founderr=false
if trim(Request.Form("user"))="" then
founderr=true
info=info+"<li>请填写联系人信息</li>"
end if
if trim(Request.Form("tel"))="" then
founderr=true
info=info+"<li>请填写联系电话</li>"
end if
if trim(Request.Form("name"))="" then
founderr=true
info=info+"<li>请填写汽车型号</li>"
end if
if trim(Request.Form("car_big"))="" then
founderr=true
info=info+"<li>请填写座位数</li>"
end if
if trim(Request.Form("typeid"))="" then
founderr=true
info=info+"<li>请选择分类</li>"
end if

REM ------如果数据是有效的则开始存储数据并显示相关信息------

if founderr=false then 
set rs=server.createobject("adodb.recordset")
if cz="addfile" then
sql="select * from produce where (id is null)" 
rs.open sql,conn,1,3
rs.addnew
rs("time")=now()
else
sql="select * from produce where id="&Request.QueryString("id") 
rs.open sql,conn,1,3
end if
rs("zl_class")=Request.Form("zl_class")
rs("name")=Request.Form("name")
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("car_big")<>"" then
rs("car_big")=Request.Form("car_big")
end if
if Request.Form("day_money")<>"" then
rs("day_money")=Request.Form("day_money")
end if
if Request.Form("month_money")<>"" then
rs("month_money")=Request.Form("month_money")
end if
if Request.Form("year_money")<>"" then
rs("year_money")=Request.Form("year_money")
end if
if Request.Form("more_money")<>"" then
rs("more_money")=Request.Form("more_money")
end if
if Request.Form("user")<>"" then
rs("user")=Request.Form("user")
end if
if Request.Form("tel")<>"" then
rs("tel")=Request.Form("tel")
end if
if Request.Form("content")<>"" then
rs("content")=HTMLEncode2(Request.Form("content"))
end if
if Request.Form("smallimg")="" then
rs("smallimg")="images/nominipic.gif"
else
rs("smallimg")=Request.Form("smallimg")
end if
if Request.Form("bigimg")="" then
rs("bigimg")="images/nobigpic.gif"
else
rs("bigimg")=Request.Form("bigimg")
end if
rs.update
rs.close
set rs=nothing
conn.close
Set conn=Nothing
if cz="addfile" then
Response.Redirect"main.asp"
else
Response.Redirect"main.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), "</P><P>")
	fString = Replace(fString, CHR(10), "<BR>")
	HTMLEncode2 = fString
end function
%>