<% '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 maxcatsperpage = 100 if maxloginlevels="" then maxloginlevels=5 Set rs = Server.CreateObject("ADODB.RecordSet") Set rsCats = Server.CreateObject("ADODB.RecordSet") Set cnn=Server.CreateObject("ADODB.Connection") cnn.open sDSN alreadygotadmin = getadminsettings() sSQL = "" if request.form("act")="changepos" then currentorder = Int(Request.Form("selectedq")) neworder = Int(Request.Form("newval")) sSQL = "SELECT sectionID FROM sections ORDER BY sectionOrder" rs.Open sSQL,cnn,0,1 alldata=rs.getrows rs.Close FOR rowcounter=0 TO ubound(alldata,2) theorder = rowcounter+1 if currentorder = theorder then theorder = neworder elseif (currentorder > theorder) AND (neworder <= theorder) then theorder = theorder + 1 elseif (currentorder < theorder) AND (neworder >= theorder) then theorder = theorder - 1 end if sSQL="UPDATE sections SET sectionOrder="&theorder&" WHERE sectionID="&alldata(0,rowcounter) cnn.Execute(sSQL) NEXT response.write "" elseif request.form("posted")="1" then if request.form("act")="delete" then sSQL = "DELETE FROM cpnassign WHERE cpaType=1 AND cpaAssignment='"&request.form("id")&"'" cnn.Execute(sSQL) sSQL = "DELETE FROM sections WHERE sectionID=" & request.form("id") cnn.Execute(sSQL) sSQL = "DELETE FROM multisections WHERE pSection=" & request.form("id") cnn.Execute(sSQL) response.write "" elseif request.form("act")="domodify" then sSQL = "UPDATE sections SET sectionName='"&Trim(replace(request.form("secname"),"'","''"))&"',sectionDescription='"&replace(request.form("secdesc"),"'","''")&"',sectionImage='"&replace(request.form("secimage"),"'","''")&"',topSection="&request.form("tsTopSection")&",rootSection="&request.form("catfunction") workname = Trim(replace(request.form("secworkname"),"'","''")) if workname<>"" then sSQL = sSQL & ",sectionWorkingName='"&workname&"'" else sSQL = sSQL & ",sectionWorkingName='"&Trim(replace(request.form("secname"),"'","''"))&"'" end if for index=2 to adminlanguages+1 if (adminlangsettings AND 256)=256 then sSQL = sSQL & ",sectionName" & index & "='"&Trim(replace(request.form("secname" & index),"'","''"))&"'" end if if (adminlangsettings AND 512)=512 then sSQL = sSQL & ",sectionDescription" & index & "='"&Trim(replace(request.form("secdesc" & index),"'","''"))&"'" end if next sSQL = sSQL & ",sectionDisabled=" & trim(request.form("sectionDisabled")) sSQL = sSQL & ",sectionurl='" & replace(trim(request.form("sectionurl")),"'","''") & "'" sSQL = sSQL & " WHERE sectionID="&Request.Form("id") cnn.Execute(sSQL) response.write "" elseif request.form("act")="doaddnew" then sSQL = "SELECT MAX(sectionOrder) AS mxOrder FROM sections" rs.Open sSQL,cnn,0,1 mxOrder = rs("mxOrder") rs.Close if IsNull(mxOrder) OR mxOrder="" then mxOrder=1 else mxOrder=mxOrder+1 sSQL = "INSERT INTO sections (sectionName,sectionDescription,sectionImage,sectionOrder,topSection,rootSection,sectionWorkingName" for index=2 to adminlanguages+1 if (adminlangsettings AND 256)=256 then sSQL = sSQL & ",sectionName" & index end if if (adminlangsettings AND 512)=512 then sSQL = sSQL & ",sectionDescription" & index end if next sSQL = sSQL & ",sectionDisabled,sectionurl) VALUES ('"&Trim(replace(request.form("secname"),"'","''"))&"','"&replace(request.form("secdesc"),"'","''")&"','"&replace(request.form("secimage"),"'","''")&"',"&mxOrder&","&request.form("tsTopSection")&","&request.form("catfunction") workname = Trim(replace(request.form("secworkname"),"'","''")) if workname<>"" then sSQL = sSQL & ",'"&workname&"'" else sSQL = sSQL & ",'"&Trim(replace(request.form("secname"),"'","''"))&"'" end if for index=2 to adminlanguages+1 if (adminlangsettings AND 256)=256 then sSQL = sSQL & ",'"&Trim(replace(request.form("secname" & index),"'","''"))&"'" end if if (adminlangsettings AND 512)=512 then sSQL = sSQL & ",'"&Trim(replace(request.form("secdesc" & index),"'","''"))&"'" end if next sSQL = sSQL & "," & trim(request.form("sectionDisabled")) sSQL = sSQL & ",'" & replace(trim(request.form("sectionurl")),"'","''") & "')" cnn.Execute(sSQL) response.write "" elseif request.form("act")="dodiscounts" then sSQL = "INSERT INTO cpnassign (cpaCpnID,cpaType,cpaAssignment) VALUES ("&request.form("assdisc")&",1,'"&request.form("id")&"')" cnn.Execute(sSQL) response.write "" elseif request.form("act")="deletedisc" then sSQL = "DELETE FROM cpnassign WHERE cpaID="&request.form("id") 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 alltopsections="" if request.form("act")="modify" then sSQL = "SELECT sectionID,sectionName,sectionName2,sectionName3,rootSection,sectionImage,sectionWorkingName,topSection,sectionDisabled,sectionurl,sectionDescription FROM sections WHERE sectionID="&Request.Form("id") rs.Open sSQL,cnn,0,1 sectionID = rs("sectionID") sectionName = rs("sectionName") sectionName2 = rs("sectionName2") sectionName3 = rs("sectionName3") rootSection = rs("rootSection") sectionImage = rs("sectionImage") sectionWorkingName = rs("sectionWorkingName") topSection = rs("topSection") sectionDisabled = rs("sectionDisabled") sectionurl = rs("sectionurl")&"" sectionDescription = rs("sectionDescription") rs.Close else sectionID = "" sectionName = "" sectionName2 = "" sectionName3 = "" rootSection = 1 sectionImage = "" sectionWorkingName = "" topSection = 0 sectionDisabled = 0 sectionurl = "" sectionDescription = "" end if sSQL = "SELECT sectionID,sectionWorkingName FROM sections WHERE rootSection=0 ORDER BY sectionWorkingName" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then alltopsections=rs.getrows end if rs.Close %> <% elseif request.form("act")="discounts" then sSQL = "SELECT sectionName FROM sections WHERE sectionID="&request.form("id") rs.Open sSQL,cnn,0,1 thisname=rs("sectionName") rs.Close alldata="" sSQL = "SELECT cpaID,cpaCpnID,cpnWorkingName,cpnSitewide,cpnEndDate,cpnType FROM cpnassign INNER JOIN coupons ON cpnassign.cpaCpnID=coupons.cpnID WHERE cpaType=1 AND cpaAssignment='" & request.form("id") & "'" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then alldata=rs.GetRows rs.Close alldata2="" tdt = Date() sSQL = "SELECT cpnID,cpnWorkingName,cpnSitewide FROM coupons WHERE (cpnSitewide=0 OR cpnSitewide=3) AND cpnEndDate >="&datedelim&VSUSDate(tdt)&datedelim rs.Open sSQL,cnn,0,1 if NOT rs.EOF then alldata2=rs.GetRows rs.Close %> <% elseif request.form("act")="changepos" then %> <% elseif request.form("posted")="1" AND success then %> <% elseif request.form("posted")="1" then %> <% else function writeposition(currpos,maxpos) Dim reqtext,i reqtext="" end function allcoupon="" sSQL = "SELECT DISTINCT cpaAssignment FROM cpnassign WHERE cpaType=1" rs.Open sSQL,cnn,0,1 if NOT rs.EOF then allcoupon=rs.getrows rs.Close %> <% end if cnn.Close set rs = nothing set rsCats = nothing set cnn = nothing %>
<% if request.form("act")="modify" then %> <% else %> <% end if %> " /> " />
<%=yyCatAdm%>
 
<%=yyCatNam%>
" />
<% for index=2 to adminlanguages+1 if (adminlangsettings AND 256)=256 then %> <%=yyCatNam & " " & index %>
" />
<% end if next %>
<%=yyCatDes%>

<% for index=2 to adminlanguages+1 if (adminlangsettings AND 512)=512 then if request.form("act")="modify" then sSQL = "SELECT sectionDescription" & index & " FROM sections WHERE sectionID="&Request.Form("id") rs.Open sSQL,cnn,0,1 sectionDescription = rs("sectionDescription" & index) rs.Close else sectionDescription = "" end if %> <%=yyCatDes & " " & index %>

<% end if next %>  

 
Category URL (Optional)
" />
<%=yyCatWrNa%>
" />
<%=yyCatSub%>
<%=yyCatFn%>
<%=yyCatImg%>
" />


  • <%=yyCatEx1%>
  • <%=yyCatEx2%>

<%=yyAdmHom%>
 
" /> " /> <% gotone=false if IsArray(alldata2) then thestr = "" end if if gotone then response.write thestr else %> <% end if if IsArray(alldata) then %> <% for index=0 to UBOUND(alldata,2) prefont = "" postfont = "" if alldata(3,index)=1 OR alldata(4,index)-Date() < 0 then prefont = "" postfont = "" end if %> <% next else %> <% end if %>
<%=yyAssDis%> "<%=thisname%>".
 
"&yyAsDsCp&":

<%=yyNoDis%>

<%=yyCurDis%> "<%=thisname%>".
 
<%=yyWrkNam%> <%=yyDisTyp%> <%=yyExpire%> <%=yyDelete%>
<%=prefont & alldata(2,index) & postfont %> <% if alldata(5,index)=0 then response.write prefont & yyFrSShp & postfont elseif alldata(5,index)=1 then response.write prefont & yyFlatDs & postfont elseif alldata(5,index)=2 then response.write prefont & yyPerDis & postfont end if %> <% if alldata(4,index)=DateSerial(3000,1,1) then response.write yyNever elseif alldata(4,index)-Date() < 0 then response.write ""&yyExpird&"" else response.write prefont & alldata(4,index) & postfont end if %>

<%=yyNoAss%>

 

<%=yyAdmHom%>
 

 

 

 

<%=yyUpdat%> . . . . . . .

 

<%=yyNoFor%> "><%=yyClkHer%>.

 

 


<%=yyUpdSuc%>

<%=yyNowFrd%>

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


<%=yyOpFai%>

<%=errmsg%>

<%=yyClkBac%>
" /> <% Function writepagebar(CurPage, iNumPages) Dim sLink, i, sStr, startPage, endPage sLink = "« " & sLink & CurPage-1 & "'>Previous | " else sStr = "« Previous | " end if for i=startPage to endPage if i=CurPage then sStr = sStr & i & " | " else sStr = sStr & sLink & i & "'>" if i=startPage AND i > 1 then sStr=sStr&"..." sStr = sStr & i if i=endPage AND i < iNumPages then sStr=sStr&"..." sStr = sStr & " | " end if next if CurPage < iNumPages then writepagebar = sStr & sLink & CurPage+1 & "'>Next " & sLink & iNumPages & "'>»" else writepagebar = sStr & " Next »" end if End function If Request.QueryString("pg") = "" Then CurPage = 1 Else CurPage = Int(Request.QueryString("pg")) End If sSQL = "SELECT sectionID,sectionWorkingName,sectionDescription,topSection,rootSection,sectionDisabled FROM sections ORDER BY sectionOrder" rsCats.CursorLocation = 3 ' adUseClient rsCats.CacheSize = maxcatsperpage rsCats.Open sSQL,cnn if NOT rsCats.EOF then rsCats.MoveFirst rsCats.PageSize = maxcatsperpage rsCats.AbsolutePage = CurPage islooping=false noproducts=false hascatinprodsection=false rowcounter=0 totnumrows=rsCats.RecordCount iNumOfPages = Int((totnumrows + (maxcatsperpage-1)) / maxcatsperpage) If iNumOfPages > 1 Then Response.Write "" %> <% do while NOT rsCats.EOF AND rowcounter < maxcatsperpage if bgcolor="#E7EAEF" then bgcolor="#FFFFFF" else bgcolor="#E7EAEF"%> <% rowcounter=rowcounter+1 rsCats.MoveNext loop If iNumOfPages > 1 Then Response.Write "" if islooping then %> <% end if if hascatinprodsection then %> <% end if %> <% else %> <% end if rsCats.Close %>
<%=yyCatAdm%>
 
" & writepagebar(CurPage, iNumOfPages) & "

<%=yyOrder%> <%=yyCatPat%> <%=yyCatNam%> <%=yyDiscnt%> <%=yyModify%> <%=yyDelete%>
<%=writeposition((maxcatsperpage*(CurPage-1))+rowcounter+1,totnumrows)%> <% tslist = "" thetopts = rsCats("topSection") for index=0 to 10 if thetopts=0 then tslist = yyHome & tslist exit for elseif index=10 then tslist = ""&yyLoop&"" & tslist islooping=true else sSQL = "SELECT sectionID,topSection,sectionWorkingName,rootSection FROM sections WHERE sectionID=" & thetopts rs.Open sSQL,cnn,0,1 if NOT rs.EOF then errstart = "" errend = "" if rs("rootSection")=1 then errstart = "" errend = "" hascatinprodsection=true end if tslist = " » " & errstart & rs("sectionWorkingName") & errend & tslist thetopts = rs("topSection") else tslist = ""&yyTopDel&"" & tslist rs.Close exit for end if rs.Close end if next response.write "" & tslist & "" if Int(CStr(rsCats("rootSection")))=1 then response.write "" if Int(CStr(rsCats("sectionDisabled")))=127 then response.write "" response.write rsCats("sectionWorkingName") & " (" & rsCats("sectionID") & ")" if Int(CStr(rsCats("sectionDisabled")))=127 then response.write "" if Int(CStr(rsCats("rootSection")))=1 then response.write "" response.write " type="button" value="<%=yyAssign%>" onclick="dsk('<%=rsCats("sectionID")%>')"> ')" /> ')" />

" & writepagebar(CurPage, iNumOfPages) & "

** <%=yyCatEx3%>

  • <%=yyCPErr%>

  • <%=yyCatEx4%>

<%=yyCatEx5%>
 

<%=yyCatNew%>  
 

<%=yyAdmHom%>