<!--#include file="../../conn/conn.asp"-->
<!--#include file="../../inc/safe.asp"-->
<%
if session("id")="" then 
response.Redirect("../../login/login1.asp")
response.end
end if
%>
<%
  Response.Buffer = true
  Response.ExpiresAbsolute=now()-1
  Response.Expires=0
  Response.CacheControl="no-cache"
%>
<%
if Not ChkPost then 
response.redirect ("../../login/chklogin.asp?login=4")
response.end
end if

if session("id")="" then
response.Redirect("../../login/login1.asp")
response.end
end if
%>

<%
if Chkrequest(request("keyid")) then
keyid=request("keyid")
else
Response.Redirect ("../login/chklogin.asp?login=4")
end if
mytype=replace_text(request("type"))

set rs=conn.execute("select buyorder,saleorder from emailorder where gsid="&session("id")&"")
orderbuy=rs("buyorder")
if orderbuy<>"" then
  if instr(orderbuy,",")>0 then
  Arrob=split(orderbuy,",")
  end if
end if
ordersale=rs("saleorder")
if ordersale<>"" then
  if instr(ordersale,",")>0 then
  Arros=split(ordersale,",")
  end if
end if

if mytype="buy" then
select case keyid
case 0
conn.execute("update emailorder set buyorder='' where gsid="&session("id")&"")
case 1
conn.execute("update emailorder set buyorder='"&replace(orderbuy,Arrob(0)&",","")&"' where gsid="&session("id")&"")
case 2
conn.execute("update emailorder set buyorder='"&replace(orderbuy,","&Arrob(1),"")&"' where gsid="&session("id")&"")
case 3
conn.execute("update emailorder set buyorder='"&replace(orderbuy,","&Arrob(2),"")&"' where gsid="&session("id")&"")
case else
Response.Redirect ("index.asp")
end select
elseif mytype="sale" then
select case keyid
case 0
conn.execute("update emailorder set saleorder='' where gsid="&session("id")&"")
case 1
conn.execute("update emailorder set saleorder='"&replace(ordersale,Arros(0)&",","")&"' where gsid="&session("id")&"")
case 2
conn.execute("update emailorder set saleorder='"&replace(ordersale,","&Arros(1),"")&"' where gsid="&session("id")&"")
case 3
conn.execute("update emailorder set saleorder='"&replace(ordersale,","&Arros(2),"")&"' where gsid="&session("id")&"")
case else
Response.Redirect ("index.asp")
end select
else
Response.Redirect ("index.asp")
end if
%>

<%
rs.close
set rs=noting
conn.close
set conn=nothing

response.Redirect ("ordermodify_begin.asp")
%>