<!--#include file="conn.asp"-->
<%if session("bjxadmin")="" then
response.Write "<script language='javascript'>alert('网络超时或您还没有登陆！');window.location.href='login.asp';</script>"
response.End
else
if session("flag")>1 then
response.Write "<p align=center><font color=red>您没有此项目管理权限！</font></p>"
response.End
end if
end if

dim pingpaiid,pingpaiorder,pingpainame,tuijian,i
if request("action")="update" then
    for i=1 to request.form("pingpaiid").count
	pingpaiid=replace(request.form("pingpaiid")(i),"'","")
	pingpaiorder=replace(request.form("pingpaiorder")(i),"'","")
	tuijian=replace(request.form("tuijian")(i),"'","")
	pingpainame=replace(request.form("pingpainame")(i),"'","")
	if replace(request.form("pingpaiorder")(i),"'","")="" then
%>
<script language=javascript>
history.back()
alert("请填写品牌的显示排序！")
</script>
<%
	Response.End
	end if
	conn.execute("update BJX_pingpai set pingpaiorder="&pingpaiorder&",pingpainame='"&pingpainame&"',tuijian="&tuijian&" where id="&pingpaiid)

    next
conn.close
set conn=nothing
response.write "<script language=javascript>alert('品牌设置成功！');window.location.href='pingpaimanage.asp';</script>"
end if


if request("action")="add" then
	tuijian=request.form("tuijian")
	pingpainame=trim(request("pingpainame"))
	pingpaiorder=request.form("pingpaiorder")
	If pingpainame="" Then
		response.write "品牌名称不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
	If pingpaiorder="" Then
		response.write "排序不能为空！请<a href=javascript:history.go(-1)>返回重新填写</a>！"
		response.end
	end if
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open "select * from BJX_pingpai",conn,1,3
rs.addnew
rs("tuijian")=tuijian
rs("pingpainame")=pingpainame
rs("pingpaiorder")=pingpaiorder
rs.update
rs.close
set rs=nothing

conn.close
set conn=nothing
response.write "<script language=javascript>alert('品牌添加成功！');window.location.href='pingpaimanage.asp';</script>"
end if
%>
