File: D:/web/homefly/inc/incmain.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,alladmin,success,cnn,errmsg,index,allcountries
success=true
Set rs = Server.CreateObject("ADODB.RecordSet")
Set cnn=Server.CreateObject("ADODB.Connection")
cnn.open sDSN
sSQL = "SELECT adminEmail,adminStoreURL,adminProdsPerPage,adminSubCats,adminShipping,adminUSPSUser,adminUSPSPw,adminZipCode,adminEmailConfirm,adminCountry,adminUnits,adminDelUncompleted,adminPacking,adminStockManage,adminHandling,adminTweaks,adminDelCC,currRate1,currSymbol1,currRate2,currSymbol2,currRate3,currSymbol3,currConvUser,currConvPw FROM admin WHERE adminID=1"
rs.Open sSQL,cnn,0,1
alladmin=rs.getrows
rs.Close
if request.form("posted")="1" then
adminTweaks=0
for each objItem in request.form("admintweaks")
adminTweaks = adminTweaks + Int(objItem)
next
sSQL = "UPDATE admin SET adminEmail='"&request.form("email")&"',adminStoreURL='"&request.form("url")&"',adminProdsPerPage='"&request.form("prodperpage")&"',adminSubCats="&request.form("subcats")&",adminShipping="&request.form("shipping")&",adminUSPSUser='"&request.form("USPSUser")&"',adminUSPSPw='"&request.form("USPSPass")&"',adminZipCode='"&request.form("zipcode")&"',adminCountry="&request.form("countrySetting")&",adminDelUncompleted="&request.form("deleteUncompleted")&",adminPacking="&request.form("packing")&",adminStockManage="&request.form("stockManage")&",adminHandling="&request.form("handling")&",adminTweaks="&adminTweaks&",adminDelCC="&request.form("adminDelCC")&","
if request.form("emailconfirm")="ON" then
sSQL = sSQL & "adminEmailConfirm=1, "
else
sSQL = sSQL & "adminEmailConfirm=0, "
end if
sSQL = sSQL & "adminUnits=" & request.form("adminUnits")
for index=1 to 3
if NOT IsNumeric(Trim(request.form("currRate" & index))) then
sSQL = sSQL & ",currRate" & index & "=0"
else
sSQL = sSQL & ",currRate" & index & "=" & request.form("currRate" & index)
end if
sSQL = sSQL & ",currSymbol" & index & "='" & Replace(request.form("currSymbol" & index), "'", "''") & "'"
next
sSQL = sSQL & ",currLastUpdate=" & datedelim & Now()-10 & datedelim
sSQL = sSQL & ",currConvUser='" & request.form("currConvUser") & "'"
sSQL = sSQL & ",currConvPw='" & request.form("currConvPw") & "'"
sSQL = sSQL & " WHERE adminID=1"
cnn.Execute(sSQL)
response.write "<meta http-equiv=""refresh"" content=""2; url=admin.asp"">"
else
sSQL = "SELECT countryID,countryName,countryCurrency FROM countries WHERE countryLCID<>0 ORDER BY countryOrder DESC, countryName"
rs.Open sSQL,cnn,0,1
allcountries=rs.getrows
rs.Close
sSQL = "SELECT DISTINCT countryCurrency FROM countries WHERE countryLCID<>0 ORDER BY countryCurrency"
rs.Open sSQL,cnn,0,1
allcurrencies=rs.getrows
rs.Close
end if
cnn.Close
%>
<script Language="JavaScript">
<!--
function formvalidator(theForm)
{
if(theForm.prodperpage.value == "")
{
alert("Please enter a value in the field \"Products per page\".");
theForm.prodperpage.focus();
return (false);
}
var checkOK = "0123456789";
var checkStr = theForm.prodperpage.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 enter only numbers in the field \"Products per page\".");
theForm.prodperpage.focus();
return (false);
}
for(index=1;index<=3;index++){
var checkOK = "0123456789.";
var thisRate = eval("theForm.currRate" + index);
var checkStr = thisRate.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 enter only numbers and decimal points in the field \"Conversion Rate " + index + "\".");
thisRate.focus();
return (false);
}
}
if(theForm.handling.value == "")
{
alert("Please enter a value in the field \"Handling Charge\". Enter 0 for \"No handling charge\".");
theForm.handling.focus();
return (false);
}
var checkOK = "0123456789.";
var checkStr = theForm.handling.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 enter only numbers and decimal points in the field \"Handling Charge\".");
theForm.handling.focus();
return (false);
}
return (true);
}
//-->
</script>
<table border="0" cellspacing="<%=maintablespacing%>" cellpadding="<%=maintablepadding%>" width="<%=maintablewidth%>" bgcolor="<%=maintablebg%>" align="center">
<% if request.form("posted")="1" AND success then %>
<tr>
<td width="100%">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="2" align="center"><br><b>Update Successful !</b><br><br>You will now be forwarded
to the admin home page.<br><br>
If that does not happen automatically then please <A href="admin.asp"><b>click
here</b></a>.<br>
<br>
<img src="../images/clearpixel.gif" width="350" height="1">
</td>
</tr>
</table></td>
</tr>
<% else %>
<tr>
<form method="POST" action="adminmain.asp" onSubmit="return formvalidator(this)">
<td width="100%">
<input type="hidden" name="posted" value="1">
<table width="<%=innertablewidth%>" border="0" cellspacing="<%=innertablespacing%>" cellpadding="<%=innertablepadding%>" bgcolor="<%=innertablebg%>">
<tr>
<td width="100%" colspan="2" align="center"><br><b>Use this page to update your store admin settings.</b><br> </td>
</tr>
<% if not success then %>
<tr>
<td width="100%" colspan="2" align="center"><br><font color="#FF0000"><%=errmsg%></font>
</td>
</tr>
<% end if %>
<tr>
<td width="100%" align="center" colspan="2">Which country settings do you wish to use for currency symbols etc.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Country Settings: </b>
</td>
<td width="50%" align="left"><select name="countrySetting" size="1">
<%
for index=0 to UBOUND(allcountries,2)
response.write "<option value='"&allcountries(0,index)&"'"
if alladmin(9,0)=allcountries(0,index) then response.write " selected"
response.write ">"&allcountries(1,index)&"</option>"&vbCrLf
next
%>
</select></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">If you would like to have up to 3 currency conversions, please enter the rates and currency symbols below.<br>
<font size="1">(If you don't want to use currency conversions, just leave these blank. If you are using the auto system, just choose the currency symbols you require and the rates will update automatically.)</font></td>
</tr>
<tr>
<td width="50%" align="right"><b>Conversion 1: </b>
</td>
<td width="50%" align="left"> Rate <input type="text" name="currRate1" size="10" value="<% if alladmin(17,0)<>0 then response.write alladmin(17,0)%>"> Symbol <select name="currSymbol1" size="1"><option value="">None</option>
<%
for index=0 to UBOUND(allcurrencies,2)
response.write "<option value='"&allcurrencies(0,index)&"'"
if alladmin(18,0)=allcurrencies(0,index) then response.write " selected"
response.write ">"&allcurrencies(0,index)&"</option>"&vbCrLf
next
%></select></td>
</tr>
<tr>
<td width="50%" align="right"><b>Conversion 2: </b>
</td>
<td width="50%" align="left"> Rate <input type="text" name="currRate2" size="10" value="<% if alladmin(19,0)<>0 then response.write alladmin(19,0)%>"> Symbol <select name="currSymbol2" size="1"><option value="">None</option>
<%
for index=0 to UBOUND(allcurrencies,2)
response.write "<option value='"&allcurrencies(0,index)&"'"
if alladmin(20,0)=allcurrencies(0,index) then response.write " selected"
response.write ">"&allcurrencies(0,index)&"</option>"&vbCrLf
next
%></select></td>
</tr>
<tr>
<td width="50%" align="right"><b>Conversion 3: </b>
</td>
<td width="50%" align="left"> Rate <input type="text" name="currRate3" size="10" value="<% if alladmin(21,0)<>0 then response.write alladmin(21,0)%>"> Symbol <select name="currSymbol3" size="1"><option value="">None</option>
<%
for index=0 to UBOUND(allcurrencies,2)
response.write "<option value='"&allcurrencies(0,index)&"'"
if alladmin(22,0)=allcurrencies(0,index) then response.write " selected"
response.write ">"&allcurrencies(0,index)&"</option>"&vbCrLf
next
%></select></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><font size="1">(This login and password setting are only if you wish to use the Ecommerce Templates Auto Currency updater system.)</font></td>
</tr>
<tr>
<td width="50%" align="right"><b>Username: </b>
</td>
<td width="50%" align="left"><input type="text" name="currConvUser" size="15" value="<%=alladmin(23,0)%>"></td>
</tr>
<tr>
<td width="50%" align="right"><b>Password: </b>
</td>
<td width="50%" align="left"><input type="text" name="currConvPw" size="15" value="<%=alladmin(24,0)%>"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Would you like to receive a confirmation email when orders come in.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Email confirmation: </b>
</td>
<td width="50%" align="left"><input type="checkbox" name="emailconfirm" value="ON" <%if Int(alladmin(8,0))=1 then response.write "checked"%>></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">The email address to which confirmation emails should be sent.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Email address: </b>
</td>
<td width="50%" align="left"><input type="text" name="email" size="30" value="<%=alladmin(0,0)%>"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">The Store URL should be the base URL of your store, including directory name if you have placed your store in a sub directory. For example<br>
<b><%
guessURL ="http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("PATH_INFO")
wherevs = InStr(guessURL,"vsadmin")
if wherevs > 0 then
guessURL = Left(guessURL,wherevs-1)
else
guessURL = "http://www.myurl.com/mystore/"
end if
response.write guessURL
%></b></td>
</tr>
<tr>
<td width="50%" align="right"><b>Store URL: </b>
</td>
<td width="50%" align="left"><input type="text" name="url" size="35" value="<%=alladmin(1,0)%>">
</td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">How many products you would like displayed on each page.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Products per page: </b>
</td>
<td width="50%" align="left"><input type="text" name="prodperpage" size="10" value="<%=alladmin(2,0)%>"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Set to Yes to use a category / subcategory system. Otherwise just use categories.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Use Top Categories: </b>
</td>
<td width="50%" align="left"><select name="subcats" size="1"><option value="0">No</option><option value="1" <%if Int(alladmin(3,0))=1 then response.write "selected"%>>Yes</option></select></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">If you wish to have a handling charge applied to all orders, please enter it below.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Handling Charge: </b>
</td>
<td width="50%" align="left"><input type="text" name="handling" size="10" value="<%=alladmin(14,0)%>"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Select which method you wish to use to calculate shipping.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Shipping Type: </b>
</td>
<td width="50%" align="left"><select name="shipping" size="1">
<option value="0">Don't add shipping</option>
<option value="1" <%if Int(alladmin(4,0))=1 then response.write "selected"%>>Flat Rate Shipping</option>
<option value="2" <%if Int(alladmin(4,0))=2 then response.write "selected"%>>Weight Based Shipping</option>
<option value="5" <%if Int(alladmin(4,0))=5 then response.write "selected"%>>Price Based Shipping</option>
<option value="3" <%if Int(alladmin(4,0))=3 then response.write "selected"%>>U.S.P.S. Shipping</option>
<option value="4" <%if Int(alladmin(4,0))=4 then response.write "selected"%>>UPS Shipping</option>
</select></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Select how you pack products, for shipping calculations.<BR>(Only affects UPS / USPS and weight based shipping)</td>
</tr>
<tr>
<td width="50%" align="right"><b>Pack Products: </b>
</td>
<td width="50%" align="left"><select name="packing" size="1">
<option value="0">Pack products separately.</option>
<option value="1" <%if Int(alladmin(12,0))=1 then response.write "selected"%>>Pack products together.</option>
</select></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">If using USPS shipping method, please enter your USPS username and password.<br>
<font size="1">Please note, for UPS shipping, you have to use the registration for <a href="adminupslicense.asp">here</a>.</font></td>
</tr>
<tr>
<td width="50%" align="center"><b>Username: </b><input type="text" size="15" name="USPSUser" value="<%=alladmin(5,0)%>"></td>
<td width="50%" align="center"><b>Password: </b><input type="text" size="15" name="USPSPass" value="<%=alladmin(6,0)%>"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Also, if using UPS / USPS shipping method, please enter the zip / postal code of the shipping origin.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Zip Code: </b>
</td>
<td width="50%" align="left"><input type="text" name="zipcode" size="10" value="<%=alladmin(7,0)%>"></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">If using UPS shipping, you can choose if you wanted to use lbs and Oz or Kilograms for product weights.<br>
<font size="1">Please note, some countries may be restricted as to available shipping units.</font></td>
</tr>
<tr>
<td width="50%" align="right"><b>Shipping units: </b>
</td>
<td width="50%" align="left"><select name="adminUnits" size="1">
<option value="1" <%if Int(alladmin(10,0))=1 then response.write "selected"%>>Use lbs / Oz to specify product weight.</option>
<option value="0" <%if Int(alladmin(10,0))=0 then response.write "selected"%>>Use Kilograms to specify product weight.</option>
</select></td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Would you like to use stock management?<br>
If so please indicate how long an item in a shopping basket is marked unavailable.</td>
</tr>
<tr>
<td width="50%" align="right"><b>Consider item unavailable for: </b>
</td>
<td width="50%" align="left"><select name="stockManage" size="1">
<option value="0">Don't Use Stock Management</option>
<option value="2" <% if Int(alladmin(13,0))=2 then response.write "selected"%>>2 hours</option>
<option value="3" <% if Int(alladmin(13,0))=3 then response.write "selected"%>>3 hours</option>
<option value="4" <% if Int(alladmin(13,0))=4 then response.write "selected"%>>4 hours</option>
<option value="6" <% if Int(alladmin(13,0))=6 then response.write "selected"%>>6 hours</option>
<option value="8" <% if Int(alladmin(13,0))=8 then response.write "selected"%>>8 hours</option>
<option value="12" <% if Int(alladmin(13,0))=12 then response.write "selected"%>>12 hours</option>
</select>
</td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Would you like to delete uncompleted orders?</td>
</tr>
<tr>
<td width="50%" align="right"><b>Delete after: </b>
</td>
<td width="50%" align="left"><select name="deleteUncompleted" size="1">
<option value="0">Never</option>
<option value="1" <% if Int(alladmin(11,0))=1 then response.write "selected"%>>1 day</option>
<option value="2" <% if Int(alladmin(11,0))=2 then response.write "selected"%>>2 days</option>
<option value="3" <% if Int(alladmin(11,0))=3 then response.write "selected"%>>3 days</option>
<option value="4" <% if Int(alladmin(11,0))=4 then response.write "selected"%>>4 days</option>
<option value="7" <% if Int(alladmin(11,0))=7 then response.write "selected"%>>1 week</option>
<option value="14" <% if Int(alladmin(11,0))=14 then response.write "selected"%>>2 weeks</option>
</select>
</td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Would you like to delete stored Credit Card numbers automatically?</td>
</tr>
<tr>
<td width="50%" align="right"><b>Delete after: </b>
</td>
<td width="50%" align="left"><select name="adminDelCC" size="1">
<option value="0">Never</option>
<option value="1" <% if Int(alladmin(16,0))=1 then response.write "selected"%>>1 day</option>
<option value="2" <% if Int(alladmin(16,0))=2 then response.write "selected"%>>2 days</option>
<option value="3" <% if Int(alladmin(16,0))=3 then response.write "selected"%>>3 days</option>
<option value="4" <% if Int(alladmin(16,0))=4 then response.write "selected"%>>4 days</option>
<option value="7" <% if Int(alladmin(16,0))=7 then response.write "selected"%>>1 week</option>
<option value="14" <% if Int(alladmin(16,0))=14 then response.write "selected"%>>2 weeks</option>
</select>
</td>
</tr>
<tr>
<td width="100%" align="center" colspan="2"><hr width="70%">Admin tweaks. (Only apply if you are having problems).<br><font size="1">(Ctrl-Click for multiple selections)</td>
</tr>
<tr>
<td width="50%" align="right"><b>Apply Tweaks: </b>
</td>
<td width="50%" align="left"><select name="admintweaks" size="3" multiple>
<option value="1" <% if (Int(alladmin(15,0)) AND 1)=1 then response.write "selected"%>>Use simple countries display. (Slower).</option>
<option value="2" <% if (Int(alladmin(15,0)) AND 2)=2 then response.write "selected"%>>Use simple product options display.</option>
<option value="4" <% if (Int(alladmin(15,0)) AND 4)=4 then response.write "selected"%>>Use simple product sections display.</option>
</select>
</td>
</tr>
<tr>
<td width="100%" colspan="2" align="center"><br><input type="submit" value="Submit"><br> </td>
</tr>
</table></td>
</form>
</tr>
<% end if %>
</table>