<html>
<head>
<title>Orderform Demo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<SCRIPT LANGUAGE=JavaScript TYPE="TEXT/JAVASCRIPT">
<!--Hide script from old browsers

function newWindow(newContent)
 {
  winContent = window.open(newContent, 'nextWin', 'right=0, top=0,width=600,height=600, toolbar=no,scrollbars=yes, resizable=yes')         
 }
function buyItem(itemno,quantity)
 {
  window.open("buy.php?cartform=1&item="+itemno+"&quantity="+quantity,"_blank","toolbar=no, location=no, scrollbars=no, width=300, height=300")
 }
function showlicense(product)
 {
  window.open("license.php?"+product,"_blank","toolbar=no, location=no, scrollbars=yes, width=500, height=600")
 }
function checkLicense(form)
 {
  if (form.acceptlicense.checked) form.submit();
  else {
    w = window.open("","_blank","toolbar=no, location=no, scrollbars=no, width=300, height=150");
	w.document.write('<html><head><title>You must accept the license agreement!</title></head><body bgcolor="#FFFFFF" text="#000000" link="#000000"><center><font face="Arial, Helvetica, sans-serif" size="3">To be allowed to buy and use this product you have to accept the license agreement!<br><br><font size="2"><a href="javascript:this.close()">Close this window</a></font></font><br></center></body></html>');
  }
 }
function cancelSubmit()
 {
   return false;
 }
 //Stop hiding script from old browsers -->
 
</SCRIPT>
<?php
  include "admin/config.inc.php";
  $db = @mysql_connect("$databaseserver", "$databaseuser", "$databasepasswd");
  @mysql_select_db("$databasename",$db);
  $subtotal = 0;
  $items = explode("a", $basket);
  $arraycount = 1;
  if ($items[0] && count($items)==1) $arraycount = 0;
  for ($i = 0; $i < count($items)-$arraycount; $i++) {

   $thisitem = explode("b", $items[$i]);
   $thisproductid = $thisitem[count($thisitem)-1];
   $thisproductid = explode("d", $thisproductid);
   $thisproductid = $thisproductid[0];
   // Get the products price from the database...
    $sql="SELECT price FROM product WHERE productid=$thisproductid";
    $result = @mysql_query("$sql",$db);
    if (@mysql_num_rows($result) == 0) {
      $price = 0;
    } else {
		$price = @mysql_result($result, 0, "price");
		$subtotal += $price * $thisitem[0];
    }  
  }
?>
</head>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0">
<p>&nbsp;</p><table width="750" border="1" align="center" bordercolor="#000000">
  <tr> 
    <td height="2" valign="top" align="center" bgcolor="#FFFFFF"> 
      <table width="100%" border="0" cellspacing="0" cellpadding="3">
        <tr> 
          <td width="5%">&nbsp;</td>
          <td width="45%"><img src="images/ashoplogo.gif" width="150" height="12" border="1" alt="Shopping Cart by AShop Software"></td>
          <td width="45%"> 
            <form name="shoppingcart">
              <table width="100%" cellpadding="2" cellspacing="0" border="0" align="right">
                <tr> 
                  <td align="right"><font face="Arial, Helvetica, sans-serif" size="2" color="#000000">Subtotal: 
                    $ </font><font face="Arial, Helvetica, sans-serif" size="2"> 
                    <input type="text" name="amount" style="border: 1px solid black; background: #ffffff; width: 60px; font: 11px verdana, arial, helvetica; color: #000000;" size="6" readonly value="<?php echo number_format($subtotal,2,'.',''); ?>">
                    </font></td>
                  <td width="76"><a href="basket.php"><img src="images/viewcart.gif" alt="View Cart:" border="0" width="76" height="21"></a></td>
                  <td width="76"><a href="shipping.php?action=checkout"><img src="images/checkout.gif" alt="Check out" border="0" width="76" height="21"></a></td>
                </tr>
              </table>
            </form>
          </td>
          <td width="5%">&nbsp;</td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td valign="top" width="75%" bgcolor="#FFFFFF"> 
      <table width="750" border="0" align="center">
        <tr> 
          <td valign="top" align="center"> 
            <table width="100%" border="0" cellpadding="0">
              <tr> 
                <td width="66%"><font face="Arial, Helvetica, sans-serif"><b><font size="3">OrderForm 
                  Example 2</font></b></font></td>
                <td align="right"><b>$ <span
  style='font-size:10.0pt;font-family:Arial'> 1.00</span></b></td>
              </tr>
              <tr> 
                <td valign="top">
                  <p><font face="Arial, Helvetica, sans-serif"><font face="Arial, Helvetica, sans-serif">Use 
                    the commented source code from this page to include AShop 
                    Deluxe shopping cart functionality within HTML pages. OrderForm 
                    pages must be within the AShop directory. The subtotal field 
                    must be included in the page once. Make the subtotal field 
                    type="hidden" if you don't want it to appear.<br>
                    <br>
                    IMPORTANT: An .htaccess file containing the line "AddType 
                    application/x-httpd-php .html .htm" must be present in this 
                    directory</font> </font></p>
                  <p><font face="Arial, Helvetica, sans-serif">This version of 
                    OrderForm code opens the view cart page when products are 
                    added. (instead of pop-up confirmation window)</font></p>
                </td>
                <td align="right"> 
                  <form name="productform" style="margin-bottom: 0px;" action="shipping.php">
                    <font face="Arial, Helvetica, sans-serif" size="2">Quantity: 
                    <input type="text" name="quantity" size="4" value="1" style="border: 1px solid black; background: #ffffff; width: 30px; font: 11px verdana, arial, helvetica; color: #000000;">
                    <br>
                    <font color="#000000">Discount code [Optional]:</font></font><font face="Arial, Helvetica, sans-serif" size="2" color="#0000FF"> 
                    <input type="text" name="discount" size="10">
                    </font> 
                    <input type="hidden" name="product" value="1">
                    <input type="hidden" name="add" value="true">
                    <input type="hidden" name="action" value="basket">
                    <br>
                    <input type="image" border="0" name="imageField" src="images/buysp.gif" align="top">
                  </form>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</body>
</html>
