<% 'This code is copyright (c) Internet Business Solutions SL, all rights reserved. 'The contents of this file are protect under law as the intellectual property 'of Internet Business Solutions SL. Any use, reproduction, disclosure or copying 'of any kind without the express and written permission of Internet Business 'Solutions SL is forbidden. 'Author: Vince Reid, vince@virtualred.net if storesessionvalue="" then storesessionvalue="virtualstore" if Session("loggedon") <> storesessionvalue OR disallowlogin=TRUE then response.end Dim sSQL,rs,alldata,alladmin,success,cnn,rowcounter,errmsg success=true Set rs = Server.CreateObject("ADODB.RecordSet") Set cnn=Server.CreateObject("ADODB.Connection") cnn.open sDSN alreadygotadmin = getadminsettings() Session.LCID = 1033 sSQL = "" if request.form("posted")="1" then if request.form("act")="delete" then sSQL = "DELETE FROM cpnassign WHERE cpaCpnID=" & request.form("id") cnn.Execute(sSQL) sSQL = "DELETE FROM coupons WHERE cpnID=" & request.form("id") cnn.Execute(sSQL) response.write "" elseif request.form("act")="domodify" then cpnName = trim(request.form("cpnName")) sSQL = "UPDATE coupons SET cpnName='" & replace(request.form("cpnName"),"'","''") & "'" for index=2 to adminlanguages+1 if (adminlangsettings AND 1024)=1024 then sSQL = sSQL & ",cpnName"&index&"='" & replace(request.form("cpnName"&index),"'","''") & "'" next if trim(request.form("cpnWorkingName"))<>"" then sSQL = sSQL & ",cpnWorkingName='" & replace(request.form("cpnWorkingName"),"'","''")&"'" else sSQL = sSQL & ",cpnWorkingName='" & replace(cpnName,"'","''")&"'" end if if request.form("cpnIsCoupon")="0" then sSQL = sSQL & ",cpnNumber=''," else sSQL = sSQL & ",cpnNumber='" & replace(request.form("cpnNumber"),"'","''") & "'," end if sSQL = sSQL & "cpnType=" & request.form("cpnType") & "," numdays=0 if IsNumeric(request.form("cpnEndDate")) then numdays = Int(request.form("cpnEndDate")) if numdays > 0 then tdt = Date() + Int(request.form("cpnEndDate")) sSQL = sSQL & "cpnEndDate=" & datedelim & VSUSDate(tdt) & datedelim & "," else sSQL = sSQL & "cpnEndDate=" & datedelim & VSUSDate(DateSerial(3000,1,1)) & datedelim & "," end if if IsNumeric(request.form("cpnDiscount")) AND request.form("cpnType")<>"0" then sSQL = sSQL & "cpnDiscount=" & request.form("cpnDiscount") & "," else sSQL = sSQL & "cpnDiscount=0," end if if IsNumeric(request.form("cpnThreshold")) then sSQL = sSQL & "cpnThreshold=" & request.form("cpnThreshold") & "," else sSQL = sSQL & "cpnThreshold=0," end if if IsNumeric(request.form("cpnThresholdMax")) then sSQL = sSQL & "cpnThresholdMax=" & request.form("cpnThresholdMax") & "," else sSQL = sSQL & "cpnThresholdMax=0," end if if IsNumeric(request.form("cpnThresholdRepeat")) then sSQL = sSQL & "cpnThresholdRepeat=" & request.form("cpnThresholdRepeat") & "," else sSQL = sSQL & "cpnThresholdRepeat=0," end if if IsNumeric(request.form("cpnQuantity")) then sSQL = sSQL & "cpnQuantity=" & request.form("cpnQuantity") & "," else sSQL = sSQL & "cpnQuantity=0," end if if IsNumeric(request.form("cpnQuantityMax")) then sSQL = sSQL & "cpnQuantityMax=" & request.form("cpnQuantityMax") & "," else sSQL = sSQL & "cpnQuantityMax=0," end if if IsNumeric(request.form("cpnQuantityRepeat")) then sSQL = sSQL & "cpnQuantityRepeat=" & request.form("cpnQuantityRepeat") & "," else sSQL = sSQL & "cpnQuantityRepeat=0," end if if Trim(request.form("cpnNumAvail"))<>"" AND IsNumeric(request.form("cpnNumAvail")) then sSQL = sSQL & "cpnNumAvail=" & request.form("cpnNumAvail") & "," else sSQL = sSQL & "cpnNumAvail=30000000," end if if request.form("cpnType")="0" then sSQL = sSQL & "cpnCntry=" & request.form("cpnCntry") &"," else sSQL = sSQL & "cpnCntry=0," end if sSQL = sSQL & "cpnIsCoupon=" & request.form("cpnIsCoupon") &"," if request.form("cpnType")="0" then sSQL = sSQL & "cpnSitewide=1" else sSQL = sSQL & "cpnSitewide=" & request.form("cpnSitewide") end if sSQL = sSQL & " WHERE cpnID="&Request.Form("id") cnn.Execute(sSQL) response.write "" elseif request.form("act")="doaddnew" then cpnName = trim(request.form("cpnName")) sSQL = "INSERT INTO coupons (cpnName," for index=2 to adminlanguages+1 if (adminlangsettings AND 1024)=1024 then sSQL = sSQL & "cpnName"&index&"," next sSQL = sSQL & "cpnWorkingName,cpnNumber,cpnType,cpnEndDate,cpnDiscount,cpnThreshold,cpnThresholdMax,cpnThresholdRepeat,cpnQuantity,cpnQuantityMax,cpnQuantityRepeat,cpnNumAvail,cpnCntry,cpnIsCoupon,cpnSitewide) VALUES (" & _ "'"&replace(cpnName,"'","''")&"'," for index=2 to adminlanguages+1 if (adminlangsettings AND 1024)=1024 then sSQL = sSQL & "'"&replace(trim(request.form("cpnName"&index)),"'","''")&"'," next if trim(request.form("cpnWorkingName"))<>"" then sSQL = sSQL & "'"&replace(trim(request.form("cpnWorkingName")),"'","''")&"'," else sSQL = sSQL & "'"&replace(cpnName,"'","''")&"'," end if if request.form("cpnIsCoupon")="0" then sSQL = sSQL & "''," else sSQL = sSQL & "'"&replace(request.form("cpnNumber"),"'","''")&"'," end if sSQL = sSQL & request.form("cpnType") & "," numdays=0 if IsNumeric(request.form("cpnEndDate")) then numdays = Int(request.form("cpnEndDate")) if numdays > 0 then tdt = Date() + Int(request.form("cpnEndDate")) sSQL = sSQL & datedelim & VSUSDate(tdt) & datedelim & "," else sSQL = sSQL & datedelim & VSUSDate(DateSerial(3000,1,1)) & datedelim & "," end if if IsNumeric(request.form("cpnDiscount")) AND request.form("cpnType")<>"0" then sSQL = sSQL & request.form("cpnDiscount") & "," else sSQL = sSQL & "0," end if if IsNumeric(request.form("cpnThreshold")) then sSQL = sSQL & request.form("cpnThreshold") & "," else sSQL = sSQL & "0," end if if IsNumeric(request.form("cpnThresholdMax")) then sSQL = sSQL & request.form("cpnThresholdMax") & "," else sSQL = sSQL & "0," end if if IsNumeric(request.form("cpnThresholdRepeat")) then sSQL = sSQL & request.form("cpnThresholdRepeat") & "," else sSQL = sSQL & "0," end if if IsNumeric(request.form("cpnQuantity")) then sSQL = sSQL & request.form("cpnQuantity") & "," else sSQL = sSQL & "0," end if if IsNumeric(request.form("cpnQuantityMax")) then sSQL = sSQL & request.form("cpnQuantityMax") & "," else sSQL = sSQL & "0," end if if IsNumeric(request.form("cpnQuantityRepeat")) then sSQL = sSQL & request.form("cpnQuantityRepeat") & "," else sSQL = sSQL & "0," end if if Trim(request.form("cpnNumAvail"))<>"" AND IsNumeric(request.form("cpnNumAvail")) then sSQL = sSQL & request.form("cpnNumAvail") & "," else sSQL = sSQL & "30000000," end if if request.form("cpnType")="0" then sSQL = sSQL & request.form("cpnCntry") &"," else sSQL = sSQL & "0," end if sSQL = sSQL & request.form("cpnIsCoupon") &"," if request.form("cpnType")="0" then sSQL = sSQL & "1)" else sSQL = sSQL & request.form("cpnSitewide") & ")" end if cnn.Execute(sSQL) response.write "" end if end if %> <% if request.form("posted")="1" AND (request.form("act")="modify" OR request.form("act")="addnew") then if request.form("act")="modify" then sSQL = "SELECT cpnName,cpnName2,cpnName3,cpnWorkingName,cpnNumber,cpnType,cpnEndDate,cpnDiscount,cpnThreshold,cpnThresholdMax,cpnThresholdRepeat,cpnQuantity,cpnQuantityMax,cpnQuantityRepeat,cpnNumAvail,cpnCntry,cpnIsCoupon,cpnSitewide FROM coupons WHERE cpnID="&Request.Form("id") rs.Open sSQL,cnn,0,1 cpnName = rs("cpnName") cpnName2 = rs("cpnName2")&"" cpnName3 = rs("cpnName3")&"" cpnWorkingName = rs("cpnWorkingName") cpnNumber = rs("cpnNumber") cpnType = rs("cpnType") cpnEndDate = rs("cpnEndDate") cpnDiscount = rs("cpnDiscount") cpnThreshold = rs("cpnThreshold") cpnThresholdMax = rs("cpnThresholdMax") cpnThresholdRepeat = rs("cpnThresholdRepeat") cpnQuantity = rs("cpnQuantity") cpnQuantityMax = rs("cpnQuantityMax") cpnQuantityRepeat = rs("cpnQuantityRepeat") cpnNumAvail = rs("cpnNumAvail") cpnCntry = rs("cpnCntry") cpnIsCoupon = rs("cpnIsCoupon") cpnSitewide = rs("cpnSitewide") rs.Close else cpnName = "" cpnName2 = "" cpnName3 = "" cpnWorkingName = "" cpnNumber = "" cpnType = 0 cpnEndDate = DateSerial(3000,1,1) cpnDiscount = "" cpnThreshold = 0 cpnThresholdMax = 0 cpnThresholdRepeat = 0 cpnQuantity = 0 cpnQuantityMax = 0 cpnQuantityRepeat = 0 cpnNumAvail = 30000000 cpnCntry = 0 cpnIsCoupon = 0 cpnSitewide = 0 end if %> <% elseif request.form("posted")="1" AND success then %> <% elseif request.form("posted")="1" then %> <% else sSQL = "SELECT cpnID,cpnWorkingName,cpnSitewide,cpnIsCoupon,cpnEndDate FROM coupons ORDER BY cpnIsCoupon,cpnWorkingName" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then alldata=rs.getrows rs.Close %> <% end if cnn.Close set rs = nothing set cnn = nothing %>
<% if request.form("act")="modify" then %> " /> <% else %> <% end if %> <% for index=2 to adminlanguages+1 if (adminlangsettings AND 1024)=1024 then if request.form("act")="modify" then execute ("cpnName = cpnName" & index) else cpnName = "" %><% end if next %>
<%=yyDscNew%>
 
<%=yyCpnDsc%>:
<%=yyDscEff%>:
<%=yyDisTxt%>: " />
<%=yyDisTxt & " " & index%>: " />
<%=yyWrkNam%>: " />
<%=yyCpnCod%>:
<%=yyNumAvl%>:
<%=yyDaysAv%>: " />
<%=yyMinPur%>: <%=yyRepEvy%>:
<%=yyMaxPur%>:
<%=yyMinQua%>: <%=yyRepEvy%>:
<%=yyMaxQua%>:
<%=yyDscAmt%>:
<%=yyScope%>:
<%=yyRestr%>:


 

<%=yyAdmHom%>
 

<%=yyUpdSuc%>

<%=yyNowFrd%>

<%=yyNoAuto%> <%=yyClkHer%>.


<%=yyOpFai%>

<%=errmsg%>

<%=yyClkBac%>
<% Session.LCID = saveLCID if IsArray(alldata) then for rowcounter=0 to UBOUND(alldata,2) if bgcolor="#E7EAEF" then bgcolor="#FFFFFF" else bgcolor="#E7EAEF" %> <% next else %> <% end if %>

<%=yyDscAdm%>
 
<%=yyWrkNam%> <%=yyType%> <%=yyExpDat%> <%=yyGlobal%> <%=yyModify%> <%=yyDelete%>
<%=alldata(1,rowcounter)%> <% if alldata(3,rowcounter)=1 then response.write yyCoupon else response.write yyDisco%> <% if alldata(4,rowcounter)=DateSerial(3000,1,1) then response.write yyNever elseif alldata(4,rowcounter)-Date() < 0 then response.write ""&yyExpird&"" else response.write alldata(4,rowcounter) end if %> <% if alldata(2,rowcounter)=1 OR alldata(2,rowcounter)=2 then response.write yyYes else response.write yyNo %>

<%=yyNoDsc%>
 

<%=yyPOClk%>   
 

<%=yyAdmHom%>