<?php
$sql1="CREATE TABLE IF NOT EXISTS `download` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idu` int(11) NOT NULL,
  `idp` int(11) NOT NULL,
  `ids` int(11) NOT NULL,
  `active` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";


$sql2="CREATE TABLE IF NOT EXISTS `members` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(264) NOT NULL,
  `password` text NOT NULL,
  `name` varchar(264) NOT NULL,
  `paypalemail` text NOT NULL,
  `email` text NOT NULL,
  `role` int(11) NOT NULL DEFAULT '0',
  `register` text NOT NULL,
  `registerfix` varchar(264) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";

$sql3="CREATE TABLE IF NOT EXISTS `products` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idu` int(11) NOT NULL,
  `name` varchar(264) NOT NULL,
  `price` int(11) NOT NULL,
  `price_value` varchar(264) NOT NULL,
  `contact_name` varchar(264) NOT NULL,
  `contact_email` text NOT NULL,
  `contact_paypal` text NOT NULL,
  `register` int(11) NOT NULL,
  `limit` int(11) NOT NULL,
  `download` int(11) NOT NULL,
  `description` text NOT NULL,
  `file` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";

$sql4="CREATE TABLE IF NOT EXISTS `sales` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `idu` int(11) NOT NULL,
  `idp` int(11) NOT NULL,
  `payment` varchar(264) NOT NULL,
  `price` int(11) NOT NULL,
  `details` text NOT NULL,
  `datefix` varchar(264) NOT NULL,
  `date` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;";

$sql5="CREATE TABLE IF NOT EXISTS `settings` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `type` text NOT NULL,
  `value` text NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";

mysql_query($sql1)or die(mysql_error());
mysql_query($sql2)or die(mysql_error());
mysql_query($sql3)or die(mysql_error());
mysql_query($sql4)or die(mysql_error());
mysql_query($sql5)or die(mysql_error());


$insert="INSERT INTO `settings` (`value`, `type`) VALUES
('en', 'site_language'),
('EUR', 'site_currency'),
('10', 'site_max_file_size'),
('jpg,rar,txt,png,zip', 'site_type_file'),
('default', 'site_template'),
('24', 'expire_download');
";
mysql_query($insert)or die(mysql_error());
?>
