%
couponid=request("id")
if request("action")="getcoupon" then
If request.cookies("timesshop")("username")="" Then
dim url
'url=url&request.ServerVariables("SCRIPT_NAME")
'if(len(trim(request.ServerVariables("QUERY_STRING")))>0) then
'url=url & "?" & request.ServerVariables("QUERY_STRING")
'end if
url="/user/acoupon.asp"
response.Redirect "/user/login.asp?url='"&url&"'"
'response.write url
'response.end
end if
code=request.form("code")
if code="" then '如果是从按钮提交过来的就执行,若是登录后自动转入的,则
set objtemp=server.CreateObject("adodb.recordset")
objtemp.open "select * from acoupon where id="&couponid,conn,1,3
if objtemp.eof then response.end
code=objtemp("code")
kind=objtemp("kind")
content=objtemp("content")
deadline=objtemp("deadline")
max=objtemp("max")
objtemp.close
set objtemp=nothing
else
kind=request.form("kind")
content=request.form("content")
deadline=request.form("deadline")
max=request.form("max")
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from coupon where owner='"&request.cookies("timesshop")("username")&"' and code='"& code &"' order by id desc",conn,1,3
xc=rs.recordcount- max
if xc<0 then
rs.addnew
rs("code")=code
rs("owner")=request.cookies("timesshop")("username")
rs("kind")=kind
rs("content")=content
rs("gettime")=now()
rs("getfrom")="cars51"
rs("state")=0
rs("deadline")=deadline
'response.write "到这里正常 "
'response.end
rs.update
response.write " "
else
response.write " "
end if
rs.close
set rs=nothing
end if %>
<%
Call SetConn ()
intTotalNum = 0
intPageSize = 15
intTotalPageCount = 0
intCurrentPage = 0
%>
<%
set rs=server.CreateObject("adodb.recordset")
if couponid<>"" then
rs.open "select * from acoupon where id=" & couponid &" order by id desc",conn,1,1
else
rs.open "select * from acoupon where code='" & request("code") &"' order by id desc",conn,1,1
end if
if rs.eof then
response.write " "
end if
%>
礼券编号:
<%=rs("code")%>
礼券名称:
<% select case rs("kind")
case 1
response.write "比例现金抵用券"
case 2
response.write "订单折扣券"
case 3
response.write "免费商品券"
case 4
response.write "全额现金抵用券"
end select %>
礼券内容:
<%if rs("kind")=1 then %>
<%=rs("content")%> 元
<% elseif rs("kind")=2 then %>
<%=rs("content")%> 折
<% elseif rs("kind")=3 then %>
" target=_blank ><%=rs("content")%> 商品
<% elseif rs("kind")=4 then %>
<%=rs("content")%> 元
<% end if %>