<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Dim NCheck:NCheck=false
%>
<!--#include file="cgi/Config.asp"-->
<%
Response.Charset="GB2312"
Response.Buffer   =   True    
Response.ExpiresAbsolute   =   Now() -  1    
Response.Expires   =   0    
Response.CacheControl   =   "no-cache"    
Response.AddHeader   "Pragma",   "No-Cache"
dim act:act=request("act")
Dim errorNum:errorNum=0
Dim errorStr:errorStr="未知错误"
select case act

case "checklogin"
	if Session("userLog") then 
		errorStr="成功登陆"
		errorNum=1
	else
		errorStr="还未登录"
	end if


case "resetpass"
	if Session("master")  then '判断登录IF
		u=request("u")
		p=request("p")
		if mobj.testreg(u,"^\d{1,10}$") and len(p)>=6 then
			mobj.crs rs
			rs.open "select a_userpass from b2c_admin where a_id="&u,dstr,1,3
			if rs.eof and rs.bof then
				errorStr="用户不存在"
			else
				rs("a_userpass")=md5(p)
				rs.update
				errorNum=1			
			end if
			mobj.drs rs			
		else
			errorStr="参数错误"
		end if
	else
		errorStr="请以管理员身份登录"
	end if
case "jinyong"
	if Session("master")  then '判断登录IF
		u=request("u")		
		if mobj.testreg(u,"^\d{1,10}$")  then
			mobj.cexe "update b2c_admin set a_active=abs(a_active-1) where a_id="&u&" and a_type=0"
			errorNum=1			
		else
			errorStr="参数错误"
		end if
	else
		errorStr="请以管理员身份登录"
	end if
case "delgoods"
	if Session("master")  then '判断登录IF
		id=request("id")
		if mobj.testreg(id,"^(\w|-){36}$") then
			 mobj.cexe "update b2c_goods set g_delete=1 where g_guid='"&id&"'"
			 errorNum=1		
		else
			errorStr="参数错误"
		end if
	else
		errorStr="请以管理员身份登录"
	end if
case "adduser"
	if Session("master") then
		n=trim(request("n"))
		p=trim(request("p"))
		t=request("t")
		if  mobj.testreg(n,"^\w{1,20}$") and  mobj.testreg(p,"^.{1,20}$") and  mobj.testreg(t,"^[0-1]$") then
			mobj.crs rs
			rs.open "select * from b2c_admin where a_username='"&n&"'",dstr,1,3
			if rs.eof and rs.bof then
				rs.addnew()
				rs("a_username")=lcase(n)
				rs("a_userpass")=md5(p)
				rs("a_active")=t
				rs.update
				errorNum=1				
			else
				errorStr="该用户已经存在"
			end if
			mobj.drs rs
		else
			
			
			errorStr="参数不规范"
		end if
	else
		errorStr="请先登录"
	end if

case "sureorder"
	if Session("islog") then
		id=request("id")
		if not mobj.testreg(id,"^\d{1,10}$") then'判断订单号格式
			errorStr="订单号不规范"
		else
			mobj.cexe "update b2c_order_info  set order_status=1 where order_id="&id
			errorNum=1
		end if
		
	end if



case "houtaifahuo"
	if Session("islog") then 
		id=request("id")
		
		
		if mobj.testreg(id,"^\d{1,10}$") then			
			
			errorNum=1
			mobj.cexe "update b2c_order_info set shipping_status=1 where order_id="&id
		else
			errorStr="参数不规范"
		end if
	else
		errorStr="请先登录"
	end if

case "jiekuan"
	if Session("islog") then 
		id=request("id")
		
		
		if mobj.testreg(id,"^\d{1,10}$") then			
			
			errorNum=1
			mobj.cexe "update b2c_order_info set pay_status=2 where order_id="&id
		else
			errorStr="参数不规范"
		end if
	else
		errorStr="请先登录"
	end if
	
case "delorder"
	if Session("islog") then 
		id=request("id")
		c=request("c")
		
		if mobj.testreg(id,"^\d{1,10}$") and mobj.testreg(c,"^[1-7]$") then			
			
			errorNum=1
			mobj.cexe "update  b2c_order_info set isdel=1,deltype="&c&",deluser="&Session("a_id")&",delusername='"&Session("a_username")&"',deltime=GETDATE()  where order_id="&id
		else
			errorStr="参数不规范"
		end if
	else
		errorStr="请先登录"
	end if

case "savenote"
	if Session("islog") then 
		id=request("id")
		s=mobj.CheckBadstr(request("s"))
		
		if mobj.testreg(id,"^\d{1,10}$") and s<>"" and len(s)<300 then			
			
			errorNum=1
			mobj.cexe "update  b2c_order_info set admin_note='"&s&"'  where order_id="&id
		else
			errorStr="参数不规范"
		end if
	else
		errorStr="请先登录"
	end if
case "version"
	on error resume next 
	errorStr="1.0"
	id=request("id")	
	errorStr=mobj.GetHttpPage("http://www.yokoer.com/version.asp?id="&id)
case else
	
end select
%>
{"s":<%=errorNum%>,"m":<%=toJSON(errorStr&beca)%>}