<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Jipson Thomas<jipson.thomas@armiasystems.com>               |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com © 2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php

$imagefolder =  "../img";
$stylesfolder = "../css";
$sitestyle="Eyewears.css";
$logoimage="SiteLogo.gif";
$productname=" ";
session_start();
include("../../config/database.php");
$dba			= new DATABASE_CONFIG();
$dbuser			=	$dba->default["login"];
$dbpass			=	$dba->default["password"];
$dbhost 		=	$dba->default["host"];
$dbname			=	$dba->default["database"];
$TABLE_PREFIX	=	$dba->default["prefix"];
$conn			=	mysql_connect($dbhost,$dbuser,$dbpass);
mysql_select_db($dbname,$conn);
 ###################################################################################################
/* Section to upgrade from 1.0 to 1.1.......................*/
$sq1	="ALTER TABLE ".$TABLE_PREFIX."admins ADD `newsletter` VARCHAR( 255 ) NOT NULL DEFAULT '1',ADD `newsletterusers` VARCHAR( 255 ) NOT NULL DEFAULT '1',ADD `sentnewsletters` VARCHAR( 255 ) NOT NULL DEFAULT '1',ADD `giftcards` VARCHAR( 255 ) NOT NULL DEFAULT '1',ADD `giftcardusers` VARCHAR( 255 ) NOT NULL DEFAULT '1'";
$sq2	="ALTER TABLE ".$TABLE_PREFIX."carts ADD `type` VARCHAR( 150 ) NULL,ADD `price_type` CHAR( 1 ) NULL"; 
$sq3	="ALTER TABLE ".$TABLE_PREFIX."cmspages ADD `status` ENUM( 'Y', 'N' ) NOT NULL DEFAULT 'N'"; 
$sq4	="ALTER TABLE ".$TABLE_PREFIX."orders ADD `tracking_no` TEXT NOT NULL,ADD `label_pdf` TEXT NOT NULL";
$sq5	="ALTER TABLE ".$TABLE_PREFIX."order_details ADD `type` VARCHAR( 150 ) NULL, ADD `price_type` CHAR( 1 ) NULL";
$sq4	="ALTER TABLE ".$TABLE_PREFIX."orders ADD `tracking_no` TEXT NOT NULL,ADD `label_pdf` TEXT NOT NULL";
$sq89	="ALTER TABLE ".$TABLE_PREFIX."products ADD `wholesale_price` DECIMAL( 10, 2 ) NOT NULL";
$sq90	="ALTER TABLE ".$TABLE_PREFIX."products ADD `discount_type` VARCHAR( 5 )";
$sq91	="ALTER TABLE ".$TABLE_PREFIX."users ADD `reg_status` VARCHAR( 50 ) NOT NULL";
$sq92	="ALTER TABLE ".$TABLE_PREFIX."carts ADD `prodtype` VARCHAR( 20 )";
$sq93	="ALTER TABLE ".$TABLE_PREFIX."carts ADD `discount_type` VARCHAR( 5 ) ";
$sq94	="ALTER TABLE ".$TABLE_PREFIX."order_details ADD `discount_type` VARCHAR( 5 )";
$sq95	="ALTER TABLE ".$TABLE_PREFIX."order_details ADD `prodtype` VARCHAR( 20 )";
$sq6   ="drop table if exists ".$TABLE_PREFIX."giftcard_details";
$sq7   ="CREATE TABLE ".$TABLE_PREFIX."giftcard_details (`id` bigint(20) NOT NULL auto_increment,`user_id` bigint(20) NOT NULL default '0',
  		`order_id` bigint(20) NOT NULL default '0', `card_id` bigint(20) NOT NULL default '0', `card_code` text NOT NULL,
  		`amount` decimal(10,2) NOT NULL default '0.00',  `balance` decimal(10,2) NOT NULL default '0.00',  PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1";


$sq8   ="drop table if exists ".$TABLE_PREFIX."giftcards";
$sq9   ="CREATE TABLE ".$TABLE_PREFIX."giftcards ( `id` bigint(20) NOT NULL auto_increment, `gift_code` varchar(255) NOT NULL default '',
 		 `gift_amnt` decimal(10,2) NOT NULL default '0.00',  `from` date default '0000-00-00',  `to` date default '0000-00-00',
 		 `stock` bigint(20) NOT NULL default '0',  `status` char(1) NOT NULL default 'A',  `descr` text,
  		 `gift_img` varchar(255) NOT NULL default '',  PRIMARY KEY  (`id`),  KEY `code` (`gift_code`)) ENGINE=MyISAM DEFAULT CHARSET=latin1";


$sq10   ="drop table if exists ".$TABLE_PREFIX."giftcardusers";
$sq11   ="CREATE TABLE ".$TABLE_PREFIX."giftcardusers ( `id` bigint(20) NOT NULL auto_increment,  `user_id` bigint(20) NOT NULL default '0',
 		 `order_id` bigint(20) NOT NULL default '0',  `card_id` bigint(20) NOT NULL default '0',  `usercard_id` bigint(20) NOT NULL default '0',
  		 `date` varchar(20) NOT NULL default '',  `amnt_used` decimal(10,2) NOT NULL default '0.00',  PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1";


$sq12   ="drop table if exists ".$TABLE_PREFIX."newsletters";
$sq13   ="CREATE TABLE ".$TABLE_PREFIX."newsletters (`id` int(11) NOT NULL auto_increment, `title` varchar(255) NOT NULL default '',
  		`content` longtext NOT NULL,  `news_date` datetime NOT NULL default '0000-00-00 00:00:00',  PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1";


$sq14   ="drop table if exists ".$TABLE_PREFIX."newsletterusers";
$sq15   ="CREATE TABLE ".$TABLE_PREFIX."newsletterusers (`id` int(11) NOT NULL auto_increment, `uname` varchar(255) NOT NULL default '',
		  `email` varchar(255) NOT NULL default '', `sub_date` datetime NOT NULL default '0000-00-00 00:00:00', `status` enum('N','Y') NOT NULL default 'Y',
		  PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1";


$sq16   ="drop table if exists ".$TABLE_PREFIX."sent_newsletters";
$sq17   ="CREATE TABLE ".$TABLE_PREFIX."sent_newsletters (`id` bigint(20) NOT NULL auto_increment, `newsletter_id` bigint(20) NOT NULL default '0',
  		`user_id` bigint(20) NOT NULL default '0', `send_date` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY  (`id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1";


$sq18	="INSERT INTO  ".$TABLE_PREFIX."settings VALUES ('fedexshipaccno', '')";
$sq19	="INSERT INTO  ".$TABLE_PREFIX."settings VALUES ('fedexbillaccno', '')";
$sq20	="INSERT INTO  ".$TABLE_PREFIX."settings VALUES ('fedexdutyaccno', '')";
$sq21	="INSERT INTO  ".$TABLE_PREFIX."settings VALUES ('fedexmeterno', '')";
$sq22	="INSERT INTO  ".$TABLE_PREFIX."settings VALUES ('allow_fedexlabel', 'Y')";
$sq23	="INSERT INTO  ".$TABLE_PREFIX."settings VALUES ('allow_giftcard', 'Y')";
$sq24	="INSERT INTO  ".$TABLE_PREFIX."settings VALUES ('shipping_origin_state', '')";


$sq25   ="drop table if exists ".$TABLE_PREFIX."statecodes";
$sq26="CREATE TABLE ".$TABLE_PREFIX."statecodes (  `id` int(11) NOT NULL auto_increment, `code` varchar(10) NOT NULL default '',
 	  `name` varchar(100) NOT NULL default '',  `country_id` varchar(10) NOT NULL default '',  PRIMARY KEY  (`id`),
 	  KEY `country_id` (`country_id`)) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=63 ";


$sq27	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (1, 'AK', 'Alaska', '223')";
$sq28	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (2, 'AL', 'Alabama', '223')";
$sq29	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (3, 'AR', 'Arkansas', '223')";
$sq30	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (4, 'AS', 'American Samoa', '223')";
$sq31	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (5, 'AZ', 'Arizona', '223')";
$sq32	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (6, 'CA', 'California', '223')";
$sq33	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (7, 'CO', 'Colorado', '223')";
$sq34	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (8, 'CT', 'Connecticut', '223')";
$sq35	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (9, 'DC', 'D.C.', '223')";
$sq36	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (10, 'DE', 'Delaware', '223')";
$sq37	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (11, 'FL', 'Florida', '223')";
$sq38	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (12, 'FM', 'Micronesia', '223')";
$sq39	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (13, 'GA', 'Georgia', '223')";
$sq40	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (14, 'GU', 'Guam', '223')";
$sq41	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (15, 'HI', 'Hawaii', '223')";
$sq42	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (16, 'IA', 'Iowa', '223')";
$sq43	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (17, 'ID', 'Idaho', '223')";
$sq44	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (18, 'IL', 'Illinois', '223')";
$sq45	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (19, 'IN', 'Indiana', '223')";
$sq46	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (20, 'KS', 'Kansas', '223')";
$sq47	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (21, 'KY', 'Kentucky', '223')";
$sq48	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (22, 'LA', 'Louisiana', '223')";
$sq49	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (23, 'MA', 'Massachusetts', '223')";
$sq50	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (24, 'MD', 'Maryland', '223')";
$sq51	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (25, 'ME', 'Maine', '223')";
$sq52	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (26, 'MH', 'Marshall Islands', '223')";
$sq53	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (27, 'MI', 'Michigan', '223')";
$sq54	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (28, 'MN', 'Minnesota', '223')";
$sq55	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (29, 'MO', 'Missouri', '223')";
$sq56	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (30, 'MP', 'Marianas', '223')";
$sq57	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (31, 'MS', 'Mississippi', '223')";
$sq58	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (32, 'MT', 'Montana', '223')";
$sq59	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (33, 'NC', 'North Carolina', '223')";
$sq60	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (34, 'ND', 'North Dakota', '223')";
$sq61	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (35, 'NE', 'Nebraska', '223')";
$sq62	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (36, 'NH', 'New Hampshire', '223')";
$sq63	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (37, 'NJ', 'New Jersey', '223')";
$sq64	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (38, 'NM', 'New Mexico', '223')";
$sq65	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (39, 'NV', 'Nevada', '223')";
$sq66	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (40, 'NY', 'New York', '223')";
$sq67	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (41, 'OH', 'Ohio', '223')";
$sq68	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (42, 'OK', 'Oklahoma', '223')";
$sq69	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (43, 'OR', 'Oregon', '223')";
$sq70	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (44, 'PA', 'Pennsylvania', '223')";
$sq71	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (45, 'PR', 'Puerto Rico', '223')";
$sq72	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (46, 'PW', 'Palau', '223')";
$sq73	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (47, 'RI', 'Rhode Island', '223')";
$sq74	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (48, 'SC', 'South Carolina', '223')";
$sq75	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (49, 'SD', 'South Dakota', '223')";
$sq76	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (50, 'TN', 'Tennessee', '223')";
$sq77   ="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (51, 'TX', 'Texas', '223')";
$sq78	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (52, 'UT', 'Utah', '223')";
$sq79	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (53, 'VA', 'Virginia', '223')";
$sq80	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (54, 'VI', 'Virgin Islands', '223')";
$sq81	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (55, 'VT', 'Vermont', '223')";
$sq82	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (56, 'WA', 'Washington', '223')";
$sq83	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (57, 'WI', 'Wisconsin', '223')";
$sq84	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (58, 'WV', 'West Virginia', '223')";
$sq85	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (59, 'WY', 'Wyoming', '223')";
$sq86	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (60, 'AA', 'Military Americas', '223')";
$sq87	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (61, 'AE', 'Military Europe)ME)Canada', '223')";
$sq88	="INSERT INTO ".$TABLE_PREFIX."statecodes VALUES (62, 'AP', 'Military Pacific', '223')";


/*@mysql_query($sq1) or die(mysql_error());
@mysql_query($sq2) or die(mysql_error());
@mysql_query($sq3) or die(mysql_error());
@mysql_query($sq4) or die(mysql_error());
@mysql_query($sq5) or die(mysql_error());
@mysql_query($sq6);
@mysql_query($sq7);
echo "<br>".$sq7;*/
@mysql_query($sq8) or die(mysql_error());
@mysql_query($sq9) or die(mysql_error());
@mysql_query($sq10) or die(mysql_error());
@mysql_query($sq11) or die(mysql_error());
@mysql_query($sq12) or die(mysql_error());
@mysql_query($sq13) or die(mysql_error());
@mysql_query($sq14) or die(mysql_error());
@mysql_query($sq15) or die(mysql_error());
@mysql_query($sq16) or die(mysql_error());
@mysql_query($sq17) or die(mysql_error());
@mysql_query($sq18) or die(mysql_error());
@mysql_query($sq19) or die(mysql_error());
@mysql_query($sq20) or die(mysql_error());
@mysql_query($sq21) or die(mysql_error());
@mysql_query($sq22) or die(mysql_error());
@mysql_query($sq23) or die(mysql_error());
@mysql_query($sq24) or die(mysql_error());
@mysql_query($sq25) or die(mysql_error());
@mysql_query($sq26) or die(mysql_error());
@mysql_query($sq27) or die(mysql_error());
@mysql_query($sq28) or die(mysql_error());
@mysql_query($sq29) or die(mysql_error());
@mysql_query($sq30) or die(mysql_error());
@mysql_query($sq31) or die(mysql_error());
@mysql_query($sq32) or die(mysql_error());
@mysql_query($sq33) or die(mysql_error());
@mysql_query($sq34) or die(mysql_error());
@mysql_query($sq35) or die(mysql_error());
@mysql_query($sq36) or die(mysql_error());
@mysql_query($sq37) or die(mysql_error());
@mysql_query($sq38) or die(mysql_error());
@mysql_query($sq39) or die(mysql_error());
@mysql_query($sq40) or die(mysql_error());
@mysql_query($sq41) or die(mysql_error());
@mysql_query($sq42) or die(mysql_error());
@mysql_query($sq43) or die(mysql_error());
@mysql_query($sq44) or die(mysql_error());
@mysql_query($sq45) or die(mysql_error());
@mysql_query($sq46) or die(mysql_error());
@mysql_query($sq47) or die(mysql_error());
@mysql_query($sq48) or die(mysql_error());
@mysql_query($sq49) or die(mysql_error());
@mysql_query($sq50) or die(mysql_error());
@mysql_query($sq51) or die(mysql_error());
@mysql_query($sq52) or die(mysql_error());
@mysql_query($sq53) or die(mysql_error());
@mysql_query($sq54) or die(mysql_error());
@mysql_query($sq55) or die(mysql_error());
@mysql_query($sq56) or die(mysql_error());
@mysql_query($sq57) or die(mysql_error());
@mysql_query($sq58) or die(mysql_error());
@mysql_query($sq59) or die(mysql_error());
@mysql_query($sq60) or die(mysql_error());
@mysql_query($sq61) or die(mysql_error());
@mysql_query($sq62) or die(mysql_error());
@mysql_query($sq63) or die(mysql_error());
@mysql_query($sq64) or die(mysql_error());
@mysql_query($sq65) or die(mysql_error());
@mysql_query($sq66) or die(mysql_error());
@mysql_query($sq67) or die(mysql_error());
@mysql_query($sq68) or die(mysql_error());
@mysql_query($sq69) or die(mysql_error());
@mysql_query($sq70) or die(mysql_error());
@mysql_query($sq71) or die(mysql_error());
@mysql_query($sq72) or die(mysql_error());
@mysql_query($sq73) or die(mysql_error());
@mysql_query($sq74) or die(mysql_error());
@mysql_query($sq75) or die(mysql_error());
@mysql_query($sq76) or die(mysql_error());
@mysql_query($sq77) or die(mysql_error());
@mysql_query($sq78) or die(mysql_error());
@mysql_query($sq79) or die(mysql_error());
@mysql_query($sq80) or die(mysql_error());
@mysql_query($sq81) or die(mysql_error());
@mysql_query($sq82) or die(mysql_error());
@mysql_query($sq83) or die(mysql_error());
@mysql_query($sq84) or die(mysql_error());
@mysql_query($sq85) or die(mysql_error());
@mysql_query($sq86) or die(mysql_error());
@mysql_query($sq87) or die(mysql_error());
@mysql_query($sq88) or die(mysql_error());
@mysql_query($sq89) or die(mysql_error());
@mysql_query($sq90) or die(mysql_error());
@mysql_query($sq91) or die(mysql_error());
@mysql_query($sq92) or die(mysql_error());
@mysql_query($sq93) or die(mysql_error());
@mysql_query($sq94) or die(mysql_error());
@mysql_query($sq95) or die(mysql_error());
/* Section to upgrade from 1.0 to 1.1.......................*/

$Message	=	"Vistacart 1.0 Upgraded to Autohoster 1.1 Successfully <br> Please remove the upgrade folder from your system";
####################################################################################################
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Store Upgrade</title>
<link href="../css/Eyewears.css" rel="stylesheet" type="text/css">
</head>

<body topmargin="0">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="23%" align="center"><h2><font color="#FFFFFF">Store Upgrade</font></h2></td>
    <td width="77%"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="75%" align="center">&nbsp;</td>
        <td width="25%"></td>
      </tr>
    </table>
      <table width="100%"  border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="44%" align="right"></td>
          <td width="7%" align="right">&nbsp;</td>
          <td width="49%">
		  </td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="../img/spacer.gif" width="1" height="5"></td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
   
    <td width="76%" valign="top" height ="400">
	<!-- Here's where I want my views to be displayed -->
	<table width="80%" border="0" cellpadding="0" cellspacing="0" align="center">
	<tr>
		<td><?php echo $Message; ?></td>
	</tr>
	</table>
      </td>
  </tr>
</table>
<table width="100%"  border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="10">
      <tr>
        <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top"><table width="100%"  border="0" cellspacing="0" cellpadding="3">
              <tr>
                <td height="43" class="bigfont1" align="center"><div align="center" class="copyright"><!-- footr links comes here --></div></td>
              </tr>
            </table>
</td>
          </tr>
        </table></td>
      </tr>
    </table>      
      </td>
  </tr>
</table>
</body>
</html>