Avatar billede ujo33 Nybegynder
07. september 2003 - 14:48 Der er 5 kommentarer

eShop - vise betalingstypen

Jeg har et lille problem.
Jeg har "lavet" eShop og kan simpelthen ikke finde ud af hvordan jeg skal vise betalingstypen.
Dvs. efter man har købt en varer og komme ind i udfyldningsformularen (adresse, tlf osv.) skal man vælge enten forudbetaling eller efterkrav (under "betaling"). Efter man har valgt betalingstypen og klik på "til kassen" går man videre til en oversigt. Her kan man se hvordan samlede resultat ser ud. Og det er her jeg har problem, et felt der hedder "porto" skal ellers hente en kode fra forrige side (udfyldningsformularen) fra feltet "betaling". Dvs. når man har f.eks. valgt efterkrav og godkender bestillingen, skulle efterkravsgebyret vises i den næste side under "porto" feltet som er 45 kr.
Hvordan skal jeg gøre ?

URL adressen: www.kalaaleq.gl/shop/index.php

Her er php-filen:

<?php
$cartEmpty=FALSE;
$isInStock=TRUE;
$tempOutOfStock=FALSE;
$errormsg = "";
$id = trim(@$_POST["id"]);
$sSQL = "SELECT adminEmail,adminStoreURL,countryLCID,countryCurrency,adminUSZones,adminStockManage FROM admin LEFT JOIN countries ON admin.adminCountry=countries.countryID WHERE adminID=1";
$result = mysql_query($sSQL) or print(mysql_error());
$rs = mysql_fetch_array($result);
$splitUSZones = ((int)$rs["adminUSZones"]==1);
$adminLocale = $rs["countryLCID"];
$countryCurrency = $rs["countryCurrency"];
$useEuro = ($rs["countryCurrency"]=="EUR");
$storeurl = $rs["adminStoreURL"];
if((substr(strtolower($storeurl),0,7) != "http://") && (substr(strtolower(storeurl),8) != "https://"))
    $storeurl = "http://" . $storeurl;
if(substr($storeurl,-1) != "/") $storeurl .= "/";
$stockManage = (int)$rs["adminStockManage"];
mysql_free_result($result);

if($stockManage != 0){
    $sSQL = "DELETE FROM cart WHERE cartCompleted=0 AND cartOrderID=0 AND cartDateAdded<'" . date("Y-m-d H:i:s", time()-($stockManage*60*60)) . "'";
    mysql_query($sSQL) or print(mysql_error());
}
if(@$_POST["mode"]=="update"){
    foreach(@$_POST as $objItem => $objValue){
        if(substr($objItem,0,5)=="quant"){
            if((int)$objValue==0){
                $sSQL="DELETE FROM cartoptions WHERE coCartID=" . substr($objItem, 5);
                mysql_query($sSQL) or print(mysql_error());
                $sSQL="DELETE FROM cart WHERE cartID=" . substr($objItem, 5);
                mysql_query($sSQL) or print(mysql_error());
            }else{
                if($stockManage != 0){
                    $totQuant = 0;
                    $sSQL="SELECT cartQuantity,pInStock,pID FROM cart LEFT JOIN products ON cart.cartProdId=products.pID WHERE cartID=" . substr($objItem, 5);
                    $result = mysql_query($sSQL) or print(mysql_error());
                    $rs = mysql_fetch_array($result);
                    $pID = trim($rs["pID"]);
                    $pInStock = (int)$rs["pInStock"];
                    $cartQuantity = (int)$rs["cartQuantity"];
                    mysql_free_result($result);
                    $sSQL = "SELECT SUM(cartQuantity) AS cartQuant FROM cart WHERE cartCompleted=0 AND cartProdID='" . $pID . "'";
                    $result = mysql_query($sSQL) or print(mysql_error());
                    if($rs = mysql_fetch_array($result))
                        $totQuant = (int)$rs["cartQuant"];
                    mysql_free_result($result);
                    if(($pInStock - $totQuant + $cartQuantity - (int)$objValue) >= 0){
                        $sSQL="UPDATE cart SET cartQuantity=" . $objValue . " WHERE cartID=" . substr($objItem, 5);
                        mysql_query($sSQL) or print(mysql_error());
                    }else
                        $isInStock = FALSE;
                }else{
                    $sSQL="UPDATE cart SET cartQuantity=" . $objValue . " WHERE cartID=" . substr($objItem, 5);
                    mysql_query($sSQL) or print(mysql_error());
                }
            }
        }elseif(substr($objItem,0,5)=="delet"){
            $sSQL="DELETE FROM cart WHERE cartID=" . substr($objItem, 5);
            mysql_query($sSQL) or print(mysql_error());
            $sSQL="DELETE FROM cartoptions WHERE coCartID=" . substr($objItem, 5);
            mysql_query($sSQL) or print(mysql_error());
        }
    }
}

if(@$_POST["mode"]=="add"){
    $bExists = FALSE;
    if(@$_POST["quant"]=="" || ! is_numeric(@$_POST["quant"]))
        $quantity=1;
    else
        $quantity=(int)@$_POST["quant"];

    $sSQL = "SELECT cartID FROM cart WHERE cartCompleted=0 AND cartSessionID='" . session_id() . "' AND cartProdID='" . $id . "'";
    $result = mysql_query($sSQL) or print(mysql_error());
    if($rs = mysql_fetch_array($result)){
        $bExists = TRUE;
        $cartID = $rs["cartID"];
    }
    mysql_free_result($result);
    if($bExists){ // We have the product. Check we have all the same options
        foreach(@$_POST as $objItem => $objValue){
            if(substr($objItem,0,4)=="optn"){
                if(@$_POST["v" . $objItem] != ""){
                    $sSQL="SELECT coID FROM cartoptions WHERE coCartID=" . $cartID . " AND coOptID=" . $objValue . " AND coCartOption='" . @$_POST["v" . $objItem] . "'";
                    $result = mysql_query($sSQL) or print(mysql_error());
                    if(mysql_num_rows($result)==0) $bExists=FALSE;
                    mysql_free_result($result);
                }else{
                    $sSQL="SELECT coID FROM cartoptions WHERE coCartID=" . $cartID . " AND coOptID=" . $objValue;
                    $result = mysql_query($sSQL) or print(mysql_error());
                    if(mysql_num_rows($result)==0) $bExists=FALSE;
                    mysql_free_result($result);
                }
            }
            if(! $bExists) break;
        }
    }

    $sSQL = "SELECT pName,pPrice,pInStock FROM products WHERE pID='" . $id . "'";
    $result = mysql_query($sSQL) or print(mysql_error());
    $rsStock = mysql_fetch_array($result);
    mysql_free_result($result);

    if($stockManage != 0){
        if($isInStock = (($rsStock["pInStock"]-$quantity) >= 0)){ // Check cart
            $totQuant = 0;
            $bestDate = time()+(60*60*24*62);
            $sSQL = "SELECT cartQuantity,cartDateAdded,cartOrderID FROM cart WHERE cartCompleted=0 AND cartProdID='$id'";
            $result = mysql_query($sSQL) or print(mysql_error());
            while($rs = mysql_fetch_array($result)){
                $totQuant += $rs["cartQuantity"];
                if((int)$rs["cartOrderID"]==0 && strtotime($rs["cartDateAdded"]) < $bestDate) $bestDate = strtotime($rs["cartDateAdded"]);
            }
            mysql_free_result($result);
            if(($rsStock["pInStock"]-($totQuant+$quantity)) < 0){
                $isInStock = FALSE;
                $tempOutOfStock = TRUE;
            }
        }
    }

    if($isInStock){
        if($bExists){
            $sSQL = "UPDATE cart SET cartQuantity=cartQuantity+" . $quantity . " WHERE cartID=" . $cartID;
            mysql_query($sSQL) or print(mysql_error());
        }else{
            $sSQL = "INSERT INTO cart (cartSessionID,cartProdID,cartQuantity,cartCompleted,cartProdName,cartProdPrice,cartOrderID,cartDateAdded) VALUES (";
            $sSQL .= "'" . session_id() . "',";
            $sSQL .= "'" . mysql_escape_string($id) . "',";
            $sSQL .= $quantity . ",";
            $sSQL .= "0,";
            $sSQL .= "'" . mysql_escape_string($rsStock["pName"]) . "',";
            $sSQL .= "'" . mysql_escape_string($rsStock["pPrice"]) . "',";
            $sSQL .= "0,";
            $sSQL .= "'" . date("Y-m-d H:i:s") . "')";
            mysql_query($sSQL) or print(mysql_error());
            $cartID = mysql_insert_id();
            $hasOptions=FALSE;
            $sProdOpts="";
            $addComma="";
            foreach(@$_POST as $objItem => $objValue){
                if(substr($objItem,0,4)=="optn"){
                    if(trim(@$_POST["v" . $objItem])==""){
                        $sProdOpts .= $addComma . $objValue;
                        $addComma = ",";
                        $hasOptions=TRUE;
                    }else{
                        $sSQL="SELECT optID,OptGrpName,optName,optPriceDiff FROM options LEFT JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optID=" . $objValue;
                        $result = mysql_query($sSQL) or print(mysql_error());
                        $rs = mysql_fetch_array($result);
                        $sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff) VALUES (" . $cartID . "," . $rs["optID"] . ",'" . mysql_escape_string($rs["OptGrpName"]) . "','" . mysql_escape_string(@$_POST["v" . $objItem]) . "',0)";
                        mysql_query($sSQL) or print(mysql_error());
                        mysql_free_result($result);
                    }
                }
            }
            if($hasOptions){
                $sSQL="SELECT optID,OptGrpName,optName,optPriceDiff FROM options LEFT JOIN optiongroup ON options.optGroup=optiongroup.optGrpID WHERE optID IN (" . $sProdOpts . ")";
                $result = mysql_query($sSQL) or print(mysql_error());
                while($rs = mysql_fetch_array($result)){
                    $sSQL = "INSERT INTO cartoptions (coCartID,coOptID,coOptGroup,coCartOption,coPriceDiff) VALUES (" . $cartID . "," . $rs["optID"] . ",'" . mysql_escape_string($rs["OptGrpName"]) . "','" . mysql_escape_string($rs["optName"]) . "'," . mysql_escape_string($rs["optPriceDiff"]) . ")";
                    mysql_query($sSQL) or print(mysql_error());
                }
            }
        }
        print "<meta http-equiv=\"Refresh\" content=\"3; URL=cart.php\">";
?>
      <table border="0" cellspacing="<?php print $maintablespacing?>" cellpadding="<?php print $maintablepadding?>" width="<?php print $maintablewidth?>" bgcolor="<?php print $maintablebg?>" align="center">
        <tr>
          <td width="100%" align="center">
            <table width="<?php print $innertablewidth?>" border="0" cellspacing="<?php print $innertablespacing?>" cellpadding="<?php print $innertablepadding?>" bgcolor="<?php print $innertablebg?>">
              <tr>
                <td align="center"><p>&nbsp;</p>
                <p><?php print $quantity . " <b>" . $rsStock["pName"] ?></b> <?php print $xxAddOrd?></p>
                <p><?php print $xxPlsWait?> <a href="cart.php"><b><?php print $xxClkHere?></b></a>.</p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
<?php
    }else{
?>
      <table border="0" cellspacing="<?php print $maintablespacing?>" cellpadding="<?php print $maintablepadding?>" width="<?php print $maintablewidth?>" bgcolor="<?php print $maintablebg?>" align="center">
        <tr>
          <td width="100%" align="center">
            <table width="<?php print $innertablewidth?>" border="0" cellspacing="<?php print $innertablespacing?>" cellpadding="<?php print $innertablepadding?>" bgcolor="<?php print $innertablebg?>">
              <tr>
                <td align="center"><p>&nbsp;</p>
                <?php print "<p>" . $xxSrryItm . " <b>" . $rsStock["pName"] . "</b> " . $xxIsCntly;
                if($tempOutOfStock) print $xxTemprly;
                print $xxOutStck . "</p>";
                if($tempOutOfStock){
                    print "<p>" . $xxNotChOu;
                    $bestDate += $stockManage*(60*60);
                    $totMins = (int)($bestDate - time());
                    $totMins = (int)($totMins / 60);
                    if($totMins > 300)
                        print "a short while";
                    else{
                        if($totMins >= 60) print (int)($totMins / 60) . " hour";
                        if($totMins >= 120) print "s";
                        $totMins -= ((int)($totMins / 60) * 60);
                        if($totMins > 0) print " " . $totMins . " minute";
                        if($totMins > 1) print "s";
                    }
                    print $xxChkBack . "</p>";
                } ?>
                <p><?php print $xxPlease?> <a href="java script:history.go(-1)"><b><?php print $xxClkHere?></b></a> <?php print $xxToRetrn?></p>
                <p>&nbsp;</p>
                <p>&nbsp;</p>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
<?php
    }
}elseif(@$_POST["mode"]=="checkout"){
    $remember=FALSE;
    if(@$_COOKIE["id1"] != "" && @$_COOKIE["id2"] != ""){
        $sSQL = "SELECT ordName,ordAddress,ordCity,ordState,ordZip,ordCountry,ordEmail,ordPhone,ordShipName,ordShipAddress,ordShipCity,ordShipState,ordShipZip,ordShipCountry,ordAddInfo FROM orders WHERE ordID=" . $_COOKIE["id1"] . " AND ordSessionID='" . $_COOKIE["id2"] . "'";
        $result = mysql_query($sSQL) or print(mysql_error());
        if($rs = mysql_fetch_array($result)){
            $ordName = $rs["ordName"];
            $ordAddress = $rs["ordAddress"];
            $ordCity = $rs["ordCity"];
            $ordState = $rs["ordState"];
            $ordZip = $rs["ordZip"];
            $ordCountry = $rs["ordCountry"];
            $ordEmail = $rs["ordEmail"];
            $ordPhone = $rs["ordPhone"];
            $ordShipName = $rs["ordShipName"];
            $ordShipAddress = $rs["ordShipAddress"];
            $ordShipCity = $rs["ordShipCity"];
            $ordShipState = $rs["ordShipState"];
            $ordShipZip = $rs["ordShipZip"];
            $ordShipCountry = $rs["ordShipCountry"];
            $ordAddInfo = $rs["ordAddInfo"];
            $remember=TRUE;
        }
        mysql_free_result($result);
    }
    $usatext="xoxoxoxoxo";
    $sSQL = "SELECT countryName FROM countries WHERE countryID=1";
    $result = mysql_query($sSQL) or print(mysql_error());
    if($rs = mysql_fetch_array($result)) $usatext=$rs["countryName"];
    mysql_free_result($result);
?>
<script Language="JavaScript">
<!--
function checkform(frm)
{
if(frm.name.value=="")
{
    alert("<?php print $xxPlsEntr?> \"<?php print $xxName?>\".");
    frm.name.focus();
    return (false);
}
if(frm.email.value=="")
{
    alert("<?php print $xxPlsEntr?> \"<?php print $xxEmail?>\".");
    frm.email.focus();
    return (false);
}
if(frm.address.value=="")
{
    alert("<?php print $xxPlsEntr?> \"<?php print $xxAddress?>\".");
    frm.address.focus();
    return (false);
}
if(frm.city.value=="")
{
    alert("<?php print $xxPlsEntr?> \"<?php print $xxCity?>\".");
    frm.city.focus();
    return (false);
}
if(frm.country.options[frm.country.selectedIndex].value=='<?php print str_replace("'","\\'",$xxCntryTxt)?>'){
    if(frm.state.selectedIndex==0)
    {
        alert("<?php print $xxPlsSlct . " " . $xxState?>");
        frm.state.focus();
        return (false);
    }
}
else{
    if(frm.state2.value=="")
    {
        alert("<?php print $xxPlsEntr?> \"\".");
        frm.state2.focus();
        return (false);
    }
}
if(frm.zip.value=="")
{
    alert("<?php print $xxPlsEntr?> \"<?php print $xxZip?>\".");
    frm.zip.focus();
    return (false);
}
if(frm.phone.value=="")
{
    alert("<?php print $xxPlsEntr?> \"<?php print $xxPhone?>\".");
    frm.phone.focus();
    return (false);
}
if(frm.saddress.value!=""){
    if(frm.scity.value=="")
    {
        alert("<?php print $xxShpDtls?>\n\n<?php print $xxPlsEntr?> \"<?php print $xxCity?>\".");
        frm.scity.focus();
        return (false);
    }
    if(frm.scountry.options[frm.scountry.selectedIndex].value=='<?php print str_replace("'","\\'",$usatext)?>'){
        if(frm.sstate.selectedIndex==0)
        {
            alert("<?php print $xxShpDtls?>\n\n<?php print $xxPlsSlct . " " . $xxState?>.");
            frm.sstate.focus();
            return (false);
        }
    }
    else{
        if(frm.sstate2.value=="")
        {
            alert("<?php print $xxShpDtls?>\n\n<?php print $xxPlsEntr?> \"\".");
            frm.sstate2.focus();
            return (false);
        }
    }
    if(frm.szip.value=="")
    {
        alert("<?php print $xxShpDtls?>\n\n<?php print $xxPlsEntr?> \"<?php print $xxZip?>\".");
        frm.szip.focus();
        return (false);
    }
}
if(frm.remember.checked==false)
{
    if(confirm("<?php print $xxWntRem?>")){
        frm.remember.checked=true
    }
}
return (true);
}
//-->
</script>
      <table border="0" cellspacing="<?php print $maintablespacing?>" cellpadding="<?php print $maintablepadding?>" width="<?php print $maintablewidth?>" bgcolor="<?php print $maintablebg?>" align="center">
        <tr>
          <td width="100%">
            <form method="POST" action="cart.php" onSubmit="return checkform(this)">
              <input type="hidden" name="mode" value="go">
              <input type="hidden" name="sessionid" value="<?php print @$_POST["sessionid"]?>">
              <table width="<?php print $innertablewidth?>" border="0" cellspacing="<?php print $innertablespacing?>" cellpadding="<?php print $innertablepadding?>" bgcolor="<?php print $innertablebg?>">
                <tr>
                  <td width="100%" align="center" colspan="4"><b><?php print $xxCstDtl?></b></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><font color='#FF0000'>*</font><?php print $xxName?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="name" size="<?php print atb(20)?>" value="<?php print @$ordName?>"></td>
                  <td width="25%" align="right"><b><font color='#FF0000'>*</font><?php print $xxEmail?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="email" size="<?php print atb(20)?>" value="<?php print @$ordEmail?>"></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><font color='#FF0000'>*</font><?php print $xxAddress?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="address" size="<?php print atb(20)?>" value="<?php print @$ordAddress?>"></td>
                  <td width="25%" align="right"><b><font color='#FF0000'>*</font><?php print $xxCity?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="city" size="<?php print atb(20)?>" value="<?php print @$ordCity?>"></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><font color='#FF0000'>*</font><?php print $xxZip?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="zip" size="<?php print atb(10)?>" value="<?php print @$ordZip?>"></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><font color='#FF0000'>*</font><?php print $xxCountry?>:</b></td>
                  <td width="25%" align="left"><select name="country" size="1">
<?php
function show_countries($tcountry){
    $sSQL = "SELECT countryName FROM countries WHERE countryEnabled=1 ORDER BY countryOrder DESC, countryName";
    $result = mysql_query($sSQL) or print(mysql_error());
    while($rs = mysql_fetch_array($result)){
        print "<option value='" . $rs["countryName"] . "'";
        if($tcountry==$rs["countryName"])
            print " selected";
        print ">" . $rs["countryName"] . "</option>\n";
    }
}
show_countries(@$ordCountry)
?>
                    </select>
                  </td>
                  <td width="25%" align="right"><b><font color='#FF0000'>*</font><?php print $xxPhone?>:</b></td>
                  <td width="25%" align="left" colspan="3"><input type="text" name="phone" size="<?php print atb(20)?>" value="<?php print @$ordPhone?>"></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><?php print $xxState?>:</b></td>
                  <td width="25%" align="left"><select name="sstate" size="1">
                  <?php
function show_states($tstate){
    $sSQL = "SELECT stateName FROM states WHERE stateEnabled=1 ORDER BY stateName";
    $result = mysql_query($sSQL) or print(mysql_error());
    while($rs = mysql_fetch_array($result)){
        print "<option value='" . $rs["stateName"] . "'";
        if($tstate==$rs["stateName"])
            print " selected";
        print ">" . $rs["stateName"] . "</option>\n";
    }
}
show_states(@$ordState)
?>
                 
                    </select>
                </tr>
                <tr>
                  <td width="100%" align="center" colspan="4"><?php print $xxShpDiff?></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><?php print $xxName?>:</b></td>
                  <td width="25%" align="left" colspan="3"><input type="text" name="sname" size="<?php print atb(20)?>" value="<?php print @$ordShipName?>"></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><?php print $xxAddress?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="saddress" size="<?php print atb(20)?>" value="<?php print trim(@$ordShipAddress)?>"></td>
                  <td width="25%" align="right"><b><?php print $xxCity?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="scity" size="<?php print atb(20)?>" value="<?php print @$ordShipCity?>"></td>
                </tr>
                <tr>
                  <td width="25%" align="right"><b><?php print $xxCountry?>:</b></td>
                  <td width="25%" align="left"><select name="scountry" size="1">
<?php
show_countries(@$ordShipCountry);
?>
                    </select>
                  </td>
                  <td width="25%" align="right"><b><?php print $xxZip?>:</b></td>
                  <td width="25%" align="left"><input type="text" name="szip" size="<?php print atb(10)?>" value="<?php print @$ordShipZip?>"></td>
                </tr>
                <tr>
                  <td width="100%" align="center" colspan="4">
                    <b><?php print $xxAddInf?>.</b><br>
                    <textarea name="ordAddInfo" rows="3" wrap=virtual cols="<?php print atb(44)?>"><?php print @$ordAddInfo?></textarea>
                  </td>
                </tr>
                <tr>
                  <td width="100%" align="center" colspan="4"><input type="checkbox" name="remember" value="1" <?php if($remember) print "checked"?>>
                    <b><?php print $xxRemMe?></b><br>
                    <font size="1" face="Verdana, Arial, Helvetica, sans-serif"><?php print $xxOpCook?></font>
                    <p><?php print $xxBeting
?></p><br>
                  </td>
                </tr>
<?php
                    $sSQL = "SELECT payProvID,PayProvShow FROM payprovider WHERE payProvEnabled=1";
                    $result = mysql_query($sSQL) or print(mysql_error());
                    if(mysql_num_rows($result)==0){
?>
                <tr>
                  <td colspan="4" align="center"><b><?php print $xxNoPay?></b></td>
                </tr>
<?php
                    }elseif(mysql_num_rows($result)==1){
                        $rs = mysql_fetch_array($result);
?>
                <tr>
                  <td colspan="4" align="center"><input type="hidden" name="payprovider" value="<?php print $rs["payProvID"]?>"><b>Klik "Til Kassen" knap for at godkende din bestilling.</b></td>
                </tr>
<?php
                    }else{
?>                <tr>
                  <td colspan="4" align="center"><p><b><?php print $xxPlsChz?></b></p>
                    <p><select name="payprovider" size="1">
<?php
                        while($rs = mysql_fetch_array($result)){
                            print "<option value='" . $rs["payProvID"] . "'>" . $rs["PayProvShow"] . "</option>\n";
                        }
?>
                    </select></p>
                  </td>
                </tr>
<?php
                    }
?>
                <tr>
                  <td width="50%" align="center" colspan="4"><input type="image" src="images/checkout.gif" border="0"></td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
<?php
}elseif(@$_POST["mode"]=="go"){
?>
<?php include "vsadmin/inc/uspsshipping.php" ?>
<?php
    // Dim intShipping(4,20)
    $success=TRUE;
    $checkIntOptions=FALSE;
    $alldata = "";
    $shipMethod = "";
    $shipping = 0;
    $shipping2 = 0;
    $iTotItems = 0;
    $countryTaxRate=0;
    $stateTaxRate=0;
    $countryTax=0;
    $stateTax=0;
    $international = "";
    $thePQuantity = 0;
    $thePWeight = 0;
    $iPounds = 0;
    $iOunces = 0;
    $taxfreegoods = 0;
    $totalgoods = 0;
    $somethingToShip = FALSE;
    if(trim(@$_POST["saddress"])<>""){
        $shipcountry = trim(@$_POST["scountry"]);
        $shipstate = trim(@$_POST["sstate"]);
        $destZip = trim(@$_POST["szip"]);
    }else{
        $shipcountry = trim(@$_POST["country"]);
        $shipstate = trim(@$_POST["state"]);
        $destZip = trim(@$_POST["zip"]);
    }
    $sSQL = "SELECT adminZipCode,adminPacking,adminShipping,adminUnits,adminUSPSUser,adminUSPSpw,countryName,countryCode FROM admin LEFT JOIN countries ON admin.adminCountry=countries.countryID";
    $result = mysql_query($sSQL) or print(mysql_error());
    $rs = mysql_fetch_array($result);
        $packtogether=FALSE;
        if((int)$rs["adminPacking"]==1) $packtogether=TRUE;
        $origZip = $rs["adminZipCode"];
        $shipType = (int)$rs["adminShipping"];
        $origCountry = $rs["countryName"];
        $origCountryCode = $rs["countryCode"];
        $uspsUser = $rs["adminUSPSUser"];
        $uspsPw = $rs["adminUSPSpw"];
        if((int)$rs["adminUnits"]==0)
            $adminUnits="KGS";
        else
            $adminUnits="LBS";
    mysql_free_result($result);
    $sSQL = "SELECT countryID,countryName,countryTax FROM countries WHERE countryName='" . trim(@$_POST["country"]) . "'";
    $result = mysql_query($sSQL) or print(mysql_error());
    $rs = mysql_fetch_array($result);
        $countryTaxRate = $rs["countryTax"];
        $countryID = $rs["countryID"];
    mysql_free_result($result);
    //if($countryID==1){
    if($xxCntryTxt==trim(@$_POST["country"])){
        $sSQL = "SELECT stateTax FROM states WHERE stateName='" . trim(@$_POST["state"]) . "'";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $stateTaxRate=$rs["stateTax"];
        mysql_free_result($result);
    }
    if($shipType==2){ // Weight based shipping
        $allzones="";
        $index=0;
        $numzones=0;
        $useUSState=FALSE;
        if($splitUSZones){
            //$sSQL = "SELECT countryID FROM countries WHERE countryName='" . $shipcountry . "'";
            //$result = mysql_query($sSQL) or print(mysql_error());
            //$rs = mysql_fetch_array($result);
            //if((int)$rs["countryID"]==1) $useUSState=TRUE;
            //mysql_free_result($result);
            if($shipcountry==trim($xxCntryTxt)) $useUSState=TRUE;
            if($useUSState){
                $sSQL = "SELECT stateZone,zcWeight,zcRate,zcRate2,pzMultiShipping FROM states LEFT JOIN zonecharges ON states.stateZone=zonecharges.zcZone LEFT JOIN postalzones ON zonecharges.zcZone=postalzones.pzID WHERE stateName='" . $shipstate . "' ORDER BY zcWeight";
                $result = mysql_query($sSQL) or print(mysql_error());
                while($rs = mysql_fetch_row($result))
                    $allzones[$index++] = $rs;
                mysql_free_result($result);
                $numzones=$index;
            }
        }
        if(! $useUSState){
            $sSQL = "SELECT countryZone,zcWeight,zcRate,zcRate2,pzMultiShipping FROM countries LEFT JOIN zonecharges ON countries.countryZone=zonecharges.zcZone LEFT JOIN postalzones ON zonecharges.zcZone=postalzones.pzID WHERE countryName='" . $shipcountry . "' ORDER BY zcWeight";
            $result = mysql_query($sSQL) or print(mysql_error());
            while($rs = mysql_fetch_row($result))
                $allzones[$index++] = $rs;
            mysql_free_result($result);
            $numzones=$index;
        }
    }elseif($shipType==4){ // UPS
        $sSQL = "SELECT countryCode FROM countries WHERE countryName='" . $shipcountry . "'";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $destCountryCode = $rs["countryCode"];
        mysql_free_result($result);
    }
    if($shipcountry != $origCountry) $international = "Intl";
    $sSQL = "SELECT cartID,cartProdID,pName,pPrice,cartQuantity,pWeight,pShipping,pShipping2,pExemptions FROM cart LEFT JOIN products ON cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID='" . @$_POST["sessionid"] . "'";
    $allcart = mysql_query($sSQL) or print(mysql_error());
    if(($itemsincart=mysql_num_rows($allcart))==0) $allcart = "";

    // Check if the affiliate plug-in is available. If so get affiliate details
    $hasaffilplugin=FALSE;
    $affilID = trim(@$_COOKIE["PARTNER"]);

    if($success && $allcart<>""){
        if($shipType==3)
            $sXML = "<" . $international . "RateRequest USERID=\"" . $uspsUser . "\" PASSWORD=\"" . $uspsPw . "\">";
        elseif($shipType==4){
            $sXML = "<?xml version=\"1.0\"?><AccessRequest xml:lang=\"en-US\"><AccessLicenseNumber>" . $XXLicenseNumber . "</AccessLicenseNumber><UserId>" . $uspsUser . "</UserId><Password>" . $uspsPw . "</Password></AccessRequest><?xml version=\"1.0\"?>";
            $sXML .= "<RatingServiceSelectionRequest xml:lang=\"en-US\"><Request><TransactionReference><CustomerContext>Rating and Service</CustomerContext><XpciVersion>1.0001</XpciVersion></TransactionReference>";
            $sXML .= "<RequestAction>Rate</RequestAction><RequestOption>shop</RequestOption></Request>";
            // VREID : Check pickup types
            //sXML .= "<PickupType><Code>01</Code></PickupType>";
            $sXML .= "<Shipment><Shipper><Address>";
            $sXML .= "<PostalCode>" . $origZip . "</PostalCode>";
            $sXML .= "<CountryCode>" . $origCountryCode . "</CountryCode>";
            $sXML .= "</Address></Shipper><ShipTo><Address>";
            $sXML .= "<PostalCode>" . $destZip . "</PostalCode>";
            $sXML .= "<CountryCode>" . $destCountryCode . "</CountryCode><ResidentialAddress/>";
            $sXML .= "</Address></ShipTo>";
            // VREID : Check service codes
            //sXML = "<Service><Code>11</Code></Service>";
        }
        $rowcounter = 0;
        $index=0;
        while($rsCart=mysql_fetch_array($allcart)){
            $optPriceDiff=0;
            $index++;
            $sSQL = "SELECT coPriceDiff FROM cartoptions WHERE coCartID=". $rsCart["cartID"];
            $result = mysql_query($sSQL) or print(mysql_error());
            while($rs = mysql_fetch_array($result)){
                $optPriceDiff += (double)$rs["coPriceDiff"];
            }
            mysql_free_result($result);
            $totalgoods += ($rsCart["pPrice"] + $optPriceDiff) * (int)($rsCart["cartQuantity"]);
            if($rsCart["pExemptions"]==1 || $rsCart["pExemptions"]==3)
                $taxfreegoods += (($rsCart["pPrice"] + $optPriceDiff)*(int)$rsCart["cartQuantity"]);
            $iTotItems += (int)$rsCart["cartQuantity"];
            if($rsCart["pExemptions"]==2 || $rsCart["pExemptions"]==3)
                ; // No Shipping on this product
            elseif($shipType==1) // Flat rate shipping
                $shipping += $rsCart["pShipping"] + $rsCart["pShipping2"] * ($rsCart["cartQuantity"]-1);
            elseif($shipType==2 && @$_POST["shipping"]==""){ // Weight based shipping
                $somethingToShip=TRUE;
                $havematch=FALSE;
                $dHighest=0;
                $dHighest2=0;
                if(is_array($allzones)){
                    if($packtogether){
                        $thePWeight += ((double)($rsCart["cartQuantity"])*(double)($rsCart["pWeight"]));
                        $thePQuantity = 1;
                    }else{
                        $thePWeight = (double)$rsCart["pWeight"];
                        $thePQuantity = (double)$rsCart["cartQuantity"];
                    }
                    if(! ($packtogether && $index != $itemsincart)){ // Only calculate pack together when we have the total
                        for($index2=0; $index2 < $numzones; $index2++){
                            if($allzones[$index2][1] >= $thePWeight){
                                $havematch=TRUE;
                                $shipping += ((double)$allzones[$index2][2] * $thePQuantity);
                                $shipping2 += ((double)$allzones[$index2][3] * $thePQuantity);
                                break;
                            }
                            $dHighWeight = $allzones[$index2][1];
                            $dHighest = $allzones[$index2][2];
                            $dHighest2 = $allzones[$index2][3];
                        }
                        if(! $havematch){
                            $shipping += $dHighest;
                            $shipping2 += $dHighest2;
                            if($allzones[0][1] < 0){
                                $dHighWeight = $thePWeight - $dHighWeight;
                                while($dHighWeight > 0){
                                    $shipping += ((double)$allzones[0][2] * $thePQuantity);
                                    $shipping2 += ((double)$allzones[0][3] * $thePQuantity);
                                    $dHighWeight += $allzones[0][1];
                                }
                            }
                        }
                    }
                }
            }elseif($shipType==3 && @$_POST["shipping"]==""){ // USPS Shipping
                $somethingToShip=TRUE;
                if($packtogether){
                    $iPounds += (floor($rsCart["pWeight"]) * (int)$rsCart["cartQuantity"]);
                    $iOunces += ((round(((double)$rsCart["pWeight"]-(double)((int)$rsCart["pWeight"]))*100)) * (int)$rsCart["cartQuantity"]);
                    if($index == $itemsincart){
                        $iPounds += floor((double)$iOunces/16.0);
                        $iOunces -= floor(floor((double)$iOunces/16.0)*16);
                        if($international != "")
                            $sXML .= addInternational($rowcounter,$iPounds,$iOunces,"Package",$shipcountry);
                        else
                            $sXML .= addDomestic($rowcounter,"Parcel",$origZip,$destZip,$iPounds,$iOunces,"None","REGULAR","False");
                        $rowcounter++;
                    }
                }else{
                    $iPounds=floor($rsCart["pWeight"]);
                    $iOunces=round(((double)$rsCart["pWeight"]-(double)$iPounds)*100);
                    for($index2=0;$index2 < (int)$rsCart["cartQuantity"]; $index2++){
                        if($international != "")
                            $sXML .= addInternational($rowcounter,$iPounds,$iOunces,"Package",$shipcountry);
                        else
                            $sXML .= addDomestic($rowcounter,"Parcel",$origZip,$destZip,$iPounds,$iOunces,"None","REGULAR","False");
                        $rowcounter++;
                    }
                }
            // cartID,cartProdID,pName,pPrice,cartQuantity,pWeight,pShipping,pShipping2,pExemptions
            }elseif($shipType==4 && @$_POST["shipping"]==""){ // UPS Shipping
                //saveLCID = Session.LCID
                //Session.LCID = 1033
                $somethingToShip=TRUE;
                if($packtogether){
                    $iWeight += ((double)$rsCart["pWeight"] * (int)$rsCart["cartQuantity"]);
                    if($index == $itemsincart)
                        $sXML .= addUPSInternational($iWeight,$adminUnits,"00",$destCountryCode);
                }else{
                    $iWeight=$rsCart["pWeight"];
                    for($index2=0;$index2 < (int)$rsCart["cartQuantity"]; $index2++)
                        $sXML .= addUPSInternational($iWeight,$adminUnits,"00",$destCountryCode);
                }
                //Session.LCID = saveLCID
            }
        }
        if($shipType==2 && $somethingToShip){
            $checkIntOptions = (@$_POST["shipping"]=="");
            if(is_array($allzones)){
                if($allzones[0][4] == 0) $checkIntOptions = FALSE;
            }else
                $checkIntOptions = FALSE;
        }elseif($shipType==3 && $somethingToShip){
            $checkIntOptions = ($international != "" && @$_POST["shipping"]=="");
            if(@$_POST["shipping"]==""){
                $sXML .= "</" . $international . "RateRequest>";
                $success = USPSCalculate($sXML,$international,$shipping, $errormsg, $intShipping);
                if($success && $checkIntOptions){ // Look for a single valid shipping option
                    $totShipOptions = 0;
                    foreach($intShipping as $shipRow){
                        if(strstr($shipRow[0],"Parcel Post") && $iTotItems==$shipRow[3]){
                            $totShipOptions++;
                            $shipping = $shipRow[2];
                            $shipMethod = $shipRow[1];
                        }
                    }
                    if($totShipOptions==1)
                        $checkIntOptions=FALSE;
                    elseif($totShipOptions==0){
                        $checkIntOptions=FALSE;
                        $success=FALSE;
                        $errormsg=$xxNoMeth;
                    }
                }
            }
        }elseif($shipType==4 && $somethingToShip){
            $checkIntOptions = (@$_POST["shipping"]=="");
            if(@$_POST["shipping"]==""){
                $sXML .= "<ShipmentServiceOptions/></Shipment></RatingServiceSelectionRequest>";
                // print Replace(Replace(sXML,"</","&lt;/"),"<","<br>&lt;")."<BR><hr>"
                $success = UPSCalculate($sXML,$international,$shipping, $errormsg, $intShipping);
                if($success){
                    $totShipOptions = 0;
                    foreach($intShipping as $shipRow){
                        if($shipRow[3]==TRUE){
                            $totShipOptions++;
                            $shipping = $shipRow[2];
                            $shipMethod = $shipRow[1];
                        }
                    }
                    if($totShipOptions==1)
                        $checkIntOptions=FALSE;
                    elseif($totShipOptions == 0){
                        $checkIntOptions = FALSE;
                        $success=FALSE;
                        $errormsg=$xxNoMeth;
                    }else{
                        for($index2=0; $index2 < $totShipOptions; $index2++){
                            $intShipping[$index2][2] = (double)$intShipping[$index2][2];
                            for($index=1; $index < $totShipOptions; $index++){
                                if((double)$intShipping[$index][2] < (double)$intShipping[$index-1][2]){
                                    $tt0 = $intShipping[$index][0];
                                    $tt1 = $intShipping[$index][1];
                                    $tt2 = $intShipping[$index][2];
                                    $intShipping[$index][0] = $intShipping[$index-1][0];
                                    $intShipping[$index][1] = $intShipping[$index-1][1];
                                    $intShipping[$index][2] = $intShipping[$index-1][2];
                                    $intShipping[$index-1][0] = $tt0;
                                    $intShipping[$index-1][1] = $tt1;
                                    $intShipping[$index-1][2] = $tt2;
                                }
                            }
                        }
                    }
                }
            }
        }elseif(@$_POST["shipping"] != ""){
            $shipArr = split('\|',$_POST["shipping"],2);
            $shipping = (double)$shipArr[0];
            $shipMethod = $shipArr[1];
        }
        $stateTax = (((double)$totalgoods-(double)$taxfreegoods)*(double)$stateTaxRate)/100.0;
        $countryTax = (((double)$totalgoods-(double)$taxfreegoods)*(double)$countryTaxRate)/100.0;
        if($taxShipping==1){
            $stateshippingtax = ((double)$shipping*(double)$stateTaxRate)/100.0;
            $shipping += ((double)$shipping*(double)$countryTaxRate)/100.0;
            $shipping += $stateshippingtax;
        }
        $grandtotal = $totalgoods + $shipping + $stateTax + $countryTax;

        if(! $checkIntOptions){
            $sSQL = "SELECT ordID FROM orders WHERE ordSessionID='" . trim(@$_POST["sessionid"]) . "' AND ordAuthNumber=''";
            $result = mysql_query($sSQL) or print(mysql_error());
            if($rs = mysql_fetch_array($result))
                $orderid=$rs["ordID"];
            else
                $orderid="";
            mysql_free_result($result);
            if($orderid==""){
                $sSQL = "INSERT INTO orders (ordSessionID,ordName,ordAddress,ordCity,ordState,ordZip,ordCountry,ordEmail,ordPhone,ordShipName,ordShipAddress,ordShipCity,ordShipState,ordShipZip,ordShipCountry,ordPayProvider,ordAuthNumber,ordShipping,ordStateTax,ordCountryTax,ordShipType,ordTotal,ordDate,ordDemoMode,ordAffiliate,ordAddInfo) VALUES (";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["sessionid"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["name"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["address"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["city"])) . "',";
                if(trim(@$_POST["state"]) != "")
                    $sSQL .= "'" . mysql_escape_string(trim(@$_POST["state"])) . "',";
                else
                    $sSQL .= "'" . mysql_escape_string(trim(@$_POST["state2"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["zip"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["country"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["email"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["phone"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["sname"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["saddress"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["scity"])) . "',";
                if(trim(@$_POST["sstate"]) != "")
                    $sSQL .= "'" . mysql_escape_string(trim(@$_POST["sstate"])) . "',";
                else
                    $sSQL .= "'" . mysql_escape_string(trim(@$_POST["sstate2"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["szip"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["scountry"])) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["payprovider"])) . "',";
                $sSQL .= "'',";
                $sSQL .= "'" . mysql_escape_string($shipping) . "',";
                $sSQL .= "'" . mysql_escape_string($stateTax) . "',";
                $sSQL .= "'" . mysql_escape_string($countryTax) . "',";
                $sSQL .= "'" . mysql_escape_string($shipMethod) . "',";
                $sSQL .= "'" . mysql_escape_string($totalgoods) . "',";
                $sSQL .= "'" . date("Y-m-d H:i:s") . "',";
                if(trim(@$_POST["demo"])=="Y")
                    $sSQL .= "'1',";
                else
                    $sSQL .= "'0',";
                $sSQL .= "'" . mysql_escape_string($affilID) . "',";
                $sSQL .= "'" . mysql_escape_string(trim(@$_POST["ordAddInfo"])) . "')";
                mysql_query($sSQL) or print(mysql_error());
                $orderid = mysql_insert_id();
            }else{
                $sSQL = "UPDATE orders SET ";
                $sSQL .= "ordSessionID='" . mysql_escape_string(trim(@$_POST["sessionid"])) . "',";
                $sSQL .= "ordName='" . mysql_escape_string(trim(@$_POST["name"])) . "',";
                $sSQL .= "ordAddress='" . mysql_escape_string(trim(@$_POST["address"])) . "',";
                $sSQL .= "ordCity='" . mysql_escape_string(trim(@$_POST["city"])) . "',";
                if(trim(@$_POST["state"]) != "")
                    $sSQL .= "ordState='" . mysql_escape_string(trim(@$_POST["state"])) . "',";
                else
                    $sSQL .= "ordState='" . mysql_escape_string(trim(@$_POST["state2"])) . "',";
                $sSQL .= "ordZip='" . mysql_escape_string(trim(@$_POST["zip"])) . "',";
                $sSQL .= "ordCountry='" . mysql_escape_string(trim(@$_POST["country"])) . "',";
                $sSQL .= "ordEmail='" . mysql_escape_string(trim(@$_POST["email"])) . "',";
                $sSQL .= "ordPhone='" . mysql_escape_string(trim(@$_POST["phone"])) . "',";
                $sSQL .= "ordShipName='" . mysql_escape_string(trim(@$_POST["sname"])) . "',";
                $sSQL .= "ordShipAddress='" . mysql_escape_string(trim(@$_POST["saddress"])) . "',";
                $sSQL .= "ordShipCity='" . mysql_escape_string(trim(@$_POST["scity"])) . "',";
                if(trim(@$_POST["sstate"]) != "")
                    $sSQL .= "ordShipState='" . mysql_escape_string(trim(@$_POST["sstate"])) . "',";
                else
                    $sSQL .= "ordShipState='" . mysql_escape_string(trim(@$_POST["sstate2"])) . "',";
                $sSQL .= "ordShipZip='" . mysql_escape_string(trim(@$_POST["szip"])) . "',";
                $sSQL .= "ordShipCountry='" . mysql_escape_string(trim(@$_POST["scountry"])) . "',";
                $sSQL .= "ordPayProvider='" . mysql_escape_string(trim(@$_POST["payprovider"])) . "',";
                $sSQL .= "ordAuthNumber='',"; // Not yet authorized
                $sSQL .= "ordShipping='" . $shipping . "',";
                $sSQL .= "ordStateTax='" . $stateTax . "',";
                $sSQL .= "ordCountryTax='" . $countryTax . "',";
                $sSQL .= "ordShipType='" . $shipMethod . "',";
                $sSQL .= "ordTotal='" . $totalgoods . "',";
                $sSQL .= "ordDate='" . date("Y-m-d H:i:s") . "',";
                $sSQL .= "ordIP='" . @$_SERVER["REMOTE_ADDR"] . "',";
                if(trim(@$_POST["demo"])=="Y")
                    $sSQL .= "ordDemoMode=1,";
                else
                    $sSQL .= "ordDemoMode=0,";
                $sSQL .= "ordAffiliate='" . $affilID . "',";
                $sSQL .= "ordAddInfo='" . mysql_escape_string(trim(@$_POST["ordAddInfo"])) . "'";
                $sSQL .= " WHERE ordID='" . $orderid . "'";
                mysql_query($sSQL) or print(mysql_error());
            }
            $sSQL="UPDATE cart SET cartOrderID=". $orderid . " WHERE cartCompleted=0 AND cartSessionID='" . mysql_escape_string(trim(@$_POST["sessionid"])) . "'";
            mysql_query($sSQL) or print(mysql_error());
            $descstr="";
            $addComma = "";
            $sSQL="SELECT cartQuantity,cartProdName FROM cart WHERE cartOrderID=" . $orderid . " AND cartCompleted=0";
            $result = mysql_query($sSQL) or print(mysql_error());
            while($rs=mysql_fetch_assoc($result)){
                $descstr .= $addComma . $rs["cartQuantity"] . " " . $rs["cartProdName"];
                $addComma = ", ";
            }
            mysql_free_result($result);
            $descstr = str_replace('"','',$descstr);
            if(@$_POST["remember"]=="1")
                print "<script src='vsadmin/savecookie.php?id1=" . $orderid . "&id2=" . trim(@$_POST["sessionid"]) . "'></script>";
        }
    }else{
        $success=FALSE;
    }
    if($checkIntOptions && $success){
        $success = FALSE; // So not to print the order totals.
?>
    <br>
    <form method="post" action="cart.php">
      <?php
        foreach(@$_POST as $objItem => $objValue)
            print "<input type='hidden' name='" . $objItem . "' value='" . $objValue . "'>\n";
      ?>
      <table border="0" cellspacing="0" cellpadding="0" width="<?php print $maintablewidth?>" bgcolor="#B1B1B1" align="center">
        <tr>
          <td width="100%">
            <table width="100%" border="0" bordercolor="#B1B1B1" cellspacing="1" cellpadding="3" bgcolor="#B1B1B1">
              <tr>
                <td height="34" align="center" bgcolor="#EBEBEB"><b><?php print $xxShpOpt?></b></td>
              </tr>
              <tr>
                <td height="34" align="center" bgcolor="#FFFFFF">
                  <table width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF">
                    <tr>
                      <td height="34" align="right" width="50%" bgcolor="#FFFFFF"><?php if($shipType==4) print "<img src='images/LOGO_S.gif'> "; else print "&nbsp;"; ?></td>
                      <td height="34" align="center" bgcolor="#FFFFFF"><?php
                        print "<select name='shipping' size='1'>";
                        if($shipType==2){
                            if(@$standardship=="") $standardship="Standard Shipping";
                            if(@$expressship=="") $expressship="Express Shipping";
                            print "<option value='" . $shipping . "|" . $standardship . "'>";
                            print $standardship . " " . FormatEuroCurrency($shipping) . "</option>";
                            print "<option value='" . $shipping2 . "|" . $expressship . "'>";
                            print $expressship . " " . FormatEuroCurrency($shipping2) . "</option>";
                        }else{
                            foreach($intShipping as $shipRow){
                                if($shipType==3){
                                    if(strstr($shipRow[0],"Parcel Post") && $iTotItems==$shipRow[3]){
                                        print "<option value='" . $shipRow[2] . "|" . $shipRow[0] . "'>";
                                        print $shipRow[0] . " (" . $shipRow[1] . ") ";
                                        print FormatEuroCurrency($shipRow[2]);
                                        print "</option>";
                                    }
                                }elseif($shipType==4){
                                    if($shipRow[3]){
                                        print "<option value='" . $shipRow[2] . "|" . $shipRow[0] . "'>" . $shipRow[0] . " ";
                                        if(trim($shipRow[1]) != "") print "(Guaranteed " . $shipRow[1] . ") ";
                                        print FormatEuroCurrency($shipRow[2]);
                                        print "</option>";
                                    }
                                }
                            }
                        }
                        print "</select>";
                    ?></td>
                      <td height="34" align="left" width="50%" bgcolor="#FFFFFF"><?php if($shipType==4) print "<img src='images/LOGO_S.gif'> "; else print "&nbsp;"; ?></td>
                    </tr>
                  </table>
                </td>
              </tr>
              <tr>
                <td height="34" align="center" bgcolor="#FFFFFF"><table width="100%" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                      <td bgcolor="#FFFFFF" width="16" height="26" align="right" valign="bottom">&nbsp;</td>
                      <td bgcolor="#FFFFFF" width="100%" align="center"><input type="image" value="Checkout" border="0" src="images/checkout.gif"></td>
                      <td bgcolor="#FFFFFF" width="16" height="26" align="right" valign="bottom"><img src="images/tablebr.gif"></td>
                    </tr>
                  </table>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </form>
<?php
    }elseif(! $success){
?>
      <table border="0" cellspacing="<?php print $maintablespacing?>" cellpadding="<?php print $maintablepadding?>" width="<?php print $maintablewidth?>" bgcolor="<?php print $maintablebg?>" align="center">
        <tr>
          <td width="100%">
            <table width="<?php print $innertablewidth?>" border="0" cellspacing="<?php print $innertablespacing?>" cellpadding="<?php print $innertablepadding?>" bgcolor="<?php print $innertablebg?>">
              <tr>
                <td align="center"><p>&nbsp;</p><p><b><?php print $xxSryErr?></b></p><p><b><?php print "<BR>" . $errormsg ?></b></p><p>&nbsp;</p></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
<?php
    }elseif(@$_POST["payprovider"]=="1"){ // PayPal
        $sSQL = "SELECT payProvDemo,payProvData1 FROM payprovider WHERE payProvID=1";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $demomode = ((int)$rs["payProvDemo"]==1);
        $data1 = $rs["payProvData1"];
        mysql_free_result($result);
?>
    <form method="post" action="https://www.paypal.com/cgi-bin/webscr">
      <INPUT TYPE="hidden" NAME="cmd" VALUE="_xclick">
      <INPUT TYPE="hidden" NAME="business" VALUE="<?php print $data1?>">
      <INPUT TYPE="hidden" NAME="return" VALUE="<?php print $storeurl?>thanks.php">
      <INPUT TYPE="hidden" NAME="item_name" VALUE="<?php print substr($descstr,0,127)?>">
      <INPUT TYPE="hidden" NAME="custom" VALUE="<?php print $orderid?>">
      <INPUT TYPE="hidden" NAME="amount" VALUE="<?php print number_format($grandtotal,2,'.','')?>">
      <INPUT TYPE="hidden" name="currency_code" value="<?php print $countryCurrency?>">
      <input type="hidden" name="bn" value="ecommercetemplates.php.ecommplus">
      <?php
      //<INPUT TYPE="hidden" NAME="no_shipping" VALUE="1">
      ?>
      <INPUT TYPE="hidden" NAME="cancel_return" VALUE="<?php print $storeurl?>sorry.php">
<?php
    }elseif(@$_POST["payprovider"]=="2"){ // 2Checkout
        $sSQL = "SELECT payProvDemo,payProvData1 FROM payprovider WHERE payProvID=2";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $demomode = ((int)$rs["payProvDemo"]==1);
        $data1 = $rs["payProvData1"];
        mysql_free_result($result);
?>
    <form method="POST" action="https://www.2checkout.com/cgi-bin/sbuyers/cartpurchase.2c">
      <input type="hidden" name="cart_order_id" value="<?php print $orderid?>">
      <input type="hidden" name="sid" value="<?php print $data1?>">
      <input type="hidden" name="total" value="<?php print $grandtotal?>">
      <input type="hidden" name="card_holder_name" value="<?php print @$_POST["name"]?>">
      <input type="hidden" name="street_address" value="<?php print @$_POST["address"]?>">
      <input type="hidden" name="city" value="<?php print @$_POST["city"]?>">
      <input type="hidden" name="state" value="<?php print @$_POST["state"]?>">
      <input type="hidden" name="zip" value="<?php print @$_POST["zip"]?>">
      <input type="hidden" name="country" value="<?php print @$_POST["country"]?>">
      <input type="hidden" name="email" value="<?php print @$_POST["email"]?>">
      <input type="hidden" name="phone" value="<?php print @$_POST["phone"]?>">
      <input type="hidden" name="ship_name" value="<?php print @$_POST["sname"]?>">
      <input type="hidden" name="ship_street_address" value="<?php print @$_POST["saddress"]?>">
      <input type="hidden" name="ship_city" value="<?php print @$_POST["scity"]?>">
      <input type="hidden" name="ship_state" value="<?php print @$_POST["sstate"]?>">
      <input type="hidden" name="ship_zip" value="<?php print @$_POST["szip"]?>">
      <input type="hidden" name="ship_country" value="<?php print @$_POST["scountry"]?>">
<?php
      if($demomode)
        print "<input type=\"hidden\" name=\"demo\" value=\"Y\">";
    }elseif(@$_POST["payprovider"]=="3"){ // Authorize.net
        $sSQL = "SELECT payProvDemo,payProvData1,payProvData2 FROM payprovider WHERE payProvID=3";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $demomode = ((int)$rs["payProvDemo"]==1);
        $data1 = $rs["payProvData1"];
        $data2 = $rs["payProvData2"];
        mysql_free_result($result);
?>
    <FORM METHOD=POST ACTION="https://secure.authorize.net/gateway/transact.dll">
      <input type="hidden" name="x_Version" VALUE="3.0">
      <input type="hidden" name="x_Login" VALUE="<?php print $data1?>">
      <input type="hidden" name="x_Show_Form" VALUE="PAYMENT_FORM">
<?php
        function vrhmac($key, $text){
            $idatastr = "                                                                ";
            $odatastr = "                                                                ";
            $hkey = (string)$key;
            $idatastr .= $text;
            for($i=0; $i<64; $i++){
                $idata[$i] = $ipad[$i] = 0x36;
                $odata[$i] = $opad[$i] = 0x5C;
            }
            for($i=0; $i< strlen($hkey); $i++){
                $ipad[$i] ^= ord($hkey{$i});
                $opad[$i] ^= ord($hkey{$i});
                $idata[$i] = ($ipad[$i] & 0xFF);
                $odata[$i] = ($opad[$i] & 0xFF);
            }
            for($i=0; $i< strlen($text); $i++){
                $idata[64+$i] = ord($text{$i}) & 0xFF;
            }
            for($i=0; $i< strlen($idatastr); $i++){
                $idatastr{$i} = chr($idata[$i] & 0xFF);
            }
            for($i=0; $i< strlen($odatastr); $i++){
                $odatastr{$i} = chr($odata[$i] & 0xFF);
            }
            $innerhashout = md5($idatastr);
            for($i=0; $i<16; $i++)
                $odatastr .= chr(hexdec(substr($innerhashout,$i*2,2)));
            return md5($odatastr);
        }
        $thename = trim(@$_POST["name"]);
        if($thename != ""){
            if(strstr($thename," ")){
                $namearr = split(" ",$thename,2);
                print "<INPUT TYPE=\"HIDDEN\" NAME=\"x_First_Name\" value=\"" . $namearr[0] . "\">\n";
                print "<INPUT TYPE=\"HIDDEN\" NAME=\"x_Last_Name\" value=\"" . $namearr[1] . "\">\n";
            }else
                print "<INPUT TYPE=\"HIDDEN\" NAME=\"x_Last_Name\" value=\"" . $thename . "\">\n";
        }
        $sequence = $orderid;
        $tstamp = time();
        $fingerprint = vrhmac($data2, $data1 . "^" . $sequence . "^" . $tstamp . "^" . number_format($grandtotal,2,'.','') . "^");
?>
      <input type="hidden" name="x_fp_sequence" value="<?php print $sequence?>">
      <input type="hidden" name="x_fp_timestamp" value="<?php print $tstamp?>">
      <input type="hidden" name="x_fp_hash" value="<?php print $fingerprint?>">
      <input type="hidden" name="x_address" VALUE="<?php print @$_POST["address"]?>">
      <input type="hidden" name="x_city" value="<?php print @$_POST["city"]?>">
      <input type="hidden" name="x_country" value="<?php print @$_POST["country"]?>">
      <input type="hidden" name="x_phone" value="<?php print @$_POST["phone"]?>">
      <input type="hidden" name="x_state" value="<?php print @$_POST["state"]?>">
      <input type="hidden" name="x_zip" value="<?php print @$_POST["zip"]?>">
      <input type="hidden" name="x_cust_id" value="<?php print $orderid?>">
      <input type="hidden" name="x_Invoice_Num" value="<?php print $orderid?>">
      <input type="hidden" name="x_Description" value="<?php print substr($descstr,0,255)?>">
      <input type="hidden" name="x_email" value="<?php print @$_POST["email"]?>">
      <input type="hidden" name="x_ship_to_address" value="<?php print @$_POST["saddress"]?>">
      <input type="hidden" name="x_ship_to_city" value="<?php print @$_POST["scity"]?>">
      <input type="hidden" name="x_ship_to_country" value="<?php print @$_POST["scountry"]?>">
      <input type="hidden" name="x_ship_to_state" value="<?php print @$_POST["sstate"]?>">
      <input type="hidden" name="x_ship_to_zip" value="<?php print @$_POST["szip"]?>">
      <input type="hidden" name="x_Amount" VALUE="<?php print number_format($grandtotal,2,'.','')?>">
      <input type="hidden" name="x_Relay_Response" VALUE="True">
      <input type="hidden" name="x_Relay_URL" VALUE="<?php print $storeurl?>vsadmin/wpconfirm.php">
<?php
        if($demomode){ ?>
      <input type="hidden" name="x_Test_Request" VALUE="TRUE">
<?php    }
    }elseif(@$_POST["payprovider"]=="4"){ // Email
?>
    <form method="POST" action="thanks.php">
      <input type="hidden" name="emailorder" value="<?php print $orderid?>">
<?php
    }elseif(@$_POST["payprovider"]=="5"){ // WorldPay
        $sSQL = "SELECT payProvDemo,payProvData1 FROM payprovider WHERE payProvID=5";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $demomode = ((int)$rs["payProvDemo"]==1);
        $data1 = $rs["payProvData1"];
        mysql_free_result($result);
?>
    <form method="post" action="https://select.worldpay.com/wcc/purchase">
      <INPUT TYPE="hidden" NAME="instId" VALUE="<?php print $data1?>">
      <INPUT TYPE="hidden" NAME="cartId" VALUE="<?php print $orderid?>">
      <INPUT TYPE="hidden" NAME="amount" VALUE="<?php print number_format($grandtotal,2,'.','')?>">
      <INPUT TYPE="hidden" NAME="currency" VALUE="<?php print $countryCurrency?>">
      <INPUT TYPE="hidden" NAME="desc" VALUE="<?php print substr($descstr,0,255)?>">
      <INPUT TYPE="hidden" NAME="name" VALUE="<?php print @$_POST["name"]?>">
      <INPUT NAME="address" TYPE="hidden" VALUE="<?php print @$_POST["address"]?>&#10;<?php print @$_POST["city"]?>&#10;<?php
        if(trim(@$_POST["state"]) != "")
            print @$_POST["state"];
        else
            print @$_POST["state2"]; ?>">
      <INPUT TYPE="hidden" NAME="postcode" VALUE="<?php print @$_POST["zip"]?>">
      <INPUT TYPE="hidden" NAME="tel" VALUE="<?php print @$_POST["phone"]?>">
      <INPUT TYPE="hidden" NAME="email" VALUE="<?php print @$_POST["email"]?>">
      <?php if($demomode){ ?>
      <INPUT TYPE="hidden" NAME="testMode" VALUE="100">
      <?php }
    }elseif(@$_POST["payprovider"]=="6"){ // NOCHEX
        $sSQL = "SELECT payProvDemo,payProvData1 FROM payprovider WHERE payProvID=6";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $demomode = ((int)$rs["payProvDemo"]==1);
        $data1 = $rs["payProvData1"];
        mysql_free_result($result);
?>
    <form method="post" action="https://www.nochex.com/nochex.dll/checkout">
      <INPUT TYPE="hidden" NAME="email" VALUE="<?php print $data1?>">
      <INPUT TYPE="hidden" NAME="returnurl" VALUE="<?php print $storeurl?>thanks.php">
      <INPUT TYPE="hidden" NAME="description" VALUE="<?php print substr($descstr,0,255)?>">
      <INPUT TYPE="hidden" NAME="ordernumber" VALUE="<?php print $orderid?>">
      <INPUT TYPE="hidden" NAME="amount" VALUE="<?php print number_format($grandtotal,2,'.','')?>">
<?php
    }elseif(@$_POST["payprovider"]=="7"){ // VeriSign Payflow Pro
        $sSQL = "SELECT payProvDemo,payProvData1 FROM payprovider WHERE payProvID=7";
        $result = mysql_query($sSQL) or print(mysql_error());
        $rs = mysql_fetch_array($result);
        $demomode = ((int)$rs["payProvDemo"]==1);
        $data1 = $rs["payProvData1"];
        mysql_free_result($result);
?>
    <form method="post" action="cart.php">
      <INPUT TYPE="hidden" NAME="mode" VALUE="authorize">
      <INPUT TYPE="hidden" NAME="method" VALUE="payflowpro">
      <INPUT TYPE="hidden" NAME="ordernumber" VALUE="<?php print $orderid?>">
<?php
    }
    if($success){
?>
      <br>
      <table border="0" cellspacing="0" cellpadding="0" width="<?php print $maintablewidth?>" bgcolor="#B1B1B1" align="center">
        <tr>
          <td width="100%">
            <table width="100%" border="0" bordercolor="#B1B1B1" cellspacing="1" cellpadding="3" bgcolor="#B1B1B1">
              <tr>
                <td bgcolor="#EBEBEB" height="30" colspan="2" align="center"><b><?php print $xxChkCmp?></b></td>
              </tr>
              <tr>
                <td bgcolor="#EBEBEB" height="30" align="right" width="50%"><?php print $xxTotGds?>:</td>
                <td bgcolor="#FFFFFF" height="30" align="left" width="50%"><?php print FormatEuroCurrency($totalgoods)?></td>
              </tr>
<?php if($shipType != 0){ ?>
              <tr>
                <td bgcolor="#EBEBEB" height="30" align="right" width="50%"><?php print $xxShippg?>:</td>
                <td bgcolor="#FFFFFF" height="30" align="left" width="50%"><?php print FormatEuroCurrency($stateTax)?></td>
              </tr>
<?php } ?>
<?php if($stateTax != 0.0){ ?>
              <tr>
                <td bgcolor="#EBEBEB" height="30" align="right" width="50%"><?php print $xxStaTax?>:</td>
                <td bgcolor="#FFFFFF" height="30" align="left" width="50%"><?php print FormatEuroCurrency($stateTax)?></td>
              </tr>
<?php }
      if($countryTax != 0.0){ ?>
              <tr>
                <td bgcolor="#EBEBEB" height="30" align="right" width="50%"><?php print $xxCntTax?>:</td>
                <td bgcolor="#FFFFFF" height="30" align="left" width="50%"><?php print FormatEuroCurrency($countryTax)?></td>
              </tr>
<?php } ?>
              <tr>
                <td bgcolor="#EBEBEB" height="30" align="right" width="50%"><?php print $xxGndTot?>:</td>
                <td bgcolor="#FFFFFF" height="30" align="left" width="50%"><?php print FormatEuroCurrency($grandtotal)?></td>
              </tr>
<?php if(@$_POST["payprovider"]=="7"){ // VeriSign Payflow Pro ?>
              <tr height="30">
                <td bgcolor="#EBEBEB" align="right" width="50%"><b><?php print $xxCrdNum?>:</b></td>
                <td bgcolor="#FFFFFF" width="50%"><input type="text" name="ACCT" size="<?php print atb(21)?>"></td>
              </tr>
              <tr height="30">
                <td bgcolor="#EBEBEB" align="right" width="50%"><b><?php print $xxExpEnd?>:</b></td>
                <td bgcolor="#FFFFFF" width="50%">
                  <select name="EXMON" size="1">
                    <option value=""><?php print $xxMonth?></option>
                    <?php    for($index=1; $index<=12; $index++){
                                if($index < 10) $themonth = "0" . $index; else $themonth = $index;
                                print "<option value='" . $themonth . "'>" . $themonth . "</option>\n";
                            } ?>
                  </select> / <select name="EXYEAR" size="1">
                    <option value=""><?php print $xxYear?></option>
                    <?php    $thisyear=date("Y", time());
                            for($index=$thisyear; $index <= $thisyear+10; $index++){
                                print "<option value='" . $index . "'>" . $index . "</option>\n";
                            } ?>
                  </select>
                </td>
              </tr>
              <tr height="30">
                <td bgcolor="#EBEBEB" align="right" width="50%"><b><?php print $xx34code?>:</b></td>
                <td bgcolor="#FFFFFF" width="50%"><input type="text" name="CVV2" size="<?php print atb(4)?>"> <b><?php print $xxIfPres?></b></td>
              </tr>
<?php } ?>
              <tr>
                <td bgcolor="#EBEBEB" height="30" colspan="2" align="center"><b><?php print $xxMstClk?></b></td>
              </tr>
              <tr>
                <td bgcolor="#FFFFFF" colspan="2" align="center"><table width="100%" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                      <td bgcolor="#FFFFFF" width="16" height="26" align="right" valign="bottom">&nbsp;</td>
                      <td bgcolor="#FFFFFF" width="100%" align="center"><input type="image" src="images/checkout.gif" border="0"></td>
                      <td bgcolor="#FFFFFF" width="16" height="26" align="right" valign="bottom"><img src="images/tablebr.gif"></td>
                    </tr>
                  </table></td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </form>
<?php
    } // success
}else{
    $alldata="";
    $sSQL = "SELECT cartID,cartProdID,pName,pPrice,cartQuantity FROM cart LEFT JOIN products ON cart.cartProdID=products.pID WHERE cartCompleted=0 AND cartSessionID='" .  session_id() . "'";
    $result = mysql_query($sSQL) or print(mysql_error());
?>
    <br>
    <form method="POST" action="cart.php" name="checkoutform">
    <input type="hidden" name="mode" value="update">
      <table border="0" cellspacing="0" cellpadding="0" width="<?php print $maintablewidth?>" bgcolor="#B1B1B1" align="center">
        <tr>
          <td width="100%">
            <table width="100%" border="0" bordercolor="#B1B1B1" cellspacing="1" cellpadding="3" bgcolor="#B1B1B1">
<?php
    if(mysql_num_rows($result) > 0){
        if(! $isInStock){
?>
              <tr height="30">
                <td bgcolor="#FFFFFF" colspan="6" align="center"><font color="#FF0000"><b><?php print $xxNoStok?></b></font></td>
              </tr>
<?php
        }
?>
              <tr height="30">
                <td bgcolor="#EBEBEB"><b><?php print $xxCODets?></b></td>
                <td bgcolor="#EBEBEB"><b><?php print $xxCOName?></b></td>
                <td bgcolor="#EBEBEB" align="center"><b><?php print $xxCOUPri?></b></td>
                <td bgcolor="#EBEBEB" align="center"><b><?php print $xxQuant?></b></td>
                <td bgcolor="#EBEBEB" align="center"><b><?php print $xxTotal?></b></td>
                <td bgcolor="#EBEBEB" align="center"><b><?php print $xxCOSel?></b></td>
              </tr>
<?php
        $grandtotal=0.0;
        // cartID,cartProdID,pName,pPrice,cartQuantity
        while($alldata=mysql_fetch_assoc($result)){
?>
              <tr height="30">
                <td bgcolor="#EBEBEB"><b><?php print $alldata["cartProdID"]?></b></td>
                <td bgcolor="#FFFFFF"><?php print $alldata["pName"] ?></td>
                <td bgcolor="#FFFFFF" align="right"><?php print FormatEuroCurrency($alldata["pPrice"])?></td>
                <td bgcolor="#FFFFFF" align="center"><input type="text" name="quant<?php print $alldata["cartID"]?>" value="<?php print $alldata["cartQuantity"]?>" size="2"></td>
                <td bgcolor="#FFFFFF" align="right"><?php print FormatEuroCurrency($alldata["pPrice"]*$alldata["cartQuantity"])?></td>
                <td bgcolor="#FFFFFF" align="center"><input type="checkbox" name="delet<?php print $alldata["cartID"]?>"></td>
              </tr>
<?php        $sSQL = "SELECT coOptGroup,coCartOption,coPriceDiff FROM cartoptions WHERE coCartID=" . $alldata["cartID"];
            $opts = mysql_query($sSQL) or print(mysql_error());
            $optPriceDiff=0;
            while($rs=mysql_fetch_assoc($opts)){ ?>
              <tr height="25">
                <td bgcolor="#EBEBEB" align="right"><font size="1"><b><?php print $rs["coOptGroup"]?>:</b></font></td>
                <td bgcolor="#FFFFFF"><font size="1"><?php print "&nbsp;- " . $rs["coCartOption"]?></font></td>
                <td bgcolor="#FFFFFF" align="right"><font size="1"><?php if($rs["coPriceDiff"]==0) print "- "; else print FormatEuroCurrency($rs["coPriceDiff"]);?></font></td>
                <td bgcolor="#FFFFFF" align="right">&nbsp;</td>
                <td bgcolor="#FFFFFF" align="right"><font size="1"><?php if($rs["coPriceDiff"]==0) print "- "; else print FormatEuroCurrency($rs["coPriceDiff"]*$alldata["cartQuantity"]);?></font></td>
                <td bgcolor="#FFFFFF" align="center">&nbsp;</td>
              </tr>
<?php            $optPriceDiff += $rs["coPriceDiff"];
            }
            mysql_free_result($opts);
            $grandtotal += (($alldata["pPrice"] + $optPriceDiff) * (int)$alldata["cartQuantity"]);
        }
?>
              <tr height="30">
                <td bgcolor="#EBEBEB" rowspan="2">&nbsp;</td>
                <td bgcolor="#FFFFFF" align="right" colspan="3"><b><?php print $xxGndTot?>:</b></td>
                <td bgcolor="#FFFFFF" align="right"><?php print FormatEuroCurrency($grandtotal)?></td>
                <td bgcolor="#FFFFFF" align="center"><a href="java script:document.checkoutform.submit()"><b><?php print $xxDelete?></b></a></td>
              </tr>
              <tr height="30">
                <td bgcolor="#FFFFFF" colspan="5">
                  <table width="100%" cellspacing="0" cellpadding="0" border="0">
                    <tr>
                      <td bgcolor="#FFFFFF" width="50%" align="center"><a href="<?php print $xxHomeURL?>"><b><?php print $xxCntShp?></b></a></td>
                      <td bgcolor="#FFFFFF" width="50%" align="center"><a href="java script:document.checkoutform.submit()"><b><?php print $xxUpdTot?></b></a></td>
                      <td width="16" height="26" align="right" valign="bottom"><img src="images/tablebr.gif"></td>
                    </tr>
                  </table>
                </td>
              </tr>
<?php
    }else{
        $cartEmpty=TRUE;
?>
              <tr>
                <td bgcolor="#FFFFFF" colspan="6" align="center">
                  <p>&nbsp;</p>
                  <p><?php print $xxSryEmp?></p>
                  <p>&nbsp;</p>
                  <p><a href="<?php print $xxHomeURL?>"><b><?php print $xxCntShp?></b></a></p>
                  <p>&nbsp;</p>
                </td>
              </tr>
<?php
    }
?>
            </table>
          </td>
        </tr>
      </table>
    </form>
<?php
}

if(@$_POST["mode"] != "go" && @$_POST["mode"] != "checkout" && @$_POST["mode"] != "add" && @$_POST["mode"] != "authorize" && ! $cartEmpty){
    $requiressl = FALSE;
    $sSQL = "SELECT payProvID FROM payprovider WHERE payProvEnabled=1 AND payProvID IN (7)"; // All the ones that require SSL
    $result = mysql_query($sSQL) or print(mysql_error());
    if(mysql_num_rows($result) > 0) $requiressl = TRUE;
    mysql_free_result($result);
    if($requiressl){
        if(@$pathtossl != ""){
            if(substr($pathtossl,-1) != "/") $pathtossl .= "/";
            $cartpath = $pathtossl . "cart.php";
        }else
            $cartpath = str_replace("http:","https:",$storeurl) . "cart.php";
    }else
        $cartpath="cart.php";
?>
      <table border="0" cellspacing="<?php print $maintablespacing?>" cellpadding="<?php print $maintablepadding?>" width="<?php print $maintablewidth?>" bgcolor="<?php print $maintablebg?>" align="center">
        <tr>
          <td width="100%">
            <form method="POST" action="<?php print $cartpath?>">
              <input type="hidden" name="mode" value="checkout">
              <input type="hidden" name="sessionid" value="<?php print  session_id();?>">
              <table width="<?php print $innertablewidth?>" border="0" cellspacing="<?php print $innertablespacing?>" cellpadding="<?php print $innertablepadding?>" bgcolor="<?php print $innertablebg?>">
                <tr>
                  <td width="100%" align="center" colspan="2"><b><?php print $xxPrsChk?></b></td>
                </tr>
                <tr>
                  <td width="50%" align="center" colspan="2"><input type="image" src="images/checkout.gif" border="0"></td>
                </tr>
              </table>
            </form>
          </td>
        </tr>
      </table>
<?php
}
?>
Avatar billede fckcasper Nybegynder
07. september 2003 - 14:54 #1
flot lavet
Avatar billede zeled Nybegynder
11. september 2003 - 20:57 #2
Siden virker ikke
Avatar billede ujo33 Nybegynder
12. september 2003 - 12:28 #3
Nå for søren !
Jeg har glemt at nævne at jeg har ændret stien om til

http://www.kalaaleq.gl/pisi/index.php

Sorry...
Avatar billede zeled Nybegynder
12. september 2003 - 16:47 #4
Du har en drop down til levering. Kan ikke ligegennemskue hvilken det er ,

men den bliver sendt videre til cart.php....

så vi skal da lige have cart.php også
Avatar billede ujo33 Nybegynder
12. september 2003 - 16:57 #5
Ja, inde i denne cart.php er der 5 includes.
Den første script (for oven) hedder inccart.php

Her er cart.php:

<?php
session_cache_limiter('none');
session_start(); ?><html><!-- #BeginTemplate "/Templates/Main.dwt" --><!-- DW6 -->

<head>
<!-- #BeginEditable "doctitle" -->
<title>Indk&oslash;bskurv</title>
<!-- #EndEditable -->
<LINK REL=STYLESHEET TYPE="text/css" HREF="stylesheet.css">

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor="#FFFFFF" background="images/pbg.gif" text="#000000" link="#FF0000" vlink="#CC0000" alink="#CC0000" leftmargin="0" topmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<table width="755" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="100%" colspan="4"> <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
          <td align="center">
            <SCRIPT LANGUAGE="php">
include "topflash.php";           
</script> <br> <div align="right"> </div></td>
        </tr>
      </table></td>
  </tr>
  <tr>
    <td width="100%" bgcolor="#FFFFFF"><img src="images/cornerr.gif" width="11" height="11"></td>
    <td width="100%" bgcolor="#FFFFFF"><img border="0" src="images/clearpixel.gif" width="1" height="1"></td>
    <td width="100%" bgcolor="#FFFFFF"><img border="0" src="images/clearpixel.gif" width="1" height="1"></td>
    <td width="100%" bgcolor="#FFFFFF">
<div align="right"><img border="0" src="images/clearpixel.gif" width="1" height="1"><img src="images/cornerl.gif" width="11" height="11"></div></td>
  </tr>
  <tr>
    <td colspan="4" valign="top" bgcolor="#FFFFFF"> <!-- #BeginEditable "Includes" -->
      <SCRIPT LANGUAGE="php">
include "vsadmin/db_conn_open.php";
include "vsadmin/includes.php";
include "vsadmin/inc/languagefile.php";
include "vsadmin/inc/incfunctions.php";
</SCRIPT>
      <!-- #EndEditable --><!-- #BeginEditable "Body" -->
<SCRIPT LANGUAGE="php">
include "vsadmin/inc/inccart.php";
</SCRIPT>
      <!-- #EndEditable --> <p align="center"><a href="index.php"><font size="1">HJEM</font></a>&nbsp;|
        <a href="kalaaleq.php"><font size="1">OM KALAALEQ.GL</font></a>&nbsp;|&nbsp;<a href="categories.php"><font size="1">PRODUKTER</font></a>&nbsp;|&nbsp;<a href="betingelser.php"><font size="1">BETINGELSER</font></a>&nbsp;|&nbsp;<a href="search.php"><font size="1">S&Oslash;G</font></a>&nbsp;|&nbsp;<a href="contact.php"><font size="1">KONTAKT</font></a></p>
      <p align="center"><font face="Verdana"><a href="http://www.kalaaleq.gl"><font size="1">Kalaaleq.GL
        - Copyright 2003 - All rights reserved</font></a></font><br>
        &nbsp; </p></td>
  </tr>
</table>
</body>

<!-- #EndTemplate --></html>
<script>

//Popup Window Script
//By Website Abstraction (http://wsabstract.com)
//JavaScript tutorials and over 400+ free scripts

function openpopup(){
var popurl="http://www.kalaaleq.gl/shop/huskmig.php"
winpops=window.open(popurl,"","width=400,height=200,scrollbars=no,resizable=yes,menubar=no")
}
function openpopup1(){
var popurl="http://www.kalaaleq.gl/shop/beting.php"
winpops=window.open(popurl,"","width=500,height=430,scrollbars=yes,resizable=yes,menubar=no")
}

</script>
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester