HEX
Server: Microsoft-IIS/10.0
System: Windows NT ITPWINWEBSVR22 10.0 build 20348 (Windows Server 2022) AMD64
User: www.conferencesearch.co.uk (0)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: D:/web/homefly/vsadmin/inc/inczones.asp
<%
'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 Session("loggedon") <> "virtualstore" then response.end
Dim sSQL,rs,alldata,success,cnn,rowcounter,alloptions,errmsg,index,zoneName,foundmatch,hival,upperbound,isWeightBased,splitUSZones,hasMultiShip,hival2,rate2
success=true
alldata=""
Set rs = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
if request.form("posted")="1" then
	for index=1 to 200
		if request.form("id"&index)="1" then
			sSQL = "UPDATE postalzones SET pzName='"&request.form("zon"&index)&"' WHERE pzID="&index
			cnn.Execute(sSQL)
		end if
	next
	response.write "<meta http-equiv=""refresh"" content=""3; url=adminzones.asp"">"
elseif request.form("posted")="2" then
	sSQL = "DELETE FROM zoneCharges WHERE zcZone="&request.form("zone")
	cnn.Execute(sSQL)
	if IsNumeric(Trim(request.form("highweight"))) AND IsNumeric(Trim(request.form("highvalue"))) then
		rate2 = 0
		if IsNumeric(Trim(request.form("highvaluf"))) then rate2 = Trim(request.form("highvaluf"))
		sSQL = "INSERT INTO zoneCharges (zcZone,zcWeight,zcRate,zcRate2) VALUES ("&request.form("zone")&","&cStr(0.0-cDbl(request.form("highweight")))&","&request.form("highvalue")&","&rate2&")"
		if cDbl(request.form("highweight")) > 0 then cnn.Execute(sSQL)
	end if
	for index=0 to 59
		if IsNumeric(Trim(request.form("weight"&index))) AND IsNumeric(Trim(request.form("charge"&index))) then
			rate2 = 0
			if IsNumeric(Trim(request.form("chargf"&index))) then rate2 = Trim(request.form("chargf"&index))
			sSQL = "INSERT INTO zoneCharges (zcZone,zcWeight,zcRate,zcRate2) VALUES ("&request.form("zone")&","&request.form("weight"&index)&","&request.form("charge"&index)&","&rate2&")"
			if cDbl(request.form("weight"&index)) > 0 then cnn.Execute(sSQL)
		end if
	next
	response.write "<meta http-equiv=""refresh"" content=""3; url=adminzones.asp"">"
elseif request.querystring("id")<>"" then
	if Trim(request.querystring("shippingmethods"))<>"" then
		sSQL = "UPDATE postalzones SET pzMultiShipping=" & request.querystring("shippingmethods") & " WHERE pzID=" & request.querystring("id")
		cnn.Execute(sSQL)
	end if
	sSQL = "SELECT pzName,pzMultiShipping FROM postalzones WHERE pzID="&request.querystring("id")
	rs.Open sSQL,cnn,0,1
	zoneName=""
	if NOT rs.EOF then
		zoneName=rs("pzName")
		hasMultiShip=rs("pzMultiShipping")
	end if
	rs.Close
	sSQL = "SELECT zcID,zcWeight,zcRate,zcRate2 FROM zoneCharges WHERE zcZone="&request.querystring("id")&" ORDER BY zcWeight"
	rs.Open sSQL,cnn,0,1
	if NOT rs.EOF then alldata=rs.getrows
	rs.Close
else
	if request.querystring("oneuszone")="yes" then
		sSQL = "UPDATE admin SET adminUSZones=0 WHERE adminID=1"
		cnn.Execute(sSQL)
	end if
	if request.querystring("oneuszone")="no" then
		sSQL = "UPDATE admin SET adminUSZones=1 WHERE adminID=1"
		cnn.Execute(sSQL)
	end if
	if Trim(request.querystring("shippingmethods"))<>"" then
		sSQL = "UPDATE postalzones SET pzMultiShipping=" & request.querystring("shippingmethods")
		if request.querystring("id")<>"" then sSQL = sSQL & " WHERE pzID=" & request.querystring("id")
		cnn.Execute(sSQL)
	end if
	sSQL = "SELECT pzID,pzName FROM postalzones ORDER BY pzID"
	rs.Open sSQL,cnn,0,1
	if NOT rs.EOF then alldata=rs.getrows
	rs.Close
end if
sSQL = "SELECT adminShipping,adminUSZones FROM admin WHERE adminID=1"
rs.Open sSQL,cnn,0,1
shipType = Int(rs("adminShipping"))
isWeightBased = (Int(rs("adminShipping"))=2 OR Int(rs("adminShipping"))=5)
splitUSZones = (Int(rs("adminUSZones"))=1)
rs.Close
%>
      <table border="0" cellspacing="<%=maintablespacing%>" cellpadding="<%=maintablepadding%>" width="<%=maintablewidth%>" bgcolor="<%=maintablebg%>" align="center">
<% if request.form("posted")="2" AND success then %>
        <tr>
          <td width="100%">
			<table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
			  <tr> 
                <td width="100%" colspan="2" align="center"><br><b>Update Successful !</b><br><br>You will now be forwarded  
				to the postal zones home page.<br><br>
                        If that does not happen automatically then please <A href="adminzones.asp"><b>click 
                        here</b></a>.<br>
                        <br>
				<img src="../images/clearpixel.gif" width="350" height="3">
                </td>
			  </tr>
			</table></td>
        </tr>
<% elseif request.form("posted")="2" then %>
        <tr>
          <td width="100%">
			<table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
			  <tr> 
                <td width="100%" colspan="2" align="center"><br><font color="#FF0000"><b>Some records could not be updated.</b></font><br><br><%=errmsg%><br><br>
				<a href="javascript:history.go(-1)"><b>Click here to go back.</b></a></td>
			  </tr>
			</table></td>
        </tr>
<% elseif request.querystring("id")<>"" then %>
<script Language="JavaScript">
<!--
function formvalidator(theForm)
{
	var checkOK = "0123456789.";
	var checkStr = theForm.highweight.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length){
			allValid = false;
				break;
		}
	}
	if (!allValid)
	{
		alert("Please only enter numbers and decimal points in fields.");
		theForm.highweight.focus();
		return (false);
	}
	var checkStr = theForm.highvalue.value;
	var allValid = true;
	for (i = 0;  i < checkStr.length;  i++)
	{
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
			if (ch == checkOK.charAt(j))
				break;
		if (j == checkOK.length){
			allValid = false;
				break;
		}
	}
	if (!allValid)
	{
		alert("Please only enter numbers and decimal points in fields.");
		theForm.highvalue.focus();
		return (false);
	}
  for(index=0;index<60;index++)
  {
	 var theobj = eval("theForm.weight"+index);
	 var checkStr = theobj.value;
	 var allValid = true;
	 for (i = 0;  i < checkStr.length;  i++)
	 {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
		  allValid = false;
		  break;
		}
	 }
	 if (!allValid)
	 {
		alert("Please only enter numbers and decimal points in fields.");
		theobj.focus();
		return (false);
	 }
	 var theobj = eval("theForm.charge"+index);
	 var checkStr = theobj.value;
	 var allValid = true;
	 for (i = 0;  i < checkStr.length;  i++)
	 {
		ch = checkStr.charAt(i);
		for (j = 0;  j < checkOK.length;  j++)
		  if (ch == checkOK.charAt(j))
			break;
		if (j == checkOK.length)
		{
		  allValid = false;
		  break;
		}
	 }
	 if (!allValid)
	 {
		alert("Please only enter numbers and decimal points in fields.");
		theobj.focus();
		return (false);
	 }
  }
  return (true);
}
function setallzones(setto)
{
document.location="adminzones.asp?shippingmethods="+setto+"&id=<%=request.querystring("id")%>";
}
//-->
</script>
        <tr>
		  <form name="mainform" method="POST" action="adminzones.asp" onSubmit="return formvalidator(this)">
			<td width="100%" align="center">
			<input type="hidden" name="posted" value="2">
			<input type="hidden" name="zone" value="<%=request.querystring("id")%>">
            <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
			  <tr> 
                <td width="100%" align="center"><br><b>You are modifying the rules for the Postal Zone <%
				if zoneName<>"" then
					response.write chr(34)&zoneName&chr(34)
				else
					response.write "(unnamed)"
				end if%>.</b><br>&nbsp;</td>
			  </tr>
			  <tr> 
                <td width="100%" align="center">
				<% if hasMultiShip > 0 then %>
				  <font size="1">This zone is set to use multiple shipping methods, like "Standard" and "Express" shipping. To use only one shipping method for this zone, please <a href="javascript:setallzones(0)"><b>click here</b></a>.</font>
				<% else %>
				  <font size="1">This zone is set to only use one shipping method. To use multi shipping methods for this zone, like "Standard" and "Express" shipping, please <a href="javascript:setallzones(1)"><b>click here</b></a>.</font>
				<% end if %>
				</td>
			  </tr>
			  <tr> 
                <td width="100%" align="center">
                  <p><input type="submit" value="Submit">&nbsp;&nbsp;<input type="reset" value="Reset"><br>&nbsp;</p>
                </td>
			  </tr>
			  <tr> 
                <td width="100%" align="center">
				<table width="80%" cellspacing="4" cellpadding="0">
				  <tr>
					<td align="right" width="45%">For every</td>
					<td width="10%"><input type=text name="highweight" value="<%
				foundmatch=0
				hival=0
				hival2=0
				if IsArray(alldata) then
					for rowcounter=0 to UBOUND(alldata,2)
						if alldata(1,rowcounter) < 0 then
							foundmatch=abs(alldata(1,rowcounter))
							hival=alldata(2,rowcounter)
							hival2=alldata(3,rowcounter)
						end if
					next
				end if
				response.write foundmatch
				%>" size="5"></td>
					<td width="45%">above the highest <%if shipType=5 then response.write "price" else response.write "weight"%>...</td>
				  </tr>
				  <tr>
					<td align="right">...add an extra</td>
					<td><input type=text name="highvalue" value="<%=hival %>" size="5"></td><td>for standard shipping</td>
				  </tr>
				<% if hasMultiShip > 0 then %>
			      <tr><td align="right">...add an extra</td><td><input type=text name="highvaluf" value="<%=hival2 %>" size="5"></td><td>for express shipping.</td></tr>
			    <% else %>
				<input type="hidden" name="highvaluf" value="<%=hival2 %>">
				<% end if %>
				</table>
				</td>
			  </tr>
			</table>
			<table width="120" border="0" cellspacing="0" cellpadding="3" bgcolor="">
			  <tr>
				<td width="<%=Int(100/(2+hasMultiShip))%>%" align="center"><b><%if shipType=5 then response.write "Max Price" else response.write "Max Weight"%></b></td>
				<td width="<%=Int(100/(2+hasMultiShip))%>%" align="center"><b>Standard Charge</b></td>
				<% if hasMultiShip > 0 then %>
				<td width="<%=Int(100/(2+hasMultiShip))%>%" align="center"><b>Express Charge</b></td>
				<% end if %>
			  </tr>
<%
	rowcounter=0
	index=0
	if IsArray(alldata) then
		upperbound = UBOUND(alldata,2)
	else
		upperbound = -1
	end if
	do while index < 60
		if rowcounter <= upperbound then
			if alldata(1,rowcounter) > 0 then
%>
			  <tr>
				<td align="center"><input type=text name="weight<%=index%>" value="<%=alldata(1,rowcounter)%>" size="14"></td>
				<td align="center"><input type=text name="charge<%=index%>" value="<%=alldata(2,rowcounter)%>" size="14"></td>
				<% if hasMultiShip > 0 then %>
				<td align="center"><input type=text name="chargf<%=index%>" value="<%=alldata(3,rowcounter)%>" size="14"></td>
				<% else %>
				<input type="hidden" name="chargf<%=index%>" value="<%=alldata(3,rowcounter)%>">
				<% end if %>
			  </tr>
<%
				index=index+1
			end if
		else
%>
			  <tr>
				<td align="center"><input type=text name="weight<%=index%>" value="" size="14"></td>
				<td align="center"><input type=text name="charge<%=index%>" value="" size="14"></td>
				<% if hasMultiShip > 0 then %>
				<td align="center"><input type=text name="chargf<%=index%>" value="" size="14"></td>
				<% end if %>
			  </tr>
<%
			index=index+1
		end if
		rowcounter=rowcounter+1
	loop
%>
			  <tr> 
                <td width="100%" colspan="<%=2+hasMultiShip%>" align="center">
                  <p><input type="submit" value="Submit">&nbsp;&nbsp;<input type="reset" value="Reset"><br>&nbsp;</p>
                </td>
			  </tr>
			  <tr> 
                <td width="100%" colspan="<%=2+hasMultiShip%>" align="center"><br>
                          <a href="admin.asp"><b>Admin Home</b></a><br>
				<img src="../images/clearpixel.gif" width="350" height="3"></td>
			  </tr>
            </table>
		  </td>
		  </form>
        </tr>
<% elseif request.form("posted")="1" AND success then %>
        <tr>
          <td width="100%">
			<table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
			  <tr> 
                <td width="100%" colspan="2" align="center"><br><b>Update Successful !</b><br><br>You will now be forwarded  
				to the zones admin page.<br><br>
                        If that does not happen automatically then please <A href="adminzones.asp"><b>click 
                        here</b></a>.<br>
                        <br>
				<img src="../images/clearpixel.gif" width="350" height="3">
                </td>
			  </tr>
			</table></td>
        </tr>
<% elseif request.form("posted")="1" then %>
        <tr>
          <td width="100%">
			<table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
			  <tr> 
                <td width="100%" colspan="2" align="center"><br><font color="#FF0000"><b>Some records could not be updated.</b></font><br><br><%=errmsg%><br><br>
				<a href="javascript:history.go(-1)"><b>Click here to go back.</b></a></td>
			  </tr>
			</table></td>
        </tr>
<% else %>
<script Language="JavaScript">
<!--
function setallzones(setto)
{
if(confirm("This operation can not be undone. Are you sure you want to continue?")){
document.location="adminzones.asp?shippingmethods="+setto;
}
}
//-->
</script>
        <tr>
		  <form name="mainform" method="POST" action="adminzones.asp">
		  <td width="100%">
			<input type="hidden" name="posted" value="1">
            <table width="100%" border="0" cellspacing="0" cellpadding="3" bgcolor="">
			  <tr> 
                <td width="100%" <%if splitUSZones then response.write "colspan='2'"%> align="center"><br><b>Use this page to add and modify postal zones.</b><br>&nbsp;</td>
			  </tr>
			  <tr> 
                <td width="100%" <%if splitUSZones then response.write "colspan='2'"%> align="left">
				  <ul>
				  <% if not isWeightBased then %>
					<li><font size="1">Your admin settings are set to NOT use Weight / Price based shipping, so these settings will be ignored. To change this please <a href="adminmain.asp"><b>click here</b></a>.</font></li>
				  <% end if %>
				  <% if splitUSZones then %>
					<li><font size="1">Your admin settings are set to split your States into separate zones. To treat your States as one shipping zone please <a href="adminzones.asp?oneuszone=yes"><b>click here</b></a>.</font></li>
				  <% else %>
				    <li><font size="1">Your admin settings are set to treat your States as one shipping zone. To split your States into separate shipping zones please <a href="adminzones.asp?oneuszone=no"><b>click here</b></a>.</font></li>
				  <% end if %>
					<li><font size="1">Please <a href="javascript:setallzones(1)"><b>click here</b></a> to set all zones to use multi shipping methods, like "Standard" and "Express" shipping.</font></li>
				    <li><font size="1">Please <a href="javascript:setallzones(0)"><b>click here</b></a> to set all zones to use only one shipping method. You can adjust these individually per zone.</font></li>
					<li><font size="1">This is a 2 stage process. First, define a zone name. After clicking submit you will come back to this page and be able to define rules for the zone.</font></li>
				  </ul>
				</td>
			  </tr>
			  <tr>
				<td valign="top">
				  <table width="100%" cellspacing="1" cellpadding="1" border="0">
					<tr> 
					  <td width="100%" colspan="3" align="center"><b>World Zone Rules.</b><br><hr width="70%"></td>
					</tr>
					 <tr>
					  <td width="40%" align=right>&nbsp;</td>
					  <td width="20%" align=center><b>Zone Name</b></td>
					  <td width="40%" align=left><b>Zone Rules</b></td>
					</tr>
<%
	for rowcounter=0 to UBOUND(alldata,2)
		if alldata(0,rowcounter)<100 then ' First 100 are for world zones
%>
					<tr>
					  <td align=right><b><%=alldata(0,rowcounter)%> : <input type="hidden" name="id<%=alldata(0,rowcounter)%>" value="1"></b></td>
					  <td align=center><input type=text name="zon<%=alldata(0,rowcounter)%>" value="<%=alldata(1,rowcounter)%>" size="20"></td>
					  <td align=left><% if Trim(alldata(1,rowcounter)) <> "" then %><a href="adminzones.asp?id=<%=alldata(0,rowcounter)%>"><b>Edit&nbsp;Rules</b></a><% else %>&nbsp;<% end if %></td>
					</tr>
<%
		end if
	next
%>
				  </table>
				</td>

<%
	if splitUSZones then
%>
				<td width="50%" valign="top">
				  <table width="100%" cellspacing="1" cellpadding="1" border="0">
					<tr> 
					  <td width="100%" colspan="3" align="center"><b>States Zone Rules.</b><br><hr width="70%"></td>
					</tr>
					 <tr>
					  <td width="40%" align=right>&nbsp;</td>
					  <td width="20%" align=center><b>Zone Name</b></td>
					  <td width="40%" align=left><b>Zone Rules</b></td>
					</tr>
<%
		index = 0
		for rowcounter=0 to UBOUND(alldata,2)
			if alldata(0,rowcounter)>100 then ' Next 100 are for world zones
				index=index+1
%>
					<tr>
					  <td align=right><b><%=alldata(0,rowcounter)-100%> : <input type="hidden" name="id<%=alldata(0,rowcounter)%>" value="1"></b></td>
					  <td align=center><input type=text name="zon<%=alldata(0,rowcounter)%>" value="<%=alldata(1,rowcounter)%>" size="20"></td>
					  <td align=left><% if Trim(alldata(1,rowcounter)) <> "" then %><a href="adminzones.asp?id=<%=alldata(0,rowcounter)%>"><b>Edit&nbsp;Rules</b></a><% else %>&nbsp;<% end if %></td>
					</tr>
<%
			end if
		next
%>
				  </table>
				</td>
<%
	end if
%>			  </tr>
			  <tr> 
                <td width="100%" <%if splitUSZones then response.write "colspan='2'"%> align="center">
                  <p><input type="submit" value="Submit">&nbsp;&nbsp;<input type="reset" value="Reset"><br>&nbsp;</p>
                </td>
			  </tr>
			  <tr> 
                <td width="100%" <%if splitUSZones then response.write "colspan='2'"%> align="center"><br>
                          <a href="admin.asp"><b>Admin Home</b></a><br>
				<img src="../images/clearpixel.gif" width="350" height="3"></td>
			  </tr>
            </table>
		  </td>
		  </form>
        </tr>
<% end if
cnn.Close
%>
      </table>