CREATE TABLE cort_menu (
  id mediumint(6) NOT NULL auto_increment,
  pid mediumint(6) NOT NULL default '0',
  name varchar(100) NOT NULL default '0',
  link varchar(30) NOT NULL default '',
  PRIMARY KEY  (id)
) TYPE=MyISAM;

INSERT INTO cort_menu VALUES ( '1', '0', 'Home', 'main');
INSERT INTO cort_menu VALUES ( '7', '0', 'Products', 'products');
INSERT INTO cort_menu VALUES ( '8', '7', 'Software', 'common');
INSERT INTO cort_menu VALUES ( '9', '7', 'Overview', 'common');
INSERT INTO cort_menu VALUES ( '10', '7', 'Features', 'common');
INSERT INTO cort_menu VALUES ( '11', '7', 'Demo', 'common');
INSERT INTO cort_menu VALUES ( '12', '7', 'Buyer\'s FAQ', 'common');
INSERT INTO cort_menu VALUES ( '13', '0', 'Support', 'common');
INSERT INTO cort_menu VALUES ( '14', '13', 'Tech Support', 'common');
INSERT INTO cort_menu VALUES ( '15', '13', 'Support FAQ', 'common');
INSERT INTO cort_menu VALUES ( '16', '13', 'Documentation', 'common');
INSERT INTO cort_menu VALUES ( '17', '0', 'Contact US', 'common');
INSERT INTO cort_menu VALUES ( '18', '17', 'Orders', 'common');
INSERT INTO cort_menu VALUES ( '19', '17', 'Enquiries', 'common');
INSERT INTO cort_menu VALUES ( '20', '17', 'Advertising', 'common');


CREATE TABLE cort_temp (
  id smallint(6) NOT NULL auto_increment,
  name varchar(30) NOT NULL default '',
  body mediumtext NOT NULL,
  type tinyint(4) NOT NULL default '0',
  show_t tinyint(2) NOT NULL default '1',
  PRIMARY KEY  (id),
  UNIQUE KEY name (name)
) TYPE=MyISAM;

INSERT INTO cort_temp VALUES ( '2', 'navigation', 'echo \"<!-- begin left area content//--> <TABLE border=0 width=\\\"100%\\\"> <TBODY> <TR> <TD align=left valign=top>\";\r\ntree(0, \'\');\r\necho \"</TD></TR> </TBODY></TABLE>\";', '1', '0');
INSERT INTO cort_temp VALUES ( '15', 'common', '<center>\r\n<br><br><br>\r\n<b> Temporary common linked template.</b>\r\n<p>In the future this template may be deleted and links changed to corresponding templates\r\n</center>\r\n<div align=right><font color=green size=4 face=arial>Look here</font><br>', '0', '1');
INSERT INTO cort_temp VALUES ( '3', 'main', '<TABLE border=0 cellPadding=2 cellSpacing=2 width=\"100%\">\r\n        <TBODY>\r\n        <TR>\r\n          <TD align=left vAlign=top><FONT color=#000080 \r\n            face=verdana,arial,homerton,sans-serif size=+2><B>Headline \r\n            Here</B></FONT></TD>\r\n</tr>\r\n<tr><td>\r\nContent here...<br>This revolutionary new feature makes it possible \r\nfor you to enter text, control menus, and execute commands simply by \r\nspeaking into a microphone. Find out more.\r\n</td></tr></tbody></table>\r\n                <!-- end center area content//-->\r\n                </td>\r\n                \r\n                <td background=checker.gif><img src=\"1x1Trans.gif\" width=\"1\" height=\"1\"></td>\r\n                <td width=20% bgcolor=#ffffff>\r\n                <!-- begin right area content//-->\r\n                there is something here\r\n                <!-- end right area content//-->\r\n                </td>\r\n                \r\n\r\n              </tr>\r\n            </table>', '0', '1');
INSERT INTO cort_temp VALUES ( '24', 'search', 'include_temp(\"cart\");\r\n\r\ncommonHeader(\"$Company\",\"<br><b><font size=2>Select an item below:</font></b><br><br>\");\r\n\r\necho $CA;\r\n$cat=mysql_query(\"SELECT PagingStep FROM Category WHERE CategoryID=\'$CA\'\");\r\n$step=mysql_result($cat,0,0);\r\nmysql_free_result($cat);\r\n\r\nif (empty($ix))\r\n     $ix = 0;\r\n$size=$step+1;\r\nif ($search_cat==\'all\'||$search_cat==\'all\') {\r\n$result=mysql_query(\"SELECT * FROM Items WHERE ItemName LIKE \'%$search_term%\' OR ItemDescription LIKE \'%$search_term%\' ORDER BY ItemName LIMIT $ix,$size\");\r\n} \r\nelse {\r\n$result=mysql_query(\"SELECT * FROM Items WHERE Category=$search_cat AND (ItemName LIKE \'%$search_term%\' OR ItemDescription LIKE \'%$search_term%\') ORDER BY ItemName LIMIT $ix,$size\");\r\n}\r\n$size=mysql_num_rows($result);\r\nfontFace(\"Arial\",\"<br><b><font size=2>Select an item:</font></b><br><br>\");\r\necho \"<ul>\";\r\n$no=0;\r\nwhile ($row  =  mysql_fetch_row($result)) {\r\n$IS=$row[0];\r\n$IN=$row[1];\r\n$ID=$row[2];\r\n$IC=$row[3];\r\n$Ca=$row[4];\r\n$SC=$row[5];\r\n$II=$row[6];\r\nfontFace(\"Arial\",\"<li><a class=link-head href=\'$PHP_SELF?topic=description&II=$II&UID=$UID\'>$IN</a>\");\r\nif ($ID != \"\") {\r\nfontFace(\"Arial\",\" - $ID\"); }\r\necho \"</li>\";\r\n$no++;\r\nif ($no == $step)\r\n     break;\r\n}\r\necho \"</ul><br>\";\r\n\r\nif ($ix > 0) {\r\n     $prev=$ix-$step;\r\n     if ($prev<0)\r\n          $prev=0;\r\n     fontFace(\"Arial\",\"<a class=link-head href=\'$PHP_SELF?topic=items&CA=$CA&ix=$prev&UID=$UID\'><< prev</a>\");\r\n}    \r\n\r\necho \'   \';\r\n\r\nif ($no < $size) {\r\n     $next=$ix+$step;\r\n     fontFace(\"Arial\",\"<a class=link-head href=\'$PHP_SELF?topic=items&CA=$CA&ix=$next&UID=$UID\'>next >></a>\");\r\n}    \r\n\r\ncommonFooter($Relative,$UID);\r\n', '1', '1');
INSERT INTO cort_temp VALUES ( '26', 'header', '<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n          <TBODY>\r\n        <TR>\r\n          <TD align=left vAlign=bottom nowrap>\r\n          <B><A class=link-logo href=\"\">Sitename.com</a></b>\r\n          </TD>\r\n          <td align=center vAlign=middle> \r\n            <table width=\"468\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n          <TBODY>\r\n        <TR>\r\n          <td bgcolor=#666699 align=center vAlign=middle height=60 width=468 nowrap>\r\n          <font color=#ffffff sixe=+6>Banner goes here</font></td>\r\n          </TR></TBODY></TABLE>\r\n          </td>\r\n        </TR></TBODY></TABLE>\r\n        <table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\r\n          <TBODY>\r\n        <TR>\r\n          <TD align=left vAlign=top nowrap width=30%>\r\n          <FONT color=#aaaaaa face=arial size=2>\r\n          Our motto is this\r\n          </FONT>\r\n            </TD>\r\n            <TD width=70% align=right vAlign=top nowrap>\r\n            <FONT color=#aaaaaa face=arial size=2>\r\n<A class=link-head href=\"index.php?topic=store\">Store</a> | \r\n          <A class=link-head href=\"index.php?topic=common\">Newsletter</a> | \r\n          <A class=link-head href=\"index.php?topic=common\">Our News</a> | \r\n          <A class=link-head href=\"index.php?topic=common\">Site Advertising</a> | \r\n          <A class=link-head href=\"http://www.namedoggy.com\">Partner Links</a> | \r\n          <A class=link-head href=\"index.php?topic=common\">Driving Directions</a>\r\n          </FONT>\r\n             </td>\r\n            </TR></TBODY></TABLE>', '0', '0');
INSERT INTO cort_temp VALUES ( '27', 'footer', 'print \"<BR>\r\n<TABLE BORDER=0 CELLPADDING=0 CELLSPACING=0 WIDTH=100%>\r\n  <TBODY>\r\n  <TR VALIGN=bottom WIDTH=100%>\r\n  <TD ID=foot NOWRAP valign=bottom align=center>\r\n  <DIV ALIGN=center valign=bottom>\r\n  <A class=footer\r\n      HREF=$PHP_SELF>Contact</A> | <A class=footer\r\n      HREF=$PHP_SELF>Legal Notices</A> | <A class=footer\r\n      HREF=javascript:window.print()>Print this page</A> | <A class=footer HREF=\\\"$PHP_SELF?d=&f=download\\\">Email this page!</A>\r\n      \r\n <BR><table width=100%>\r\n <tr><td width=100% align=center nowrap>\r\n\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_fr\\\" target=_new><img src=\\\"./images/fr.gif\\\" border=0 Alt=traduisent></A>\r\n\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_es\\\" target=_new><img src=\\\"./images/es.gif\\\" border=0 Alt=traducen></A>\r\n\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_de\\\" target=_new><img src=\\\"./images/de.gif\\\" border=0 Alt=übersetzen></A>\r\n\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_it\\\" target=_new><img src=\\\"./images/it.gif\\\" border=0 Alt=traducono></A>\r\n\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_ja\\\" target=_new><img src=\\\"./images/ja.gif\\\" border=0 Alt=Japanese></A>\r\n\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_ko\\\" target=_new><img src=\\\"./images/ko.gif\\\" border=0 Alt=Korean></A>\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_pt\\\" target=_new><img src=\\\"./images/pt.gif\\\" border=0 Alt=traduzem></A>\r\n\r\n<A HREF=\\\"http://babel.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI&lp=en_zh\\\"><img src=\\\"./images/zh.gif\\\" border=0 Alt=Chinese></A>\r\n<A HREF=\\\"http://world.altavista.com/tr?url=http://$SERVER_NAME$REQUEST_URI\\\"><img src=\\\"./images/en.gif\\\" border=0 Alt=Translate this Page></A>\r\n</td></tr></table>      \r\n<FONT COLOR=#000000 FACE=\\\"arial,helvetica,tahoma,geneva,verdana\\\" SIZE=\\\"-2\\\">\r\nCopyright © 2001 <A HREF=http://searchenginebot.com><font color=#000000 size=1 face=verdana,arial>Searchengine<b>BOT</font><font color=#3838a8 size=1 face=verdana,arial>.com</b></A></font>, all rights reserved.\r\n      Last Modified :\";\r\n            putenv(\"PHP_TZ=America/Los_Angeles\");\r\n            echo date( \"F d,  Y.\", getlastmod() );\r\nprint \"\r\n</FONT></DIV></TD></TR></TABLE>\";', '1', '0');
INSERT INTO cort_temp VALUES ( '29', 'user_info', '$i=0;\r\n$j=0;\r\ninclude_temp (\"cart\");\r\n\r\n$result=mysql_query(\"SELECT * FROM CartItems WHERE UserID=\'$UID\'\");\r\nif (mysql_num_rows($result) == 0) {\r\n     commonHeader(\"$Company\",\"\");\r\n     blueFont(\"Arial\",\"<b><br>Your shopping cart is empty</b><br><br>\");\r\n     commonFooter($Relative,$UID);\r\n     exit;\r\n}\r\n\r\ncommonHeader(\"$Company\",\"May I have your information please?\");\r\n\r\nblueFont(\"Arial\",\"<br><b>Your shopping cart contains the following items:</b><br><br>\");\r\n\r\necho \"<table border=\'1\' cellpadding=\'2\' cellspacing=\'2\' width=\'600\'><tr>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Name\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Options\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Qty\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Cost<br>Shipping\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Total\");\r\necho \"</th></tr>\";\r\n\r\nwhile ($row  =  mysql_fetch_row($result)) {\r\n$CUI=$row[0];\r\n$CII=$row[1];\r\n$CIQ=$row[2];\r\n$CDa=$row[3];\r\n$CCI=$row[4];\r\n$ITO=nl2br($row[5]).\'&nbsp;\';\r\n     $result2=mysql_query(\"SELECT * FROM Items WHERE ItemID=\'$CII\'\");\r\n     while ($row2=mysql_fetch_row($result2)) {\r\n     $IIS=$row2[0];\r\n     $IIN=$row2[1];\r\n     $IID=$row2[2];\r\n     $IIC=$row2[3];\r\n     $ICa=$row2[4];\r\n     $ISC=$row2[5];\r\n     $III=$row2[6];\r\n     $IPC=$row2[8];\r\n\r\n     switch ($IPC) {\r\n     case \'O\': $PC = \'one time\'; break;\r\n     case \'W\': $PC = \'weekly subscription\'; break;\r\n     case \'M\': $PC = \'monthly subscription\'; break;\r\n     case \'Y\': $PC = \'yearly subscription\'; break;\r\n     }\r\n\r\n\r\n$To[$i]=(($CIQ * $IIC)+($CIQ * $ISC));\r\necho \"<tr><td>\";\r\nblueFont(\"Arial\",\"$IIN\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$ITO\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$CIQ\");\r\necho \"</td><td>\";\r\n$IIC=number_format($IIC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"$$IIC ($PC)\");\r\necho \"<br>\";\r\nif ($ISC == \"0.00\") {\r\n$ES=\"1\";\r\nblueFont(\"Arial\\\" size=\\\"-2\",\"$NoShipping\");\r\n} else {\r\n$ISC=number_format($ISC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"$$ISC\");}\r\necho \"</td><td>\";\r\n$Tot=number_format($To[$i],\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"<b>$$Tot</b>\");\r\n\r\necho \"</tr>\";\r\n$i++;\r\n        }\r\n}\r\n\r\nwhile ($j < $i) {\r\n$total=$total+$To[$j];\r\n$j++;\r\n}\r\n\r\necho \"<tr><td></td><td></td><td></td>\";\r\necho \"<td>\";\r\nblueFont(\"Arial\",\"<center><b><i>Total Cost: </i></b></center>\");\r\necho \"<td>\";\r\n$total=number_format($total,\"2\",\".\",\"thousands_sep\");\r\nif ($ES == \"1\") {\r\nblueFont(\"Arial\",\"<b><center>$$total</b>\");\r\nblueFont(\"Arial\\\" size=\\\"-2\",\" Plus Shipping</center>\");\r\n} elseif ($ES != \"1\") {\r\nblueFont(\"Arial\",\"<b><center> $$total </center></b>\"); }\r\n\r\necho \"</tr></table>\";\r\necho \"</form>\";\r\n\r\necho \"<p>\";\r\n\r\necho \"<form action=\\\"$PHP_SELF?topic=order\\\" method=\\\"post\\\"><table border=\\\"0\\\"><tr><td>\";\r\n\r\necho \'<table><tr><td colspan=2>\';\r\n$result=mysql_query(\"SELECT OptionID, OptionName, OptionType FROM OrderOption ORDER BY OptionID\");\r\nif (mysql_num_rows($result) > 0)\r\n     redFont(\'Arial\', \'<b>Order Options</b>\');\r\necho \'</td></tr>\';\r\nwhile (list($OptionID, $OptionName, $OptionType)=mysql_fetch_row($result)) {\r\n     echo \"<tr><td valign=top>$OptionName</td><td valign=top>\";\r\n\r\n     $option_value = \'OV_\' . ereg_replace(\" \", \"_\", $OptionName);\r\n     switch ($OptionType) {\r\n     case \'text\':\r\n          echo \"<input type=\\\"text\\\" name=\\\"$option_value\\\">\";\r\n          break;\r\n     case \'textarea\':\r\n          echo \"<textarea rows=\\\"3\\\" cols=\\\"40\\\" name=\\\"$option_value\\\"></text\";\r\n\t\t  echo \"area>\";\r\n          break;\r\n     case \'select\':\r\n          echo \"<select name=\\\"$option_value\\\">\";\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<option value=\\\"$vname\\\"> $vname\";\r\n          }\r\n          mysql_free_result($ov);\r\n          echo \'</select>\';\r\n          break;\r\n     case \'selectm\':\r\n          echo \"<select name=\\\"${option_value}[]\\\" size=\\\"5\\\" multiple>\";\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<option value=\\\"$vname\\\"> $vname\";\r\n          }\r\n          mysql_free_result($ov);\r\n          echo \'</select>\';\r\n          break;\r\n     case \'checkbox\':\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<input name=\\\"${option_value}[]\\\" type=\\\"checkbox\\\" value=\\\"$vname\\\"> $vname<br>\";\r\n          }\r\n          mysql_free_result($ov);\r\n          break;\r\n     case \'radio\':\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<input name=\\\"${option_value}\\\" type=\\\"radio\\\" value=\\\"$vname\\\"> $vname<br>\";\r\n          }\r\n          mysql_free_result($ov);\r\n          break;\r\n     }\r\n\r\n     echo \'</td></tr>\';\r\n}\r\nmysql_free_result($result);\r\necho \'</table>\';\r\n\r\n\r\n$buyer = mysql_query(\"SELECT * FROM Buyers WHERE UserID = \'$UID\'\");\r\nif (!$buy = mysql_fetch_array($buyer)) {\r\n     blueFont(\'Arial\', \"<b><BR>If you previously bought from our site you can <a class=link-login href=$PHP_SELF?topic=login&UID=$UID>CLICK HERE</a> to login</b><br><br>\");\r\n}\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"<b>Please fill out the information below</b><p>\");\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your name<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"Name\\\" size=\\\"40\\\" value=\\\"$buy[Name]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your address<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"BuyAddress1\\\" size=\\\"40\\\" value=\\\"$buy[Address1]\\\"><br>\";\r\necho \"<input type=\\\"text\\\" name=\\\"BuyAddress2\\\" size=\\\"40\\\" value=\\\"$buy[Address2]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your city state and zip code<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"BuyCity\\\" size=\\\"25\\\" value=\\\"$buy[City]\\\">\";\r\necho \"&nbsp;&nbsp;<input type=\\\"text\\\" name=\\\"BuyState\\\" size=\\\"2\\\" MAXLENGTH=\\\"2\\\" value=\\\"$buy[State]\\\">\";\r\necho \"&nbsp;&nbsp;<input type=\\\"text\\\" name=\\\"BuyZip\\\" size=\\\"7\\\" maxlength=\\\"12\\\" value=\\\"$buy[Zip]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your e-mail address<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"BuyEmail\\\" size=\\\"40\\\" value=\\\"$buy[Email]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your Password<br>\");\r\necho \"<input type=\\\"password\\\" name=\\\"BuyPass\\\" size=\\\"10\\\" value=\\\"$buy[Pass]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Password Confirmation<br>\");\r\necho \"<input type=\\\"password\\\" name=\\\"BuyPassConf\\\" size=\\\"10\\\" value=\\\"$buy[Pass]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your daytime (work) phone number<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"DayPhone\\\" size=\\\"40\\\" value=\\\"$buy[DayPhone]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your evening (home) phone number<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"EvePhone\\\" size=\\\"40\\\" value=\\\"$buy[EvePhone]\\\"><p>\";\r\n\r\necho \"<input type=\\\"radio\\\" name=\\\"save\\\" value=\\\"1\\\" checked> \";\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"UPDATE my Buyer Data<br>\");\r\necho \"<input type=\\\"radio\\\" name=\\\"save\\\" value=\\\"0\\\"> \";\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"DO NOT update my Buyer Data<p>\");\r\n\r\nblueFont( \"Arial\\\" size=\\\"2\", \"Payment method<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"Check\\\">\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"Check or Money Order<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"Credit\\\" CHECKED>\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"Credit Card<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"PayPal\\\">\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"PayPal<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"Other\\\">\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"Other, please call me\");\r\necho  \"<p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"Credit Card type<br>\");\r\necho  \"<input type=\\\"text\\\" name=\\\"CCType\\\" size=\\\"40\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"Credit Card number<br>\");\r\necho  \"<input type=\\\"text\\\" name=\\\"CCNum\\\" size=\\\"40\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"Credit Card expiration date<br>\");\r\necho  \"<input type=\\\"text\\\" name=\\\"CCExpire\\\" size=\\\"40\\\"><p>\";\r\n\r\necho  \"<input type=\\\"checkbox\\\" name=\\\"Contact\\\" value=\\\"1\\\" CHECKED>\";\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"&nbsp;&nbsp;Please contact me before filling this order<p>\");\r\n\r\n$Date=date(\"Y:z:Y-m-d\");\r\n$total=ereg_replace(\",\",\"\",$total);\r\necho \"<input type=\\\"hidden\\\" name=\\\"OrderTotal\\\" value=\\\"$total\\\">\r\n<input type=\\\"hidden\\\" name=\\\"Date\\\" value=\\\"$Date\\\">\r\n<input type=\\\"hidden\\\" name=\\\"UserID\\\" value=\\\"$UID\\\">\r\n<input type=\\\"hidden\\\" name=\\\"UID\\\" value=\\\"$UID\\\">\r\n<input type=\\\"hidden\\\" name=\\\"BuyerID\\\" value=\\\"\\\">\r\n<input type=\\\"hidden\\\" name=\\\"OrderNumber\\\" value=\\\"\\\">\r\n<input type=\\\"submit\\\" value=\\\"Complete This Order\\\"></form>\";\r\n\r\n\r\necho \"</td></tr></table>\";\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '30', 'order', 'include_temp(\"cart\");\r\n\r\nif ($Name == \"\") {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You forgot to tell me your NAME. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\nif ($BuyAddress1 == \"\" OR $BuyCity == \"\" OR $BuyState == \"\" OR $BuyZip == \"\") {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You forgot to tell me your ADDRESS. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\nif ($BuyEmail == \"\") {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You forgot to tell me your E-MAIL ADDRESS. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\nif (empty($BuyPass) || $BuyPass != $BuyPassConf) {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You either forgot to enter a Password or incorrectly retyped it. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\nif ($DayPhone == \"\" AND $EvePhone == \"\") {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You forgot to tell me your PHONE NUMBER. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\nif ($PayMethod == \"Credit\" AND $CCType == \"\") {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You forgot to tell me your CREDIT CARD TYPE. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\n\r\nif ($PayMethod == \"Credit\" AND $CCNum == \"\") {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You forgot to tell me your CREDIT CARD NUMBER. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\nif ($PayMethod == \"Credit\" AND $CCExpire == \"\") {\r\ncommonHeader(\"$Company\",\"Oops...\");\r\nfontSize(\"+1\",\"#000080\",\"Arial\",\"<B><br>You forgot to tell me your CREDIT CARD EXPIRATION DATE. Please go back and complete the order form.<br><br>\");\r\ncommonFooter($Relative,$UserID);\r\nexit;\r\n}\r\n\r\n//\r\n//   Handle Buyer account\r\n//\r\n$buyer = mysql_query(\"SELECT BuyerID FROM Buyers WHERE UserID = \'$UserID\'\");\r\nlist($BuyerID) = mysql_fetch_row($buyer);\r\nmysql_free_result($buyer);\r\n\r\nif (empty($BuyerID)) {\r\n     $sql =    \"INSERT INTO Buyers \r\n          (Name, Address1, Address2, City, State, Zip, Email, Pass, DayPhone, EvePhone, UserID)\r\n          VALUES (\'$Name\',\'$BuyAddress1\',\'$BuyAddress2\',\r\n          \'$BuyCity\',\'$BuyState\',\'$BuyZip\',\r\n          \'$BuyEmail\',\'$BuyPass\', \'$DayPhone\',\'$EvePhone\', \'$UserID\')\";\r\n     mysql_query($sql);\r\n     $BuyerID = mysql_insert_id();\r\n}\r\n\r\nif ($save == \"1\") {\r\n     $sql =    \"UPDATE Buyers SET\r\n          Name = \'$Name\', Address1 = \'$BuyAddress1\', Address2 = \'$BuyAddress2\',\r\n          City = \'$BuyCity\', State = \'$BuyState\', Zip = \'$BuyZip\',\r\n          Email = \'$BuyEmail\', Pass = \'$BuyPass\',\r\n          DayPhone = \'$DayPhone\', EvePhone = \'$EvePhone\'\r\n          WHERE BuyerID = $BuyerID\";\r\n     mysql_query($sql);\r\n}\r\n\r\n//\r\n//   Get Order Options\r\n//\r\n$result = mysql_query(\"SELECT OptionName, OptionType FROM OrderOption\");\r\n$i = 0;\r\nwhile (list($OptionName, $OptionType) = mysql_fetch_row($result)) {\r\n     $option_value = \'OV_\' . ereg_replace(\" \", \"_\", $OptionName);\r\n     $val = is_array($$option_value) ? implode(\', \', $$option_value) : $$option_value;\r\n     if (!empty($val)) {\r\n          $oset[$i] = \"$OptionName: $val\";\r\n          $i++;\r\n     }\r\n}\r\nmysql_free_result($result);\r\n\r\n$OrderOptions = implode(\"\\n\", $oset);\r\n\r\n//\r\n//   Prepare for Mailing\r\n//\r\n$mail_company = \"$Company\r\n$Address1\r\n$Address2\r\n$City $Zip, $State\r\nPhone: $Phone\r\nEmail: $Email\r\n  Web: $Web\r\n\";\r\n\r\n$mail_footer=\"\\n\\nThis order was automatically generated $SERVER_NAME.\\n\\n\";\r\n\r\n//\r\n//   Create Item Order from Cart\r\n//\r\n$sql =    \'SELECT COUNT(c.ItemID) FROM CartItems c, Items i \' .\r\n     \"WHERE c.ItemID = i.ItemID AND c.UserID = \'$UserID\' AND i.PaymentCycle = \'O\'\";\r\n$cart = mysql_query($sql);\r\n$CountItems = intval(mysql_result($cart,0,0));\r\nmysql_free_result($cart);\r\n\r\nif ($CountItems > 0) {   // Create Item Order\r\n\r\n$sql =    \"INSERT INTO Orders \r\n     (BuyerID, UserID, Date, bName, bAddress1, bAddress2, bCity, bState, bZip, bDayPhone, bEvePhone,\r\n     bContact, bPayMethod, bCCType, bCCNum, bCCExpire, OrderOptions, PaymentCycle)\r\n     VALUES (\'$BuyerID\',\'$UserID\',\'$Date\',\r\n     \'$Name\',\'$BuyAddress1\',\'$BuyAddress2\',\'$BuyCity\',\'$BuyState\',\'$BuyZip\',\r\n     \'$DayPhone\',\'$EvePhone\', \'$Contact\', \'$PayMethod\', \'$CCType\', \'$CCNum\', \'$CCExpire\', \'$OrderOptions\', \'O\')\";\r\nmysql_query($sql);\r\n\r\n$ONset[] = $ON = mysql_insert_id();\r\n\r\n$sql =    \'INSERT INTO Receipts \' .\r\n     \'(BuyerID, OrderNumber, ItemID, ItemSKU, ItemName, ItemCost, ShippingCost, \' .\r\n     \'ItemQuantity, TotalCost, ItemOptions, PaymentCycle) \' .\r\n     \"SELECT $BuyerID, $ON, i.ItemID, i.ItemSKU, i.ItemName, i.ItemCost, i.ShippingCost, \" .\r\n     \"c.ItemQuantity, c.ItemQuantity * (i.ItemCost + i.ShippingCost), c.ItemOptions, i.PaymentCycle \" .\r\n     \"FROM CartItems c, Items i \" .\r\n     \"WHERE c.ItemID = i.ItemID AND c.UserID = \'$UserID\' AND i.PaymentCycle = \'O\'\";\r\nmysql_query($sql);\r\n\r\n$sql = \"SELECT sum(TotalCost) FROM Receipts WHERE OrderNumber = \'$ON\'\";\r\n$ot = mysql_query($sql);\r\n$oTotalCost = mysql_result($ot,0,0);\r\nmysql_free_result($ot);\r\n$sql = \"UPDATE Orders SET OrderTotal = $oTotalCost WHERE OrderNumber = \'$ON\'\";\r\nmysql_query($sql);\r\n\r\n//\r\n//   Do the Mailing\r\n//\r\n$sql = \"SELECT o.*, b.Email FROM Orders o, Buyers b WHERE o.BuyerID = b.BuyerID AND o.OrderNumber = \'$ON\'\";\r\n$order = mysql_query($sql);\r\nlist(     $oBuyerID, $oUserID, $oDate, $OrderTotal,\r\n     $OrderNumber, $OrderStatus, $bName, $bAddress1, $bAddress2, $bCity, $bState,\r\n     $bZip, $bDayPhone, $bEvePhone, $bContact, $bPayMethod, $bCCType, $bCCNum,\r\n     $bCCExpire, $oOrderOptions, $oPaymentCycle, $oPaymentStatus, $bEmail\r\n) = mysql_fetch_row($order);\r\nmysql_free_result($order);\r\nlist($null, $null, $dDate) = split(\':\', $oDate);\r\nswitch ($oPaymentCycle) {\r\ncase \'O\': $PC = \'one time\'; break;\r\ncase \'W\': $PC = \'weekly subscription\'; break;\r\ncase \'M\': $PC = \'monthly subscription\'; break;\r\ncase \'Y\': $PC = \'yearly subscription\'; break;\r\n}\r\n\r\n$mail_buyer = \"\r\nOrder For: $bName\r\n$bAddress1\r\n$bAddress2\r\n$bCity $bZip, $bState\r\n\";\r\n\r\n$mail_order = \"\r\nOrder Number: $OrderNumber Date: $dDate\r\n Order Total: $OrderTotal ($PC)\r\n  Pay Method: $bPayMethod\r\n\";\r\n\r\n$mail_user_link = \"\r\nFor further Order details and status see:\r\n<a class=link-head href=\\\"$PHP_SELF?topic=receipt&ON=$OrderNumber&UID=$UserID\\\">Receipt</a>\r\n\";\r\n\r\n$mail_admin_link = \"\r\nFor further Order details and processing see:\r\n<a class=link-head href=\\\"$PHP_SELF?topic=adm_receipt&ON=$OrderNumber\\\">Processing</a>\r\n\";\r\n\r\nMail($bEmail, \"Your Order\", \"$mail_company$mail_buyer$mail_order$mail_user_link$mail_footer\", \"From: $Email\");\r\nMail($Email, \"New Order\", \"$mail_buyer$mail_order$mail_admin_link$mail_footer\", \"From: $Email\");\r\n} // end if ($CountItems > 0)\r\n\r\n//\r\n//   Create Subscription Orders from Cart\r\n//\r\n$sql =    \'SELECT c.CartItemsID, i.PaymentCycle FROM CartItems c, Items i \' .\r\n     \"WHERE c.ItemID = i.ItemID AND c.UserID = \'$UserID\' AND i.PaymentCycle <> \'O\'\";\r\n$cart = mysql_query($sql);\r\n\r\nwhile (list($cCartItemsID, $cPaymentCycle) = mysql_fetch_row($cart)) {     // Create Subscription Order\r\n\r\n$sql =    \"INSERT INTO Orders \r\n     (BuyerID, UserID, Date, bName, bAddress1, bAddress2, bCity, bState, bZip, bDayPhone, bEvePhone,\r\n     bContact, bPayMethod, bCCType, bCCNum, bCCExpire, OrderOptions, PaymentCycle)\r\n     VALUES (\'$BuyerID\',\'$UserID\',\'$Date\',\r\n     \'$Name\',\'$BuyAddress1\',\'$BuyAddress2\',\'$BuyCity\',\'$BuyState\',\'$BuyZip\',\r\n     \'$DayPhone\',\'$EvePhone\', \'$Contact\', \'$PayMethod\', \'$CCType\', \'$CCNum\', \'$CCExpire\', \'$OrderOptions\', \'$cPaymentCycle\')\";\r\nmysql_query($sql);\r\n\r\n$ONset[] = $ON = mysql_insert_id();\r\n\r\n$sql =    \'INSERT INTO Receipts \' .\r\n     \'(BuyerID, OrderNumber, ItemID, ItemSKU, ItemName, ItemCost, ShippingCost, \' .\r\n     \'ItemQuantity, TotalCost, ItemOptions, PaymentCycle) \' .\r\n     \"SELECT $BuyerID, $ON, i.ItemID, i.ItemSKU, i.ItemName, i.ItemCost, i.ShippingCost, \" .\r\n     \"c.ItemQuantity, c.ItemQuantity * (i.ItemCost + i.ShippingCost), c.ItemOptions, i.PaymentCycle \" .\r\n     \"FROM CartItems c, Items i \" .\r\n     \"WHERE c.ItemID = i.ItemID AND c.CartItemsID = $cCartItemsID\";\r\nmysql_query($sql);\r\n\r\n$sql = \"SELECT sum(TotalCost) FROM Receipts WHERE OrderNumber = \'$ON\'\";\r\n$ot = mysql_query($sql);\r\n$oTotalCost = mysql_result($ot,0,0);\r\nmysql_free_result($ot);\r\n$sql = \"UPDATE Orders SET OrderTotal = $oTotalCost WHERE OrderNumber = \'$ON\'\";\r\nmysql_query($sql);\r\n\r\n//\r\n//   Do the Mailing\r\n//\r\n$sql = \"SELECT o.*, b.Email FROM Orders o, Buyers b WHERE o.BuyerID = b.BuyerID AND o.OrderNumber = \'$ON\'\";\r\n$order = mysql_query($sql);\r\nlist(     $oBuyerID, $oUserID, $oDate, $OrderTotal,\r\n     $OrderNumber, $OrderStatus, $bName, $bAddress1, $bAddress2, $bCity, $bState,\r\n     $bZip, $bDayPhone, $bEvePhone, $bContact, $bPayMethod, $bCCType, $bCCNum,\r\n     $bCCExpire, $oOrderOptions, $oPaymentCycle, $oPaymentStatus, $bEmail\r\n) = mysql_fetch_row($order);\r\nmysql_free_result($order);\r\nlist($null, $null, $dDate) = split(\':\', $oDate);\r\nswitch ($oPaymentCycle) {\r\ncase \'O\': $PC = \'one time\'; break;\r\ncase \'W\': $PC = \'weekly subscription\'; break;\r\ncase \'M\': $PC = \'monthly subscription\'; break;\r\ncase \'Y\': $PC = \'yearly subscription\'; break;\r\n}\r\n\r\n$mail_buyer = \"\r\nOrder For: $bName\r\n$bAddress1\r\n$bAddress2\r\n$bCity $bZip, $bState\r\n\";\r\n\r\n$mail_order = \"\r\nOrder Number: $OrderNumber Date: $dDate\r\n Order Total: $OrderTotal ($PC)\r\n  Pay Method: $bPayMethod\r\n\";\r\n\r\n$mail_user_link = \"\r\nFor further Order details and status see:\r\n<a class=link-head href=\\\"$Web$Relative/receipt.php?ON=$OrderNumber&UID=$UserID\\\">$Web$Relative/receipt.php?ON=$OrderNumber&UID=$UserID</a>\r\n\";\r\n\r\n$mail_admin_link = \"\r\nFor further Order details and processing see:\r\n<a class=link-head href=\\\"$Web$Relative/admin/receipt.php?ON=$OrderNumber\\\">$Web$Relative/receipt.php?ON=$OrderNumber</a>\r\n\";\r\n\r\nMail($bEmail, \"Your Order\", \"$mail_company$mail_buyer$mail_order$mail_user_link$mail_footer\", \"From: $Email\");\r\nMail($Email, \"New Order\", \"$mail_buyer$mail_order$mail_admin_link$mail_footer\", \"From: $Email\");\r\n} // end while\r\nmysql_free_result($cart);\r\n\r\nmysql_query(\"DELETE FROM CartItems WHERE UserID = \'$UserID\'\");\r\n\r\n$ONlist = implode(\',\',$ONset);\r\n$UID = $UserID;\r\n\r\n//\r\n// View New Orders\r\n//\r\ncommonHeader(\'\',\'\');\r\n\r\n$wset[] = \"o.BuyerID = b.BuyerID\";\r\n$wset[] = \"b.UserID = \'$UID\'\";\r\n$wset[] = \"o.OrderNumber IN ($ONlist)\";\r\n\r\n$sql =    \"SELECT o.OrderNumber, o.Date, o.OrderTotal, o.OrderStatus, b.Name, o.PaymentCycle, o.bPayMethod, o.PaymentStatus \" .\r\n     \"FROM Orders o, Buyers b \" .\r\n     \"WHERE \" . implode(\' AND \', $wset) .\r\n     \"ORDER BY OrderNumber\";\r\n$result=mysql_query($sql);\r\n\r\nblueFont(\"Arial\",\"<B>Select the proper order to continue...</B><BR><BR>\");\r\necho \"<TABLE border=1>\";\r\necho \"<TR><TD>Ord#</td><td>Date</td><td>Buyer</td><td>Value</td><td>Payment Method</td><td>Payment Status</td><td>Status</td></tr>\";\r\n$i = 0;\r\nwhile (list($onumber, $odate, $ototal, $ostatus, $bname, $opaymentcycle, $opaymentmethod, $opaymentstatus) = mysql_fetch_row($result)) {\r\n     list($null,$null,$odate) = split(\':\',$odate);\r\n\r\n     switch ($opaymentcycle) {\r\n     case \'O\': $PC = \'one time\'; break;\r\n     case \'W\': $PC = \'weekly subscription\'; break;\r\n     case \'M\': $PC = \'monthly subscription\'; break;\r\n     case \'Y\': $PC = \'yearly subscription\'; break;\r\n     }\r\n\r\n     if ($opaymentstatus == 0) {\r\n          $opaymentstatus = \'Not Paid\';\r\n     } else {\r\n          $opaymentstatus = \'Paid\';\r\n     }\r\n\r\n     fontFace(\"Arial\",\"<TR><td>$onumber</td><td>$odate</td><td>$bname</td><td>$ototal ($PC)</td><td>$opaymentmethod</td><td>$opaymentstatus</td><td>$ostatus</td>\");\r\n     fontFace(\"Arial\",\"<td><A class=link-head href=$PHP_SELF?topic=receipt&ON=$onumber&UID=$UID>View</a></td>\");\r\n     fontFace(\"Arial\",\"</TR>\");\r\n     $i++;\r\n}\r\nmysql_free_result($result);\r\necho \"</TABLE>\";\r\n\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '31', 'receipt', 'include_temp (\"cart\");\r\n\r\n$sql =    \"SELECT o.BuyerID, o.UserID, o.Date, o.OrderTotal, o.OrderNumber, o.OrderStatus,\r\n     o.bName, o.bAddress1, o.bAddress2, o.bCity, o.bState, o.bZip, o.bDayPhone, o.bEvePhone,\r\n     o.bContact, o.bPayMethod, o.bCCType, o.bCCNum, o.bCCExpire, o.OrderOptions, o.PaymentCycle, o.PaymentStatus\r\n     FROM Orders o, Buyers b\r\n     WHERE o.BuyerID = b.BuyerID AND o.OrderNumber = $ON AND b.UserID = \'$UID\'\";\r\n$order = mysql_query($sql);\r\n\r\nif (!list($BuyerID, $UserID, $Date, $OrderTotal, $OrderNumber, $OrderStatus,\r\n     $bName, $bAddress1, $bAddress2, $bCity, $bState, $bZip, $bDayPhone, $bEvePhone,\r\n     $Contact, $PayMethod, $CCType, $CCNum, $CCExpire, $OrderOptions, $PaymentCycle, $PaymentStatus\r\n     ) = mysql_fetch_row($order)) {\r\n     commonHeader(\"$Company\",\"Your receipt - Thank You!\");\r\n     echo \"No such Order (check proper login)\";\r\n     commonFooter($Relative,$UID);\r\n     exit;\r\n}\r\nmysql_free_result($order);\r\n$BNa=$bName;\r\n$BA1=$bAddress1;\r\n$BA2=$bAddress2;\r\n$BCi=$bCity;\r\n$BSt=$bState;\r\n$BZi=$bZip;\r\n$BDP=$bDayPhone;\r\n$BEP=$bEvePhone;\r\n$BCo=$Contact;\r\n$BPM=$PayMethod;\r\n$BCT=$CCType;\r\n$BCN=$CCNum;\r\n$BCE=$CCExpire;\r\n\r\ncommonHeader(\"$Company\",\"Your receipt - Thank You!\");\r\n\r\nblueFont(\"Arial\",\"<b>This is your receipt.  Please print this receipt for your records.</b><br><br>\");\r\n\r\nblueFont(\"Arial\",\"<b>Order Number: </b>\");\r\nredFont (\"Arial\",\"$OrderNumber<br>\");\r\n\r\nblueFont(\"Arial\",\"<b>Order Status: </b>\");\r\nredFont (\"Arial\",\"$OrderStatus<br><br>\");\r\n\r\necho \"<table border=\'0\' cellpadding=\'5\' cellspacing=\'5\' width=\'550\'><tr>\";\r\necho \"<td valign=\'top\' align=\'right\'>\";\r\nif ($PayMethod == \"Check\") {\r\nfontFace(\"Arial\",\"<b>Make check payable to:     </b><br>\");\r\n} else {\r\necho \"\";\r\n}\r\nfontFace(\"Comic Sans MS,Arial\",\"$Company<br>\");\r\nif ($PayMethod == \"Check\") {\r\nfontFace(\"Arial\",\"<b>Send check to:     </b><br>\");\r\n} else {\r\necho \"\";\r\n}\r\nfontFace(\"Arial\",\"$Address1<br>$Address2<br>\");\r\nfontFace(\"Arial\",\"$City $State, $Zip<br>\");\r\nif ($Phone == \"\" ) {\r\necho \"\";\r\n} else {\r\nfontFace(\"Arial\",\"<b>Phone:</b> $Phone<br>\");\r\n}\r\nif ($Web == \"\" ) {\r\necho \"\";\r\n} else {\r\nfontFace(\"Arial\",\"<b>World Wide Web:</b> $Web<br>\");\r\n}\r\nif ($Email == \"\" ) {\r\necho \"\";\r\n} else {\r\nfontFace(\"Arial\",\"<b>E-mail:</b> $Email<br>\");\r\n}\r\n\r\n$ODa=$Date;\r\n\r\n$pieces=explode(\":\",$ODa);\r\n\r\nfontFace(\"Arial\",\"<b>Order Date:</b> $pieces[2]\");\r\necho \"</td></tr><tr><td valign=\'top\' align=\'left\'>\";\r\n\r\nfontSize(\"+2\",\"\",\"Arial\",\"Order For:<br>\");\r\nfontFace(\"Arial\",\"$BNa<br>\");\r\nfontFace(\"Arial\",\"<b>Address:</b> $BA1<br>\");\r\nif ($BA2 != \"\") {\r\nfontFace(\"Courier\",\"        \");\r\nfontFace(\"Arial\",\" $BA2<br>\");\r\n}\r\nfontFace(\"Courier\",\"        \");\r\nfontFace(\"Arial\",\" $BCi $BSt, $BZi<br>\");\r\nif ($BDP != \"\") {\r\nfontFace(\"Arial\",\" $BDP<br>\");\r\n}\r\nif ($BEP != \"\") {\r\nfontFace(\"Arial\",\" $BEP<br>\");\r\n}\r\nif ($BEm != \"\") {\r\nfontFace(\"Arial\",\" $BEm<br>\");\r\n}\r\necho \"</td></tr></table>\";\r\n\r\nblueFont(\"Arial\",\"<b>You have ordered the following items...</b><br><br>\");\r\n\r\necho  \"<table border=\'1\' cellpadding=\'5\' cellspacing=\'5\'><tr>\";\r\necho  \"<th>\";\r\nredFont( \"Arial\", \"Product Code\");\r\necho  \"</th>\";\r\necho  \"<th>\";\r\nredFont( \"Arial\", \"Product Name\");\r\necho  \"</th>\";\r\necho  \"<th>\";\r\nredFont( \"Arial\", \"Product Options\");\r\necho  \"</th>\";\r\necho  \"<th>\";\r\nredFont( \"Arial\", \"Quantity\");\r\necho  \"</th>\";\r\necho  \"<th>\";\r\nredFont( \"Arial\", \"Cost\");\r\necho  \"</th>\";\r\necho  \"<th>\";\r\nredFont( \"Arial\", \"Shipping\");\r\necho  \"</th>\";\r\necho  \"<th>\";\r\nredFont( \"Arial\", \"Total\");\r\necho  \"</th>\";\r\necho  \"</th></tr>\";\r\n\r\n$result=mysql_query(\"SELECT * FROM Receipts WHERE OrderNumber=\'$OrderNumber\'\");\r\nwhile ($row=mysql_fetch_row($result)) {\r\n$RBI=$row[0];\r\n$RUI=$row[1];\r\n$RON=$row[2];\r\n$RDa=$row[3];\r\n$RII=$row[4];\r\n$RIS=$row[5];\r\n$RIN=$row[6];\r\n$RIC=$row[7];\r\n$RSC=$row[8];\r\n$RIQ=$row[9];\r\n$RTC=$row[10];\r\n$ITO=nl2br($row[11]).\' \';\r\n$IPC=$row[12];\r\n\r\nswitch ($IPC) {\r\ncase \'O\': $PC = \'one time\'; break;\r\ncase \'W\': $PC = \'weekly subscription\'; break;\r\ncase \'M\': $PC = \'monthly subscription\'; break;\r\ncase \'Y\': $PC = \'yearly subscription\'; break;\r\n}\r\n\r\n$total=$total+$RTC;\r\necho \"<tr><td>\";\r\nblueFont(\"Arial\",\"$RIS\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$RIN\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$ITO\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$RIQ\");\r\necho \"</td><td>\";\r\n$RIC=number_format($RIC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"$$RIC ($PC)\");\r\necho \"</td><td>\";\r\n$RSC=number_format($RSC,\"2\",\".\",\"thousands_sep\");\r\nif ($RSC == \"0.00\") {\r\n$ES = \"1\";\r\nfontSize(\"-1\",\"blue\",\"Arial\",\"$NoShipping\");\r\n} else {\r\nblueFont(\"Arial\",\"$$RSC\"); }\r\necho \"</td><td>\";\r\n$NRTC=number_format($RTC,\"2\",\".\",\"thousands_sep\");\r\nif ($RSC == \"0.00\") {\r\nblueFont(\"Arial\",\"$$NRTC\");\r\nfontSize(\"-1\",\"blue\",\"Arial\",\" Plus Shipping\");\r\n} else {\r\nblueFont(\"Arial\",\"$$NRTC\"); }\r\necho \"</td></tr>\";\r\n}\r\n\r\n$Tot=number_format($total,\"2\",\".\",\"thousands_sep\");\r\necho \"<tr><td colspan=\\\"4\\\"></td><td>\";\r\nredFont(\"Arial\",\"<b><i>Total:</i></b>\");\r\necho \"</td><td>\";\r\nif ($ES == \"1\") {\r\nblueFont(\"Arial\",\"<b>$$Tot</b>\");\r\nfontSize(\"-1\",\"blue\",\"Arial\",\" Plus Shipping\");\r\n} else {\r\nblueFont(\"Arial\",\"<b>$$Tot</b>\"); }\r\necho \"</td></tr>\";\r\n\r\necho \"</table>\";\r\n\r\nif (!empty($OrderOptions)) {\r\n     blueFont(\"Arial\",\"<br><br><b>Order Options</b><br>\");\r\n     echo nl2br($OrderOptions);\r\n}\r\n\r\nif ($PM == \"Check\") {\r\nblueFont(\"Arial\",\"<p>You have elected to pay via \");\r\nredFont (\"Arial\",\"Check or Money Order\");\r\nblueFont(\"Arial\",\".<br>We will ship the products you ordered upon receipt of your payment.<br>\");\r\n} elseif ($PM == \"Credit\") {\r\nblueFont(\"Arial\",\"<p>You have elected to pay via \");\r\nredFont (\"Arial\",\"$CT\");\r\nblueFont(\"Arial\",\" credit card.<br>We will ship the products you ordered upon credit approval.<br>\");\r\n} elseif ($PM == \"Other\") {\r\nblueFont (\"Arial\",\"<p>We will contact you to make payment arrangements.<br>\");\r\n}\r\n\r\nif (($PaymentStatus == 0) && ($PayMethod == \'PayPal\')) {\r\n     list($bFirstName, $bLastName) = split(\' \', $bName, 2);\r\n     $day_phone_a = substr($bDayPhone,0,3);\r\n     $day_phone_b = substr($bDayPhone,3,3);\r\n     $day_phone_c = substr($bDayPhone,6,4);\r\n\r\n     $night_phone_a = substr($bEvePhone,0,3);\r\n     $night_phone_b = substr($bEvePhone,3,3);\r\n     $night_phone_c = substr($bEvePhone,6,4);\r\n\r\n     $bState = strtoupper($bState); \r\n\r\n     $topaypal =\r\n     \"<FORM ACTION=\\\"https://www.paypal.com/cgi-bin/webscr\\\" METHOD=\\\"POST\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"cmd\\\" VALUE=\\\"_ext-enter\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"redirect_cmd\\\" VALUE=\\\"_xclick\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"business\\\" VALUE=\\\"$Email\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"no_note\\\" VALUE=\\\"1\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"no_shipping\\\" VALUE=\\\"1\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"item_name\\\" VALUE=\\\"Item Order\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"item_number\\\" VALUE=\\\"$OrderNumber\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"first_name\\\" VALUE=\\\"$bFirstName\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"last_name\\\" VALUE=\\\"$bLastName\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"address1\\\" VALUE=\\\"$bAddress1\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"address2\\\" VALUE=\\\"$bAddress2\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"city\\\" VALUE=\\\"$bCity\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"state\\\" VALUE=\\\"$bState\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"zip\\\" VALUE=\\\"$bZip\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"night_phone_a\\\" VALUE=\\\"$night_phone_a\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"night_phone_b\\\" VALUE=\\\"$night_phone_b\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"night_phone_c\\\" VALUE=\\\"$night_phone_c\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"day_phone_a\\\" VALUE=\\\"$day_phone_a\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"day_phone_b\\\" VALUE=\\\"$day_phone_b\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"day_phone_c\\\" VALUE=\\\"$day_phone_c\\\">\r\n     \";\r\n\r\n     if ($IPC == \'O\') {\r\n          $topaypal .=\r\n          \"<INPUT TYPE=\\\"hidden\\\" NAME=\\\"redirect_cmd\\\" VALUE=\\\"_xclick\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"item_name\\\" VALUE=\\\"Item Order $OrderNumber\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"amount\\\" VALUE=\\\"$OrderTotal\\\">\r\n          \";\r\n     } else {\r\n          $topaypal .=\r\n          \"<INPUT TYPE=\\\"hidden\\\" NAME=\\\"redirect_cmd\\\" VALUE=\\\"_xclick-subscriptions\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"item_name\\\" VALUE=\\\"Subscription Order $OrderNumber\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"a3\\\" VALUE=\\\"$OrderTotal\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"p3\\\" VALUE=\\\"1\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"t3\\\" VALUE=\\\"$IPC\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"sra\\\" VALUE=\\\"1\\\">\r\n          <INPUT TYPE=\\\"hidden\\\" NAME=\\\"src\\\" VALUE=\\\"1\\\">\r\n          \";\r\n     }\r\n\r\n     $topaypal .=\r\n     \"<INPUT TYPE=\\\"image\\\" SRC=\\\"http://images.paypal.com/images/x-click-but01.gif\\\" BORDER=\\\"0\\\" NAME=\\\"submit\\\" ALT=\\\"PayPal\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"return\\\" VALUE=\\\"http://$SERVER_NAME/$PHP_SELF?topic=thankyou.php?ON=$OrderNumber&UID=$UID\\\">\r\n     <INPUT TYPE=\\\"hidden\\\" NAME=\\\"cancel_return\\\" VALUE=\\\"http://$SERVER_NAME/$PHP_SELF?topic=cancel.php?ON=$OrderNumber&UID=$UID\\\">\r\n     </FORM>\r\n     \";\r\n\r\n     echo $topaypal;\r\n}\r\n\r\nif ($Contact == \'1\') {\r\nblueFont(\"Arial\",\"<p>We will contact you before fulfilling this order.<br>\");\r\n} else {\r\necho \"\";\r\n}\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '32', 'view_orders', 'include_temp(\"cart\");\r\n\r\n$wset[] = \"o.BuyerID = b.BuyerID\";\r\n$wset[] = \"b.UserID = \'$UID\'\";\r\nif (!empty($ON))\r\n     $wset[] = \"o.OrderNumber IN ($ON)\";\r\n\r\n$sql =    \"SELECT o.OrderNumber, o.Date, o.OrderTotal, o.OrderStatus, b.Name, o.PaymentCycle, o.bPayMethod, o.PaymentStatus \" .\r\n     \"FROM Orders o, Buyers b \" .\r\n     \"WHERE \" . implode(\' AND \', $wset) .\r\n     \"ORDER BY OrderNumber\";\r\n$result=mysql_query($sql);\r\nif (mysql_num_rows($result) == 0) {\r\n     commonHeader(\'\',\'\');\r\n     blueFont(\"Arial\",\"<B><br>You have no orders. Please check proper login</b><br><br>\");\r\n     commonFooter($Relative,$UID);\r\n     exit;\r\n}\r\n\r\ncommonHeader(\'\',\'\');\r\n\r\nblueFont(\"Arial\",\"<B><br>Select the proper order to continue...</B><BR><BR>\");\r\necho \"<TABLE border=1>\";\r\necho \"<TR><TD>Ord#</td><td>Date</td><td>Buyer</td><td>Value</td><td>Payment Method</td><td>Payment Status</td><td>Status</td></tr>\";\r\n$i = 0;\r\nwhile (list($onumber, $odate, $ototal, $ostatus, $bname, $opaymentcycle, $opaymentmethod, $opaymentstatus) = mysql_fetch_row($result)) {\r\n     list($null,$null,$odate) = split(\':\',$odate);\r\n\r\n     switch ($opaymentcycle) {\r\n     case \'O\': $PC = \'one time\'; break;\r\n     case \'W\': $PC = \'weekly subscription\'; break;\r\n     case \'M\': $PC = \'monthly subscription\'; break;\r\n     case \'Y\': $PC = \'yearly subscription\'; break;\r\n     }\r\n\r\n     if ($opaymentstatus == 0) {\r\n          $opaymentstatus = \'Not Paid\';\r\n     } else {\r\n          $opaymentstatus = \'Paid\';\r\n     }\r\n\r\n     fontFace(\"Arial\",\"<TR><td>$onumber</td><td>$odate</td><td>$bname</td><td>$ototal ($PC)</td><td>$opaymentmethod</td><td>$opaymentstatus</td><td>$ostatus</td>\");\r\n     fontFace(\"Arial\",\"<td><A href=$PHP_SELF?topic=receipt&ON=$onumber&UID=$UID>View</a></td>\");\r\n     fontFace(\"Arial\",\"</TR>\");\r\n     $i++;\r\n}\r\nmysql_free_result($result);\r\necho \"</TABLE>\";\r\n\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '33', 'search_form', 'include_temp(\"cart\");\r\n\r\ncommonHeader(\"$Company\",\"Product description\");\r\n\r\necho \"<center><br><br><br>\";\r\necho \"<TABLE align=right border=0 cellPadding=0 cellSpacing=0>\";\r\necho \"<FORM action=\\\"$PHP_SELF\\\" method=get>\";\r\necho \"<TBODY><TR vAlign=center><TD>Search for...<BR></TD><TD>\";\r\necho \"<SELECT class=input2 name=search_cat>\"; \r\necho \"<OPTION selected value=all>All Categories</OPTION>\";\r\n      $res=mysql_query(\"SELECT * FROM Category\");\r\n          $rows=mysql_num_rows($res);\r\n          for ($i=0; $i<$rows;$i++) {\r\n                $name=mysql_result($res, $i, \'Category\');\r\n                $id=mysql_result($res, $i, \'CategoryID\');\r\n                echo \"<OPTION value=$id>$name</OPTION>\";\r\n          }\r\necho \"</SELECT><BR></TD><TD> <BR></TD><TD>\";\r\necho \"<INPUT type=hidden name=topic value=search>\";\r\necho \"<INPUT class=input2 name=search_term size=15><BR></TD>\r\n<TD> <BR></TD><TD>\";\r\necho \"<input class=input type=submit name=\\\"Search\\\" value=\\\"Go!\\\">\";\r\necho \"<BR></TD></TR></FORM></TBODY></TABLE></center>\";\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '34', 'cart', 'error_reporting(0);\r\n\r\n/* Replace these variables with information about your company */\r\n$Company =\'Your Company\';\r\n$Address1=\'555 Any St.\';\r\n$Address2=\'PO Box 3\';\r\n$City    =\'AnyTown\';\r\n$State   =\'OR\';\r\n$Zip     =\'97777\';\r\n$Phone   =\'(777) 555-1212\';\r\n$Web     =\'http://www.site.shockwavedesigns.com\';\r\n$Email   =\'sales@superchargedsoftware.com\';\r\n\r\n$NoShipping = \'Shipping Extra\';\r\n$MailHeader = \'Mail Header\';\r\n$MailFooter = \'Mail Footer\';\r\n\r\n\r\n/* Replace these variables with information for connecting to your database server */\r\n\r\n$DBHost=\'localhost\';\r\n$DBUser=\'wave\';\r\n$DBPass=\'kalendy\';\r\n$DBName=\'wave\';\r\n\r\n\r\n/* Replace these variables with the absolute and relative paths to your MyCart scripts */\r\n/*\r\n$WebRoot=\"/local/htdocs/apps/cart\";\r\n$Relative=\"/apps/cart\";\r\n/*/\r\n$WebRoot=\"/usr/local/plesk/apache/vhosts/test2.shockwave1.com/httpdocs\";\r\n$Relative=\"/\";\r\n\r\n\r\n$WebHost=\'www.test2.shockwave1.com\';\r\n$Panel=\'panel\';\r\n$images=\'/usr/local/plesk/apache/vhosts/test2.shockwave1.com/httpdocs/images\';\r\n$image=\'http://www.test2.shockwave1.com/images\';\r\nfunction redFont($font,$text) {\r\necho \"<FONT FACE=\\\"$font\\\" COLOR=\\\"#000080\\\">$text</FONT>\";\r\n}\r\n\r\nfunction blueFont($font,$text) {\r\necho \"<FONT FACE=\\\"$font\\\" size=\\\"3\\\" COLOR=\\\"#000000\\\">$text</FONT>\";\r\n}\r\n\r\nfunction colorFont($color,$font,$text) {\r\necho \"<FONT FACE=\\\"$font\\\" COLOR=\\\"$color\\\">$text</FONT>\";\r\n}\r\n\r\nfunction fontFace($font,$text) {\r\necho \"<FONT FACE=\\\"$font\\\">$text</FONT>\";\r\n}\r\n\r\nfunction fontSize($size,$color,$font,$text) {\r\necho \"<FONT FACE=\\\"$font\\\" COLOR=\\\"$color\\\" SIZE=\\\"$size\\\">$text</FONT>\";\r\n}\r\n\r\nfunction commonHeader($Company,$title) {\r\nglobal $Panel,$LoggedIn,$Relative,$UID,$d,$PHP_SELF;\r\ninclude(\"$Panel/panel.head\");\r\n\r\necho \"<CENTER>\";\r\nif (empty($LoggedIn)) {\r\n     fontFace(\"Arial\",\"<A class=link-head HREF=\\\"$PHP_SELF?topic=login&UID=$UID\\\">User Login</A>\");\r\n} else {\r\n     fontFace(\"Arial\",\"<A class=link-head HREF=\\\"$PHP_SELF?topic=home\\\">Logout</A>\");\r\n}\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A class=link-head HREF=\\\"$PHP_SELF?topic=store&UID=$UID\\\">Our Catalog</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A class=link-head HREF=\\\"$PHP_SELF?topic=viewCart&UID=$UID\\\">Your Cart</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A class=link-head HREF=\\\"$PHP_SELF?topic=userInfo&UID=$UID\\\">Check Out</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A class=link-head HREF=\\\"$PHP_SELF?topic=viewOrders&UID=$UID\\\">Your Account</A>\");\r\necho \"<BR>\";\r\n\r\nif (!empty($LoggedIn))\r\n     blueFont(\'Arial\', \"You are logged in as $LoggedIn<br><br>\");\r\n}\r\n\r\nfunction commonFooter($Relative,$UID) {\r\nglobal $Panel;\r\ninclude_temp (\"panel_foot\");\r\n}\r\n\r\nfunction adminHeader($Company,$title) {\r\nglobal $Panel,$Relative,$PHP_SELF,$d;\r\ninclude_temp(\"panel_head\");\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=buyerSearch.php\'>Buyers</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=searchReceipts.php\'>Receipts</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=category.php\'>Categories</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=updateItem.php\'>Items</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=itemOptions.php\'>Item Options</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=orderOptions.php\'>Order Options</A>\");\r\necho \'<br>\';\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=pictures.php\'>Pictures</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\'$PHP_SELF?topic=mailCompose.php\'>Mail to Buyers</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\\\"../../index.php?topic=home.php\\\">Catalog</A>\");\r\necho \'   |   \';\r\nfontFace(\"Arial\",\"<A HREF=\\\"$PHP_SELF?topic=home.php\\\">Cart Admin</A>\");\r\necho \'<br><br>\';\r\n}\r\n\r\nfunction adminFooter($Relative) {\r\nglobal $Panel;\r\ninclude_temp(\"panel_foot\");\r\n}\r\n\r\nfunction receiptHeader($Company,$title) {\r\necho \"<HTML><TITLE>$Company Receipt - $title</TITLE><BODY BGCOLOR=\\\"#FFFFFF\\\">\";\r\n}\r\n\r\nfunction receiptFooter($Company) {\r\nglobal $Panel;\r\necho \"<BR><BR><CENTER>\";\r\nfontFace(\"Arial\",\"Thank you for ordering from <B>$Company</B>\");\r\necho \"</CENTER><BR><BR>\";\r\ninclude_temp(\"panel_foot\");\r\n}\r\n\r\nmysql_connect($DBHost,$DBUser,$DBPass);\r\nmysql_select_db($DBName);\r\n\r\nif (!empty($UID)) {\r\n     $result = mysql_query(\"SELECT count(*) FROM Users WHERE User=\'$UID\'\");\r\n     $num = intval(mysql_result($result,0,0));\r\n     if ($num == 0)\r\n          $UID = \'\';\r\n}\r\n\r\nif (empty($UID)) {\r\n     $dt=date(\"YmdHis\");\r\n     $UID=\"$dt$REMOTE_ADDR\";\r\n     $date=date(\"z\");\r\n     mysql_query(\"INSERT INTO Users VALUES (\'$UID\',\'$date\')\");\r\n}\r\n\r\n$user = mysql_query(\"SELECT Name FROM Buyers WHERE UserID = \'$UID\'\");\r\nlist($LoggedIn) = mysql_fetch_row($user);\r\nmysql_free_result($user);', '1', '0');
INSERT INTO cort_temp VALUES ( '38', 'items', 'include_temp (\"cart\");\r\n\r\ncommonHeader(\"$Company\",\"<br><b><font size=2>Select an item below:</font></b><br><br>\");\r\n\r\n$cat=mysql_query(\"SELECT PagingStep FROM Category WHERE CategoryID=\'$CA\'\");\r\n$step=mysql_result($cat,0,0);\r\nmysql_free_result($cat);\r\n\r\nif (empty($ix))\r\n     $ix = 0;\r\n$size=$step+1;\r\n\r\n$result=mysql_query(\"SELECT * FROM Items WHERE Category=\'$CA\' ORDER BY ItemName LIMIT $ix,$size\");\r\n$size=mysql_num_rows($result);\r\nfontFace(\"Arial\",\"<br><b><font size=2>Select an item:</font></b><br><br>\");\r\necho \"<ul>\";\r\n$no=0;\r\nwhile ($row  =  mysql_fetch_row($result)) {\r\n$IS=$row[0];\r\n$IN=$row[1];\r\n$ID=$row[2];\r\n$IC=$row[3];\r\n$Ca=$row[4];\r\n$SC=$row[5];\r\n$II=$row[6];\r\nfontFace(\"Arial\",\"<li><a class=link-head href=\'$PHP_SELF?topic=description&II=$II&UID=$UID\'>$IN</a>\");\r\nif ($ID != \"\") {\r\nfontFace(\"Arial\",\" - $ID\"); }\r\necho \"</li>\";\r\n$no++;\r\nif ($no == $step)\r\n     break;\r\n}\r\necho \"</ul><br>\";\r\n\r\nif ($ix > 0) {\r\n     $prev=$ix-$step;\r\n     if ($prev<0)\r\n          $prev=0;\r\n     fontFace(\"Arial\",\"<a class=link-head href=\'$PHP_SELF?topic=items&CA=$CA&ix=$prev&UID=$UID\'>&lt;&lt; prev</a>\");\r\n}    \r\n\r\necho \'&nbsp;&nbsp;&nbsp;\';\r\n\r\nif ($no < $size) {\r\n     $next=$ix+$step;\r\n     fontFace(\"Arial\",\"<a class=link-head href=\'$PHP_SELF?topic=items&CA=$CA&ix=$next&UID=$UID\'>next &gt;&gt;</a>\");\r\n}    \r\n\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '35', 'panel_head', '<TABLE border=0 cellPadding=0 cellSpacing=0 width=\"100%\">\r\n        <TBODY>\r\n        <TR>\r\n          <TD width=\"100%\"><div align=center valign=middle>\r\n', '0', '0');
INSERT INTO cort_temp VALUES ( '36', 'panel_foot', '</TD></TR></TBODY></TABLE>\r\n                </CENTER>\r\n', '0', '0');
INSERT INTO cort_temp VALUES ( '37', 'store', 'include_temp (\"cart\");\r\n\r\nif (isset($Login)) {\r\n\r\n$OID = $UID;\r\n$buyer = mysql_query(\"SELECT UserID, Name FROM Buyers WHERE Email = \'$email\' AND Pass = \'$pass\'\");\r\n\r\nif (mysql_num_rows($buyer) == 0) {\r\n     commonHeader(\'\', \'\');\r\n     redFont(\'Arial\', \'<b>Email does not exist or password is not correct</b>\');\r\n     commonFooter($Relative, $UID);\r\n     exit;\r\n} else {\r\n     list($UID, $LoggedIn) = mysql_fetch_row($buyer);\r\n     mysql_query(\"UPDATE Users SET User = \'$UID\' WHERE User = \'$OID\'\");\r\n     mysql_query(\"UPDATE CartItems SET UserID = \'$UID\' WHERE UserID = \'$OID\'\");\r\n}\r\nmysql_free_result($buyer);\r\n\r\n} // isset($Login)\r\n\r\n\r\ncommonHeader(\"$Company\",\"Select a category\");\r\n\r\n$result=mysql_query(\"SELECT * FROM Category ORDER BY Category\");\r\nfontFace(\"Arial\",\"<font size=2><b><br>Select from one of our categories below:<b></font><br><br>\");\r\necho \'<ul>\';\r\nwhile (list($Cat, $CatID)  =  mysql_fetch_row($result)) {\r\n     fontFace(\"Arial\",\"<li><a class=link-login2 href=\'$PHP_SELF?topic=items&CA=$CatID&UID=$UID\'>$Cat</a></li>\");\r\n}\r\necho \'</ul>\';\r\nmysql_free_result($result);\r\n\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '39', 'description', 'include_temp(\"cart\");\r\n\r\ncommonHeader(\"$Company\",\"Product description\");\r\n\r\n$result=mysql_query(\"SELECT * FROM Items WHERE ItemID=\'$II\'\");\r\n\r\necho \"<table border=\'0\' cellpadding=\'10\' cellspacing=\'10\'>\";\r\n\r\nwhile ($row = mysql_fetch_row($result)) {\r\n$IS=$row[0];\r\n$IN=$row[1];\r\n$ID=$row[2];\r\n$IC=$row[3];\r\n$Ca=$row[4];\r\n$SC=$row[5];\r\n$II=$row[6];\r\n$IG=$row[7];\r\n$PC=$row[8];\r\n}\r\nmysql_free_result($result);\r\n\r\nswitch ($PC) {\r\ncase \'O\': $PC = \'one time\'; break;\r\ncase \'W\': $PC = \'weekly subscription\'; break;\r\ncase \'M\': $PC = \'monthly subscription\'; break;\r\ncase \'Y\': $PC = \'yearly subscription\'; break;\r\n}\r\n\r\nblueFont(\"Arial\",\"<br><b> $IN </b><br>\");\r\n\r\nif (!empty($IG)) {\r\n     echo \"<tr><td></td><td></td><td rowspan=\\\"5\\\" valign=\\\"bottom\\\">\";\r\n     echo \"<p><br><p><br>$IG</td></tr>\";\r\n}\r\n\r\n\r\necho \"<tr><td>\";\r\nredFont (\"Arial\",\"Product Code: \");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\" $IS\");\r\necho \"</td><td></td></tr>\";\r\necho \"<tr><td>\";\r\nredFont (\"Arial\",\"Product Name: \");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\" $IN\");\r\necho \"</td><td></td></tr>\";\r\necho \"<tr><td>\";\r\nredFont (\"Arial\",\"Price: \");\r\necho \"</td><td>\";\r\n$NC=number_format($IC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\" $$NC ($PC)\");\r\necho \"</td><td></td></tr><tr><td>\";\r\nredFont (\"Arial\",\"Shipping: \");\r\necho \"</td><td>\";\r\nif ($SC == \"0.00\") {\r\nblueFont(\"Arial\",\" $NoShipping\");\r\n} else {\r\n$SC=number_format($SC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\" $$SC\");\r\n}\r\necho \"</td><td></td></tr>\";\r\necho \"<tr><td>\";\r\nif ($ID != \"\") {\r\nredFont (\"Arial\",\"Description: \"); }\r\necho \"</td><td colspan=\'2\'>\";\r\nblueFont(\"Arial\",\" $ID\");\r\necho \"</td></tr>\";\r\n\r\necho \"</table>\";\r\n\r\necho \"<FORM ACTION=\\\"$PHP_SELF?topic=viewCart\\\" METHOD=\\\"POST\\\">\";\r\n\r\necho \'<table>\';\r\n$result=mysql_query(\"SELECT OptionID, OptionName, OptionType FROM ItemOption WHERE ItemID = $II ORDER BY OptionID\");\r\nwhile (list($OptionID, $OptionName, $OptionType)=mysql_fetch_row($result)) {\r\n     echo \"<tr><td valign=top>$OptionName</td><td valign=top>\";\r\n\r\n     $option_value = \'OV_\' . ereg_replace(\" \", \"_\", $OptionName);\r\n     switch ($OptionType) {\r\n     case \'text\':\r\n          echo \"<input type=\\\"text\\\" name=\\\"$option_value\\\">\";\r\n          break;\r\n     case \'textarea\':\r\n          echo \"<textarea rows=\\\"3\\\" cols=\\\"40\\\" name=\\\"$option_value\\\"></texta\";\r\n\t\t\techo \"rea>\";\r\n          break;\r\n     case \'select\':\r\n          echo \"<select name=\\\"$option_value\\\">\";\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<option value=\\\"$vname\\\"> $vname\";\r\n          }\r\n          mysql_free_result($ov);\r\n          echo \'</select>\';\r\n          break;\r\n     case \'selectm\':\r\n          echo \"<select name=\\\"${option_value}[]\\\" size=\\\"5\\\" multiple>\";\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<option value=\\\"$vname\\\"> $vname\";\r\n          }\r\n          mysql_free_result($ov);\r\n          echo \'</select>\';\r\n          break;\r\n     case \'checkbox\':\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<input name=\\\"${option_value}[]\\\" type=\\\"checkbox\\\" value=\\\"$vname\\\"> $vname<br>\";\r\n          }\r\n          mysql_free_result($ov);\r\n          break;\r\n     case \'radio\':\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<input name=\\\"${option_value}\\\" type=\\\"radio\\\" value=\\\"$vname\\\"> $vname<br>\";\r\n          }\r\n          mysql_free_result($ov);\r\n          break;\r\n     }\r\n\r\n     echo \'</td></tr>\';\r\n}\r\nmysql_free_result($result);\r\necho \'</table>\';\r\n\r\n\r\necho \"<table border=\\\"0\\\" cellpadding=\\\"5\\\" cellspacing=\\\"5\\\"><tr><td>\";\r\nblueFont(\"Arial\",\"<br><br><INPUT TYPE=\\\"checkbox\\\" NAME=\\\"ItemID\\\" VALUE=\\\"$II\\\" CHECKED> Add \");\r\nblueFont(\"Arial\",\"<INPUT TYPE=\\\"TEXT\\\" Name=\\\"ItemQuantity\\\" Value=\\\"1\\\" size=\\\"2\\\"> of\");\r\nblueFont(\"Arial\",\" this item to my shopping cart\");\r\necho \"<INPUT TYPE=\\\"hidden\\\" NAME=\\\"UID\\\" VALUE=\\\"$UID\\\">\";\r\n$Date=date(\"Y:z:Y-m-d\");\r\necho \"<input type=\\\"hidden\\\" name=\\\"Date\\\" value=\\\"$Date\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"CartItemsID\\\" value=\\\"\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"AddCart\\\" value=\\\"1\\\">\";\r\necho \"</td><td><br><br><INPUT TYPE=\\\"SUBMIT\\\" VALUE=\\\"Add This Item To My Cart\\\"></td></tr></table></FORM>\";\r\n\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '40', 'viewCart', '$i=0;\r\n$j=0;\r\ninclude_temp(\"cart\");\r\n\r\nif (isset($AddCart)) {\r\n     $result = mysql_query(\"SELECT OptionName, OptionType FROM ItemOption WHERE ItemID =\'$ItemID\'\");\r\n     $i = 0;\r\n     while (list($OptionName, $OptionType)=mysql_fetch_row($result)) {\r\n          $option_value = \'OV_\' . ereg_replace(\" \", \"_\", $OptionName);\r\n          $val = is_array($$option_value) ? implode(\', \', $$option_value) : $$option_value;\r\n          if (!empty($val)) {\r\n               $oset[$i] = \"$OptionName: $val\";\r\n               $i++;\r\n          }\r\n     }\r\n     mysql_free_result($result);\r\n\r\n     $ItemOptions = implode(\"\\n\", $oset);\r\n\r\n     mysql_query(\"INSERT INTO CartItems VALUES (\'$UID\',\'$ItemID\',\'$ItemQuantity\',\'$Date\',\'$CartItemsID\', \'$ItemOptions\')\");\r\n}\r\n\r\nif (isset($AddItem)) {\r\n     mysql_query(\"UPDATE CartItems SET ItemQuantity = ItemQuantity + $qty WHERE CartItemsID = $CartItemsID\");\r\n}\r\n\r\nif (isset($DelItem)) {\r\n     mysql_query(\"DELETE FROM CartItems WHERE CartItemsID = $CartItemsID\");\r\n}\r\n\r\nif (isset($Empty)) {\r\n     mysql_query(\"DELETE FROM CartItems WHERE UserID = \'$UID\'\");\r\n}\r\n\r\n$result=mysql_query(\"SELECT * FROM CartItems WHERE UserID=\'$UID\'\");\r\n$num=mysql_num_rows($result);\r\nif ($num == \"0\") {\r\ncommonHeader(\"$Company\",\"<font size=2><b><br>View the contents of your shopping cart</b></font>\");\r\nblueFont(\"Arial\",\"<b><br>Your shopping cart is empty</b><br><br>\");\r\n} else {\r\n\r\ncommonHeader(\"$Company\",\"<font size=2><b><br>View the contents of your shopping cart</b></font>\");\r\nblueFont(\"Arial\",\"<br><b>Your shopping cart contains the following items:</b><br><br>\");\r\n\r\necho \"<table border=\'1\' cellpadding=\'2\' cellspacing=\'2\' width=\'600\'><tr>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Name\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Options\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Qty\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Cost<br>Shipping\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Total\");\r\necho \"</th>\";\r\necho \"<th colspan=\'2\'>\";\r\nredFont(\"Arial\",\"Add/Remove\");\r\necho \"</th></tr>\";\r\n\r\n$result=mysql_query(\"SELECT * FROM CartItems WHERE UserID=\'$UID\'\");\r\nwhile ($row  =  mysql_fetch_row($result)) {\r\n$CUI=$row[0];\r\n$CII=$row[1];\r\n$CIQ=$row[2];\r\n$CDa=$row[3];\r\n$CCI=$row[4];\r\n$CIO=nl2br($row[5]).\'&nbsp;\';\r\n     $result2=mysql_query(\"SELECT * FROM Items WHERE ItemID=\'$CII\'\");\r\n     while ($row2=mysql_fetch_row($result2)) {\r\n     $IIS=$row2[0];\r\n     $IIN=$row2[1];\r\n     $IID=$row2[2];\r\n     $IIC=$row2[3];\r\n     $ICa=$row2[4];\r\n     $ISC=$row2[5];\r\n     $III=$row2[6];\r\n     $IGr=$row2[7];\r\n     $IPC=$row2[8];\r\n\r\n     switch ($IPC) {\r\n     case \'O\': $PC = \'one time\'; break;\r\n     case \'W\': $PC = \'weekly subscription\'; break;\r\n     case \'M\': $PC = \'monthly subscription\'; break;\r\n     case \'Y\': $PC = \'yearly subscription\'; break;\r\n     }\r\n\r\n$To[$i]=(($CIQ * $IIC)+($CIQ * $ISC));\r\necho \"<tr><td>\";\r\nblueFont(\"Arial\",\"$IIN\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",$CIO);\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$CIQ\");\r\necho \"</td><td>\";\r\n$IIC=number_format($IIC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"$$IIC ($PC)\");\r\necho \"<br>\";\r\nif ($ISC == \"0.00\") {\r\n     $ES=\"1\";\r\n     blueFont(\"Arial\\\" size=\\\"-2\",\"$NoShipping\");\r\n} else {\r\n     $ISC=number_format($ISC,\"2\",\".\",\"thousands_sep\");\r\n     blueFont(\"Arial\\\" size=\\\"-2\",\"$$ISC\");\r\n}\r\necho \"</td><td>\";\r\n$Tot=number_format($To[$i],\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"<b>$$Tot</b>\");\r\n\r\necho \"<td valign=\\\"center\\\"><center>\";\r\necho \"<FORM ACTION=\\\"$PHP_SELF?topic=viewCart\\\" METHOD=\\\"POST\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"AddItem\\\" value=\\\"1\\\">\";\r\necho \"<input type=\\\"text\\\" name=\\\"qty\\\" size=\\\"2\\\" value=\\\"1\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"CartItemsID\\\" value=\\\"$CCI\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"ItemName\\\" value=\\\"$IIN\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"UID\\\" value=\\\"$UID\\\">\";\r\necho \"<input type=\\\"SUBMIT\\\" NAME=\\\"SUBMIT\\\" value=\\\"Add\\\">\";\r\necho \"</form>\";\r\necho \"<br>\";\r\necho \"<FORM ACTION=\\\"$PHP_SELF?topic=viewCart\\\" METHOD=\\\"POST\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"DelItem\\\" value=\\\"1\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"CartItemsID\\\" value=\\\"$CCI\\\">\";\r\necho \"<input type=\\\"hidden\\\" name=\\\"UID\\\" value=\\\"$UID\\\">\";\r\necho \"<input type=\\\"SUBMIT\\\" NAME=\\\"SUBMIT\\\" value=\\\"Remove\\\">\";\r\necho \"</center></td></tr>\";\r\necho \"</form>\";\r\n$i++;\r\n        }\r\n}\r\n\r\nwhile ($j < $i) {\r\n$total+=$To[$j];\r\n$j++;\r\n}\r\n\r\necho \"<tr><td></td><td></td><td></td>\";\r\necho \"<td>\";\r\nredFont(\"Arial\",\"<center><b><i>Total Cost: </i></b></center>\");\r\necho \"<td>\";\r\n$total=number_format($total,\"2\",\".\",\"thousands_sep\");\r\nif ($ES == \"1\") {\r\nblueFont(\"Arial\",\"<b><center>$$total</b>\");\r\nblueFont(\"Arial\\\" size=\\\"-2\",\" Plus Shipping</center>\");\r\n} elseif ($ES != \"1\") {\r\nblueFont(\"Arial\",\"<b><center> $$total </center></b>\"); }\r\n\r\n\r\necho \"<td colspan=\\\"2\\\"><center>\";\r\necho \"<FORM ACTION=\\\"$PHP_SELF?topic=viewCart\\\" METHOD=\\\"POST\\\">\";\r\necho \"<input type=\\\"hidden\\\" NAME=\\\"Empty\\\" value=\\\"1\\\">\";\r\necho \"<input type=\\\"hidden\\\" NAME=\\\"UID\\\" value=\\\"$UID\\\">\";\r\necho \"<input type=\\\"SUBMIT\\\" NAME=\\\"SUBMIT\\\" value=\\\"Empty This Cart\\\">\";\r\necho \"</center></td></tr></table>\";\r\necho \"</form>\";\r\n\r\necho \"<br><br>\";\r\nfontSize(\"-1\",\"#cc0000\", \"Arial\",\"<center>HINT: \");\r\nfontSize(\"-1\",\"#000080\",\"Arial\",\"To add more of a particular item to your shopping cart, \");\r\nfontSize(\"-1\",\"#000080\",\"Arial\",\"click \\\"Add\\\" To remove an item from your cart, click \");\r\nfontSize(\"-1\",\"#cc0000\",\"Arial\",\"\\\"Remove\\\"</center>\");\r\n\r\necho \"<br><br>\";\r\necho \"<FORM ACTION=\\\"$PHP_SELF?topic=user_info\\\" METHOD=\\\"POST\\\">\";\r\necho \"<input type=\\\"hidden\\\" NAME=\\\"UID\\\" value=\\\"$UID\\\">\";\r\necho \"<input type=\\\"SUBMIT\\\" NAME=\\\"SUBMIT\\\" value=\\\" CHECKOUT \\\">\";\r\necho \"</form>\";\r\n}\r\n\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '41', 'viewOrders', 'include_temp(\"cart\");\r\n\r\n$wset[] = \"o.BuyerID = b.BuyerID\";\r\n$wset[] = \"b.UserID = \'$UID\'\";\r\nif (!empty($ON))\r\n     $wset[] = \"o.OrderNumber IN ($ON)\";\r\n\r\n$sql =    \"SELECT o.OrderNumber, o.Date, o.OrderTotal, o.OrderStatus, b.Name, o.PaymentCycle, o.bPayMethod, o.PaymentStatus \" .\r\n     \"FROM Orders o, Buyers b \" .\r\n     \"WHERE \" . implode(\' AND \', $wset) .\r\n     \"ORDER BY OrderNumber\";\r\n$result=mysql_query($sql);\r\nif (mysql_num_rows($result) == 0) {\r\n     commonHeader(\'\',\'\');\r\n     blueFont(\"Arial\",\"<B><br>You have no orders. Please check proper login</b><br><br>\");\r\n     commonFooter($Relative,$UID);\r\n     exit;\r\n}\r\n\r\ncommonHeader(\'\',\'\');\r\n\r\nblueFont(\"Arial\",\"<B><br>Select the proper order to continue...</B><BR><BR>\");\r\necho \"<TABLE border=1>\";\r\necho \"<TR><TD>Ord#</td><td>Date</td><td>Buyer</td><td>Value</td><td>Payment Method</td><td>Payment Status</td><td>Status</td></tr>\";\r\n$i = 0;\r\nwhile (list($onumber, $odate, $ototal, $ostatus, $bname, $opaymentcycle, $opaymentmethod, $opaymentstatus) = mysql_fetch_row($result)) {\r\n     list($null,$null,$odate) = split(\':\',$odate);\r\n\r\n     switch ($opaymentcycle) {\r\n     case \'O\': $PC = \'one time\'; break;\r\n     case \'W\': $PC = \'weekly subscription\'; break;\r\n     case \'M\': $PC = \'monthly subscription\'; break;\r\n     case \'Y\': $PC = \'yearly subscription\'; break;\r\n     }\r\n\r\n     if ($opaymentstatus == 0) {\r\n          $opaymentstatus = \'Not Paid\';\r\n     } else {\r\n          $opaymentstatus = \'Paid\';\r\n     }\r\n\r\n     fontFace(\"Arial\",\"<TR><td>$onumber</td><td>$odate</td><td>$bname</td><td>$ototal ($PC)</td><td>$opaymentmethod</td><td>$opaymentstatus</td><td>$ostatus</td>\");\r\n     fontFace(\"Arial\",\"<td><A href=$PHP_SELF?topic=receipt&ON=$onumber&UID=$UID>View</a></td>\");\r\n     fontFace(\"Arial\",\"</TR>\");\r\n     $i++;\r\n}\r\nmysql_free_result($result);\r\necho \"</TABLE>\";\r\n\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '42', 'userinfo', '$i=0;\r\n$j=0;\r\ninclude_temp(\"cart\");\r\n\r\n$result=mysql_query(\"SELECT * FROM CartItems WHERE UserID=\'$UID\'\");\r\nif (mysql_num_rows($result) == 0) {\r\n     commonHeader(\"$Company\",\"\");\r\n     blueFont(\"Arial\",\"<b><br>Your shopping cart is empty</b><br><br>\");\r\n     commonFooter($Relative,$UID);\r\n     exit;\r\n}\r\n\r\ncommonHeader(\"$Company\",\"May I have your information please?\");\r\n\r\nblueFont(\"Arial\",\"<br><b>Your shopping cart contains the following items:</b><br><br>\");\r\n\r\necho \"<table border=\'1\' cellpadding=\'2\' cellspacing=\'2\' width=\'600\'><tr>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Name\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Options\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Qty\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Cost<br>Shipping\");\r\necho \"</th>\";\r\necho \"<th>\";\r\nredFont(\"Arial\",\"Total\");\r\necho \"</th></tr>\";\r\n\r\nwhile ($row  =  mysql_fetch_row($result)) {\r\n$CUI=$row[0];\r\n$CII=$row[1];\r\n$CIQ=$row[2];\r\n$CDa=$row[3];\r\n$CCI=$row[4];\r\n$ITO=nl2br($row[5]).\'&nbsp;\';\r\n     $result2=mysql_query(\"SELECT * FROM Items WHERE ItemID=\'$CII\'\");\r\n     while ($row2=mysql_fetch_row($result2)) {\r\n     $IIS=$row2[0];\r\n     $IIN=$row2[1];\r\n     $IID=$row2[2];\r\n     $IIC=$row2[3];\r\n     $ICa=$row2[4];\r\n     $ISC=$row2[5];\r\n     $III=$row2[6];\r\n     $IPC=$row2[8];\r\n\r\n     switch ($IPC) {\r\n     case \'O\': $PC = \'one time\'; break;\r\n     case \'W\': $PC = \'weekly subscription\'; break;\r\n     case \'M\': $PC = \'monthly subscription\'; break;\r\n     case \'Y\': $PC = \'yearly subscription\'; break;\r\n     }\r\n\r\n\r\n$To[$i]=(($CIQ * $IIC)+($CIQ * $ISC));\r\necho \"<tr><td>\";\r\nblueFont(\"Arial\",\"$IIN\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$ITO\");\r\necho \"</td><td>\";\r\nblueFont(\"Arial\",\"$CIQ\");\r\necho \"</td><td>\";\r\n$IIC=number_format($IIC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"$$IIC ($PC)\");\r\necho \"<br>\";\r\nif ($ISC == \"0.00\") {\r\n$ES=\"1\";\r\nblueFont(\"Arial\\\" size=\\\"-2\",\"$NoShipping\");\r\n} else {\r\n$ISC=number_format($ISC,\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"$$ISC\");}\r\necho \"</td><td>\";\r\n$Tot=number_format($To[$i],\"2\",\".\",\"thousands_sep\");\r\nblueFont(\"Arial\",\"<b>$$Tot</b>\");\r\n\r\necho \"</tr>\";\r\n$i++;\r\n        }\r\n}\r\n\r\nwhile ($j < $i) {\r\n$total=$total+$To[$j];\r\n$j++;\r\n}\r\n\r\necho \"<tr><td></td><td></td><td></td>\";\r\necho \"<td>\";\r\nblueFont(\"Arial\",\"<center><b><i>Total Cost: </i></b></center>\");\r\necho \"<td>\";\r\n$total=number_format($total,\"2\",\".\",\"thousands_sep\");\r\nif ($ES == \"1\") {\r\nblueFont(\"Arial\",\"<b><center>$$total</b>\");\r\nblueFont(\"Arial\\\" size=\\\"-2\",\" Plus Shipping</center>\");\r\n} elseif ($ES != \"1\") {\r\nblueFont(\"Arial\",\"<b><center> $$total </center></b>\"); }\r\n\r\necho \"</tr></table>\";\r\necho \"</form>\";\r\n\r\necho \"<p>\";\r\n\r\necho \"<form action=\\\"$PHP_SELF?topic=order\\\" method=\\\"post\\\"><table border=\\\"0\\\"><tr><td>\";\r\n\r\necho \'<table><tr><td colspan=2>\';\r\n$result=mysql_query(\"SELECT OptionID, OptionName, OptionType FROM OrderOption ORDER BY OptionID\");\r\nif (mysql_num_rows($result) > 0)\r\n     redFont(\'Arial\', \'<b>Order Options</b>\');\r\necho \'</td></tr>\';\r\nwhile (list($OptionID, $OptionName, $OptionType)=mysql_fetch_row($result)) {\r\n     echo \"<tr><td valign=top>$OptionName</td><td valign=top>\";\r\n\r\n     $option_value = \'OV_\' . ereg_replace(\" \", \"_\", $OptionName);\r\n     switch ($OptionType) {\r\n     case \'text\':\r\n          echo \"<input type=\\\"text\\\" name=\\\"$option_value\\\">\";\r\n          break;\r\n     case \'textarea\':\r\n          echo \"<textarea rows=\\\"3\\\" cols=\\\"40\\\" name=\\\"$option_value\\\"></textarea>\";\r\n          break;\r\n     case \'select\':\r\n          echo \"<select name=\\\"$option_value\\\">\";\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<option value=\\\"$vname\\\"> $vname\";\r\n          }\r\n          mysql_free_result($ov);\r\n          echo \'</select>\';\r\n          break;\r\n     case \'selectm\':\r\n          echo \"<select name=\\\"${option_value}[]\\\" size=\\\"5\\\" multiple>\";\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<option value=\\\"$vname\\\"> $vname\";\r\n          }\r\n          mysql_free_result($ov);\r\n          echo \'</select>\';\r\n          break;\r\n     case \'checkbox\':\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<input name=\\\"${option_value}[]\\\" type=\\\"checkbox\\\" value=\\\"$vname\\\"> $vname<br>\";\r\n          }\r\n          mysql_free_result($ov);\r\n          break;\r\n     case \'radio\':\r\n          $ov = mysql_query(\"SELECT ValueID, ValueName FROM OrderOptionValue WHERE OptionID = $OptionID\");\r\n          while (list($vid, $vname) = mysql_fetch_row($ov)) {\r\n               echo \"<input name=\\\"${option_value}\\\" type=\\\"radio\\\" value=\\\"$vname\\\"> $vname<br>\";\r\n          }\r\n          mysql_free_result($ov);\r\n          break;\r\n     }\r\n\r\n     echo \'</td></tr>\';\r\n}\r\nmysql_free_result($result);\r\necho \'</table>\';\r\n\r\n\r\n$buyer = mysql_query(\"SELECT * FROM Buyers WHERE UserID = \'$UID\'\");\r\nif (!$buy = mysql_fetch_array($buyer)) {\r\n     blueFont(\'Arial\', \"<b><BR>If you previously bought from our site you can <a class=link-login href=$PHP_SELF?topic=login&UID=$UID>CLICK HERE</a> to login</b><br><br>\");\r\n}\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"<b>Please fill out the information below</b><p>\");\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your name<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"Name\\\" size=\\\"40\\\" value=\\\"$buy[Name]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your address<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"BuyAddress1\\\" size=\\\"40\\\" value=\\\"$buy[Address1]\\\"><br>\";\r\necho \"<input type=\\\"text\\\" name=\\\"BuyAddress2\\\" size=\\\"40\\\" value=\\\"$buy[Address2]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your city state and zip code<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"BuyCity\\\" size=\\\"25\\\" value=\\\"$buy[City]\\\">\";\r\necho \"&nbsp;&nbsp;<input type=\\\"text\\\" name=\\\"BuyState\\\" size=\\\"2\\\" MAXLENGTH=\\\"2\\\" value=\\\"$buy[State]\\\">\";\r\necho \"&nbsp;&nbsp;<input type=\\\"text\\\" name=\\\"BuyZip\\\" size=\\\"7\\\" maxlength=\\\"12\\\" value=\\\"$buy[Zip]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your e-mail address<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"BuyEmail\\\" size=\\\"40\\\" value=\\\"$buy[Email]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your Password<br>\");\r\necho \"<input type=\\\"password\\\" name=\\\"BuyPass\\\" size=\\\"10\\\" value=\\\"$buy[Pass]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Password Confirmation<br>\");\r\necho \"<input type=\\\"password\\\" name=\\\"BuyPassConf\\\" size=\\\"10\\\" value=\\\"$buy[Pass]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your daytime (work) phone number<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"DayPhone\\\" size=\\\"40\\\" value=\\\"$buy[DayPhone]\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"Your evening (home) phone number<br>\");\r\necho \"<input type=\\\"text\\\" name=\\\"EvePhone\\\" size=\\\"40\\\" value=\\\"$buy[EvePhone]\\\"><p>\";\r\n\r\necho \"<input type=\\\"radio\\\" name=\\\"save\\\" value=\\\"1\\\" checked> \";\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"UPDATE my Buyer Data<br>\");\r\necho \"<input type=\\\"radio\\\" name=\\\"save\\\" value=\\\"0\\\"> \";\r\nfontSize(\"2\",\"#000080\",\"Arial\",\"DO NOT update my Buyer Data<p>\");\r\n\r\nblueFont( \"Arial\\\" size=\\\"2\", \"Payment method<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"Check\\\">\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"Check or Money Order<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"Credit\\\" CHECKED>\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"Credit Card<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"PayPal\\\">\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"PayPal<br>\");\r\necho  \"<INPUT TYPE=\\\"radio\\\" NAME=\\\"PayMethod\\\" VALUE=\\\"Other\\\">\";\r\nredFont( \"Arial\\\" size=\\\"2\", \"Other, please call me\");\r\necho  \"<p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"Credit Card type<br>\");\r\necho  \"<input type=\\\"text\\\" name=\\\"CCType\\\" size=\\\"40\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"Credit Card number<br>\");\r\necho  \"<input type=\\\"text\\\" name=\\\"CCNum\\\" size=\\\"40\\\"><p>\";\r\n\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"Credit Card expiration date<br>\");\r\necho  \"<input type=\\\"text\\\" name=\\\"CCExpire\\\" size=\\\"40\\\"><p>\";\r\n\r\necho  \"<input type=\\\"checkbox\\\" name=\\\"Contact\\\" value=\\\"1\\\" CHECKED>\";\r\nfontSize(\"2\",\"#000080\",\"Arial\", \"&nbsp;&nbsp;Please contact me before filling this order<p>\");\r\n\r\n$Date=date(\"Y:z:Y-m-d\");\r\n$total=ereg_replace(\",\",\"\",$total);\r\necho \"<input type=\\\"hidden\\\" name=\\\"OrderTotal\\\" value=\\\"$total\\\">\r\n<input type=\\\"hidden\\\" name=\\\"Date\\\" value=\\\"$Date\\\">\r\n<input type=\\\"hidden\\\" name=\\\"UserID\\\" value=\\\"$UID\\\">\r\n<input type=\\\"hidden\\\" name=\\\"UID\\\" value=\\\"$UID\\\">\r\n<input type=\\\"hidden\\\" name=\\\"BuyerID\\\" value=\\\"\\\">\r\n<input type=\\\"hidden\\\" name=\\\"OrderNumber\\\" value=\\\"\\\">\r\n<input type=\\\"submit\\\" value=\\\"Complete This Order\\\"></form>\";\r\n\r\n\r\necho \"</td></tr></table>\";\r\ncommonFooter($Relative,$UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '43', 'login', 'include_temp(\"cart\");\r\n\r\ncommonHeader(\'\', \'\');\r\n\r\necho \"<form method=post action=\\\"$PHP_SELF?topic=store\\\">\r\n<input type=hidden name=UID value=\\\"$UID\\\">\r\n<table>\r\n<tr>\r\n     <td>\".blueFont(\'Arial\', \'Email Address:\').\"</td>\r\n     <td><input type=text name=email></td>\r\n</tr>\r\n<tr>\r\n     <td>\".blueFont(\'Arial\', \'Password:\').\"</td>\r\n     <td><input type=password name=pass></td>\r\n</tr>\r\n<tr>\r\n     <td>&nbsp;</td>\r\n     <td><input type=submit name=Login value=Login></td>\r\n</tr>\r\n<tr>\r\n     <td colspan=2>\r\n     <a href=\\\"$PHP_SELF?topic=mailPass\\\" target=\\\"_blank\\\">Forgot your password? Click Here!</a>\r\n     </td>\r\n</table>\r\n</form>\";\r\ncommonFooter($Relative, $UID);', '1', '1');
INSERT INTO cort_temp VALUES ( '44', 'mailPass', 'include_temp(\"cart\");\r\n\r\nif (isset($SendMail)) {\r\n     mysql_connect(\"$DBHost\",\"$DBUser\",\"$DBPass\");\r\n     $buyer = mysql(\"$DBName\",\"SELECT Pass FROM Buyers WHERE Email = \'$email\'\");\r\n     if (list($Pass) = mysql_fetch_row($buyer)) {\r\n          Mail($email, \'Your password\', \"$Pass\");\r\n          $msg = \"Password has been sent to $email\";\r\n     } else {\r\n          $msg = \"Email $email has not been found in our database\";\r\n     }\r\n     mysql_free_result($buyer);\r\n}\r\n\r\n\r\necho \"<center>\";\r\n\r\nredFont(\'Arial\', \"<b>$msg</b>\");\r\necho \"<br><br>\r\n<form method=post action=\\\"$PHP_SELF?topic=mailPass.php\\\">\r\nEnter your email here then press <b>Send Password</b><br>\r\n<input type=text name=email><br>\r\n<input type=submit name=SendMail value=\\\"Send Password\\\"><br>\r\n<a href=\\\"javascript:window.close()\\\">Close Window</a> \r\n</form>\";', '1', '1');
INSERT INTO cort_temp VALUES ( '46', 'products', '<table border=0 cellpadding=10><tr><td>\r\n<br><h3>Products</h3>\r\n<br><br>\r\n<p>Our high quality products description here\r\n<p><b>We propose:</b>\r\n<ul>\r\n<li>Fruits\r\n    <ul>\r\n    <li>Oranges\r\n    <li>Apples\r\n    <li>Mangos\r\n    </ul>\r\n<li>Beetles\r\n    <ul>\r\n    <li>Big beetles\r\n    <li>Green beetles\r\n    <li>Flying beetles\r\n    </ul>\r\n<li>Waters\r\n    <ul>\r\n    <li>Cold mineral water\r\n    <li>Water for tea\r\n    <li>Ice water\r\n    </ul>\r\n</ul>\r\n</td></tr></table>\r\n\r\n\r\n', '0', '1');


CREATE TABLE admin (
   id tinyint(4) unsigned NOT NULL auto_increment,
   username varchar(255) NOT NULL,
   password varchar(255) NOT NULL,
   PRIMARY KEY (id)
);

CREATE TABLE Buyers (
   Name varchar(100) NOT NULL,
   Address1 varchar(100) NOT NULL,
   Address2 varchar(100) NOT NULL,
   City varchar(100) NOT NULL,
   State char(2) NOT NULL,
   Zip varchar(20) NOT NULL,
   Email varchar(100) NOT NULL,
   DayPhone varchar(100) NOT NULL,
   EvePhone varchar(100) NOT NULL,
   Contact int(1) DEFAULT '0' NOT NULL,
   PayMethod varchar(100) NOT NULL,
   CCType varchar(100) NOT NULL,
   CCNum varchar(100) NOT NULL,
   CCExpire varchar(100) NOT NULL,
   OrderTotal decimal(8,2) DEFAULT '0.00' NOT NULL,
   Date varchar(100) NOT NULL,
   OrderNumber bigint(20) DEFAULT '0' NOT NULL,
   UserID varchar(100) NOT NULL,
   BuyerID bigint(20) NOT NULL auto_increment,
   Pass varchar(10) NOT NULL,
   PRIMARY KEY (BuyerID)
);

CREATE TABLE CartItems (
   UserID varchar(100) NOT NULL,
   ItemID varchar(25) NOT NULL,
   ItemQuantity int(4) DEFAULT '0' NOT NULL,
   Date varchar(100) NOT NULL,
   CartItemsID bigint(20) NOT NULL auto_increment,
   ItemOptions text,
   PRIMARY KEY (CartItemsID)
);

CREATE TABLE Category (
   Category varchar(100) NOT NULL,
   CategoryID bigint(20) NOT NULL auto_increment,
   PagingStep int(11) DEFAULT '10' NOT NULL,
   PRIMARY KEY (CategoryID)
);

INSERT INTO Category VALUES ( 'Fruits', '1', '20');
INSERT INTO Category VALUES ( 'Beetles', '2', '21');
INSERT INTO Category VALUES ( 'Waters', '3', '21');


CREATE TABLE ItemOption (
   OptionID int(11) NOT NULL auto_increment,
   ItemID int(11) DEFAULT '0' NOT NULL,
   OptionName varchar(100) NOT NULL,
   OptionType varchar(10) NOT NULL,
   PRIMARY KEY (OptionID)
);

CREATE TABLE Items (
   ItemSKU varchar(25) NOT NULL,
   ItemName varchar(100) NOT NULL,
   ItemDescription mediumtext NOT NULL,
   ItemCost decimal(7,2) DEFAULT '0.00' NOT NULL,
   Category bigint(20) DEFAULT '0' NOT NULL,
   ShippingCost decimal(6,2) DEFAULT '0.00' NOT NULL,
   ItemID bigint(20) NOT NULL auto_increment,
   ItemGraphic text,
   PaymentCycle char(1) DEFAULT 'O' NOT NULL,
   PRIMARY KEY (ItemID)
);

INSERT INTO Items VALUES ( '12345678', 'Orange', 'Smelly sweet orange oranges', '3.00', '1', '1.00', '1', '', 'O');
INSERT INTO Items VALUES ( '12345679', 'Apple', 'Green-green fresh apples from Russia', '8.00', '1', '14.00', '2', '', 'O');
INSERT INTO Items VALUES ( '12345680', 'Mango', 'Tropic fruit with a taste of desire', '44.00', '1', '23.00', '3', '', 'O');
INSERT INTO Items VALUES ( '12345681', 'Big Beetle', 'A big ugly beetle', '244.00', '2', '342.00', '4', '', 'O');
INSERT INTO Items VALUES ( '12345682', 'Green beetle', 'Pretty green beetle with red eyes', '1238.00', '2', '1.00', '5', '', 'O');
INSERT INTO Items VALUES ( '12345683', 'Flying beetle', 'Fast flying beetle. Very fast.', '19.00', '2', '12333.00', '6', '', 'M');
INSERT INTO Items VALUES ( '12345684', 'Cold mineral water', 'Deep underground placed mineral water', '154.00', '3', '1.00', '7', '', 'Y');
INSERT INTO Items VALUES ( '12345685', 'Water for tea', 'Hot water for tea', '14.00', '3', '4.00', '8', '', 'O');
INSERT INTO Items VALUES ( '12345686', 'Ice water', 'Cold water from Arctical icepoles', '34.00', '3', '4.00', '9', '', 'O');


CREATE TABLE OptionValue (
   ValueID int(11) NOT NULL auto_increment,
   OptionID int(11) DEFAULT '0' NOT NULL,
   ValueName varchar(100) NOT NULL,
   PRIMARY KEY (ValueID)
);

CREATE TABLE OrderOption (
   OptionID int(11) NOT NULL auto_increment,
   OptionName varchar(100) NOT NULL,
   OptionType varchar(10) NOT NULL,
   PRIMARY KEY (OptionID)
);

CREATE TABLE OrderOptionValue (
   ValueID int(11) NOT NULL auto_increment,
   OptionID int(11) DEFAULT '0' NOT NULL,
   ValueName varchar(100) NOT NULL,
   PRIMARY KEY (ValueID)
);

CREATE TABLE Orders (
   BuyerID bigint(20) DEFAULT '0' NOT NULL,
   UserID varchar(100) NOT NULL,
   Date varchar(100) NOT NULL,
   OrderTotal decimal(8,2) DEFAULT '0.00' NOT NULL,
   OrderNumber bigint(20) NOT NULL auto_increment,
   OrderStatus varchar(10) DEFAULT 'processing' NOT NULL,
   bName varchar(100) NOT NULL,
   bAddress1 varchar(100) NOT NULL,
   bAddress2 varchar(100) NOT NULL,
   bCity varchar(100) NOT NULL,
   bState char(2) NOT NULL,
   bZip varchar(20) NOT NULL,
   bDayPhone varchar(100) NOT NULL,
   bEvePhone varchar(100) NOT NULL,
   bContact int(1) DEFAULT '0' NOT NULL,
   bPayMethod varchar(100) NOT NULL,
   bCCType varchar(100) NOT NULL,
   bCCNum varchar(100) NOT NULL,
   bCCExpire varchar(100) NOT NULL,
   OrderOptions text,
   PaymentCycle char(1) DEFAULT 'O' NOT NULL,
   PaymentStatus int(11) DEFAULT '0' NOT NULL,
   PRIMARY KEY (OrderNumber)
);

CREATE TABLE Receipts (
   BuyerID bigint(20) DEFAULT '0' NOT NULL,
   UserID varchar(100) NOT NULL,
   OrderNumber bigint(20) DEFAULT '0' NOT NULL,
   Date varchar(100) NOT NULL,
   ItemID bigint(20) DEFAULT '0' NOT NULL,
   ItemSKU varchar(25) NOT NULL,
   ItemName varchar(100) NOT NULL,
   ItemCost decimal(7,2) DEFAULT '0.00' NOT NULL,
   ShippingCost decimal(6,2) DEFAULT '0.00' NOT NULL,
   ItemQuantity int(11) DEFAULT '0' NOT NULL,
   TotalCost decimal(8,2) DEFAULT '0.00' NOT NULL,
   ItemOptions text,
   PaymentCycle char(1) DEFAULT 'O' NOT NULL
);

CREATE TABLE Users (
   User varchar(100) NOT NULL,
   Date int(4) DEFAULT '0' NOT NULL
);
