DROP TABLE IF EXISTS `z_accounts`;

CREATE TABLE `z_accounts` (
  `ac_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `ac_user_vc` varchar(10) COLLATE latin1_general_ci DEFAULT NULL,
  `ac_pass_vc` varchar(64) COLLATE latin1_general_ci DEFAULT NULL,
  `ac_package_fk` int(6) DEFAULT NULL,
  `ac_paiduntil_ts` int(30) DEFAULT NULL,
  `ac_reseller_fk` int(6) DEFAULT NULL,
  `ac_created_ts` int(30) DEFAULT NULL,
  `ac_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`ac_id_pk`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_accounts`(`ac_id_pk`,`ac_user_vc`,`ac_pass_vc`,`ac_package_fk`,`ac_paiduntil_ts`,`ac_reseller_fk`,`ac_created_ts`,`ac_deleted_ts`) values (1,'tasksys',NULL,0,0,NULL,1265128421,NULL),(2,'zadmin','TO_BE_UPDATED',1,0,2,1265128421,NULL);

DROP TABLE IF EXISTS `z_bandwidth`;

CREATE TABLE `z_bandwidth` (
  `bd_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `bd_acc_fk` int(6) DEFAULT NULL,
  `bd_month_in` int(6) DEFAULT NULL,
  `bd_transamount_bi` bigint(20) DEFAULT NULL,
  `bd_diskamount_bi` bigint(20) DEFAULT NULL,
  PRIMARY KEY (`bd_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_cronjobs`;

CREATE TABLE `z_cronjobs` (
  `ct_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `ct_acc_fk` int(6) DEFAULT NULL,
  `ct_script_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `ct_description_tx` text COLLATE latin1_general_ci,
  `ct_created_ts` int(30) DEFAULT NULL,
  `ct_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`ct_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_distlists`;

CREATE TABLE `z_distlists` (
  `dl_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `dl_acc_fk` int(6) DEFAULT NULL,
  `dl_address_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `dl_created_ts` int(30) DEFAULT NULL,
  `dl_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`dl_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_distlistusers`;

CREATE TABLE `z_distlistusers` (
  `du_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `du_distlist_fk` int(6) DEFAULT NULL,
  `du_address_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `du_created_ts` int(30) DEFAULT NULL,
  `du_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`du_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_faqs`;

CREATE TABLE `z_faqs` (
  `fq_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `fq_queston_tx` text COLLATE latin1_general_ci,
  `fq_answer_tx` text COLLATE latin1_general_ci,
  PRIMARY KEY (`fq_id_pk`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_faqs`(`fq_id_pk`,`fq_queston_tx`,`fq_answer_tx`) values (1,'How can I update my personal contact details?','From the control panel homepage please click on the \'My Account\' icon to enable you to update your personal details.'),(2,'I need to change my password!','Your ZPanel and MySQL password can be easily changed using the \'Password assistant\' icon on the control panel.');

DROP TABLE IF EXISTS `z_forwarders`;

CREATE TABLE `z_forwarders` (
  `fw_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `fw_acc_fk` int(6) DEFAULT NULL,
  `fw_address_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `fw_destination_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `fw_created_ts` int(30) DEFAULT NULL,
  `fw_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`fw_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_ftpaccounts`;

CREATE TABLE `z_ftpaccounts` (
  `ft_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `ft_acc_fk` int(6) DEFAULT NULL,
  `ft_user_vc` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
  `ft_directory_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `ft_access_vc` varchar(20) COLLATE latin1_general_ci DEFAULT NULL,
  `ft_created_ts` int(6) DEFAULT NULL,
  `ft_deleted_ts` int(6) DEFAULT NULL,
  PRIMARY KEY (`ft_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_invoiceitems`;

CREATE TABLE `z_invoiceitems` (
  `ii_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `ii_invoice_fk` int(6) DEFAULT NULL,
  `ii_amount_in` int(4) DEFAULT '1',
  `ii_package_fk` int(6) DEFAULT NULL,
  PRIMARY KEY (`ii_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_invoices`;

CREATE TABLE `z_invoices` (
  `in_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `in_account_fk` int(6) DEFAULT NULL,
  `in_month_int` int(6) DEFAULT NULL,
  `in_paid_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`in_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_logs`;

CREATE TABLE `z_logs` (
  `lg_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `lg_acc_fk` int(6) DEFAULT NULL,
  `lg_when_ts` int(30) DEFAULT NULL,
  `lg_ipaddress_vc` varchar(15) COLLATE latin1_general_ci DEFAULT NULL,
  `lg_details_tx` text COLLATE latin1_general_ci,
  PRIMARY KEY (`lg_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_mailboxes`;

CREATE TABLE `z_mailboxes` (
  `mb_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `mb_acc_fk` int(6) DEFAULT NULL,
  `mb_address_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `mb_created_ts` int(30) DEFAULT NULL,
  `mb_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`mb_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_mysql`;

CREATE TABLE `z_mysql` (
  `my_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `my_acc_fk` int(6) DEFAULT NULL,
  `my_name_vc` varchar(40) COLLATE latin1_general_ci DEFAULT NULL,
  `my_usedspace_bi` bigint(50) DEFAULT '0',
  `my_created_ts` int(30) DEFAULT NULL,
  `my_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`my_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

DROP TABLE IF EXISTS `z_packages`;

CREATE TABLE `z_packages` (
  `pk_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `pk_name_vc` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
  `pk_reseller_fk` int(6) DEFAULT NULL,
  `pk_enablephp_in` int(1) DEFAULT '0',
  `pk_enablecgi_in` int(1) DEFAULT '0',
  `pk_created_ts` int(30) DEFAULT NULL,
  `pk_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`pk_id_pk`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_packages`(`pk_id_pk`,`pk_name_vc`,`pk_reseller_fk`,`pk_enablephp_in`,`pk_enablecgi_in`,`pk_created_ts`,`pk_deleted_ts`) values (1,'Administration',2,1,1,NULL,NULL);

DROP TABLE IF EXISTS `z_permissions`;

CREATE TABLE `z_permissions` (
  `pr_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `pr_package_fk` int(6) DEFAULT NULL,
  `pr_admin_in` int(1) DEFAULT '0',
  `pr_reseller_in` int(1) DEFAULT '0',
  PRIMARY KEY (`pr_id_pk`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_permissions`(`pr_id_pk`,`pr_package_fk`,`pr_admin_in`,`pr_reseller_in`) values (1,1,1,1);

DROP TABLE IF EXISTS `z_personal`;

CREATE TABLE `z_personal` (
  `ap_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `ap_acc_fk` int(6) DEFAULT NULL,
  `ap_fullname_vc` varchar(30) COLLATE latin1_general_ci DEFAULT NULL,
  `ap_email_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `ap_address_tx` text COLLATE latin1_general_ci,
  `ap_postcode_vc` varchar(10) COLLATE latin1_general_ci DEFAULT NULL,
  `ap_phone_vc` varchar(50) COLLATE latin1_general_ci DEFAULT NULL,
  PRIMARY KEY (`ap_id_pk`)
) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_personal`(`ap_id_pk`,`ap_acc_fk`,`ap_fullname_vc`,`ap_email_vc`,`ap_address_tx`,`ap_postcode_vc`,`ap_phone_vc`) values (1,1,'TASK SYSTEM',NULL,NULL,NULL,NULL),(2,2,'John Smith','john.smith@zpanel.co.uk','1 Example house,\r\nTest street,\r\nSimple town,\r\nTestshire','C011 7RT','+44(1206) 457169');

DROP TABLE IF EXISTS `z_quotas`;

CREATE TABLE `z_quotas` (
  `qt_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `qt_package_fk` int(6) DEFAULT NULL,
  `qt_domains_in` int(6) DEFAULT '0',
  `qt_subdomains_in` int(6) DEFAULT '0',
  `qt_parkeddomains_in` int(6) DEFAULT '0',
  `qt_mailboxes_in` int(6) DEFAULT '0',
  `qt_fowarders_in` int(6) DEFAULT '0',
  `qt_distlists_in` int(6) DEFAULT '0',
  `qt_ftpaccounts_in` int(6) DEFAULT '0',
  `qt_mysql_in` int(6) DEFAULT '0',
  `qt_diskspace_bi` bigint(20) DEFAULT '0',
  `qt_bandwidth_bi` bigint(20) DEFAULT '0',
  PRIMARY KEY (`qt_id_pk`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_quotas`(`qt_id_pk`,`qt_package_fk`,`qt_domains_in`,`qt_subdomains_in`,`qt_parkeddomains_in`,`qt_mailboxes_in`,`qt_fowarders_in`,`qt_distlists_in`,`qt_ftpaccounts_in`,`qt_mysql_in`,`qt_diskspace_bi`,`qt_bandwidth_bi`) values (1,1,3,10,5,10,100,5,50,50,2048000000,10240000000);

DROP TABLE IF EXISTS `z_resellers`;

CREATE TABLE `z_resellers` (
  `rc_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `rc_acc_fk` int(6) DEFAULT NULL,
  `rc_company_vc` varchar(100) COLLATE latin1_general_ci DEFAULT NULL,
  `rc_template_vc` varchar(100) COLLATE latin1_general_ci DEFAULT NULL,
  PRIMARY KEY (`rc_id_pk`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_resellers`(`rc_id_pk`,`rc_acc_fk`,`rc_company_vc`,`rc_template_vc`) values (1,2,'Example Company',NULL);

DROP TABLE IF EXISTS `z_settings`;

CREATE TABLE `z_settings` (
  `st_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `st_name_vc` varchar(15) CHARACTER SET latin1 NOT NULL,
  `st_value_tx` text CHARACTER SET latin1,
  `st_desc_tx` text CHARACTER SET latin1,
  `st_label_vc` varchar(35) CHARACTER SET latin1 DEFAULT NULL,
  `st_inputtype_vc` varchar(20) CHARACTER SET latin1 DEFAULT 'text',
  `st_checkvalue_tx` text CHARACTER SET latin1,
  `st_editable_in` int(1) DEFAULT NULL,
  PRIMARY KEY (`st_id_pk`,`st_name_vc`)
) ENGINE=MyISAM AUTO_INCREMENT=46 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

insert  into `z_settings`(`st_id_pk`,`st_name_vc`,`st_value_tx`,`st_desc_tx`,`st_label_vc`,`st_inputtype_vc`,`st_checkvalue_tx`,`st_editable_in`) values (9,'zpanel_version','5.0.0','The version of ZPanel currently running on the server.',NULL,'text',NULL,0),(10,'zpanel_root','C:/ZPanel/panel/','The root directory of ZPanel. (With a trailing slash)',NULL,'text',NULL,0),(11,'zpanel_template','default','The folder name of the ZPanel template to use.','Template','text',NULL,0),(12,'zpanel_lang','en-us','The language folder to use.','Translation','text',NULL,0),(13,'zpanel_df','H:i jS M Y T','The PHP date() format to display dates and times in ZPanel.\r\nSee http://uk2.php.net/manual/en/function.date.php','Date format','text',NULL,1),(14,'server_email','no-reply@yourdomain.com','The email address that emails should be sent from on this server.','Mail from','text',NULL,1),(16,'module_icons_pr','8','This is how many columns to display per row. Its used in displaying the module icons when the user has logged in.',NULL,'text',NULL,0),(17,'webalizer_sd','apps/webalizer/','The directory to the Webalizer statistics output directory (must has a trailing slash.)','Path to webalizer out','text',NULL,1),(18,'servicechk_to','2','Service status timeout period (in seconds) default=2','Service check timeout','text',NULL,1),(19,'windows_drive','C','The primary Windows partition letter that ZPanel is installed on.','WINDOWS Partition','text',NULL,1),(20,'cron_file','C:/WINDOWS/System32/crontab','The location of the crontab file.','Crontab file','text',NULL,1),(21,'php_exer','C:/ZPanel/bin/php/php.exe','The full system path to the PHP executable.','PHP Compiler path','text',NULL,0),(22,'hosted_dir','C:/ZPanel/hostdata/','The full system path to the file storage area for user storage space.','User storage path','text',NULL,1),(23,'apache_vhost','C:/ZPanel/bin/apache/conf/extra/httpd-vhosts.conf','The full system patch and filename of the Apache VHOST configuration name.','Apache VHOST Conf','text',NULL,1),(24,'disable_hostsen','false','For Windows Servers only, this will add a host\'s entry on to the server.','Disable HOSTS file entries','text',NULL,1),(25,'logfile_dir','C:/ZPanel/Logs/domains/','Full system path to the Apache log files.','Apache Log files','text',NULL,1),(26,'directory_index','DirectoryIndex index.html index.htm index.php index.asp index.aspx index.jsp index.jspa index.shtml index.shtm','Apache directory index line as used the Apache vhost file.','Apache Directory Index','text',NULL,0),(27,'php_handler','AddType application/x-httpd-php .php\r\nAddType application/x-httpd-php .php3\r\n','The PHP Handler.','Apache PHP Handler','text',NULL,0),(28,'cgi_handler','AddHandler cgi-script .cgi .pl','The CGI Handler','Apache CGI Handler','text',NULL,0),(29,'vhost_extra','ServerSignature Off','Extra directives for all apache vhost\'s.','Extra Apache VHOST directives','text',NULL,0),(30,'static_dir','C:/ZPanel/panel/static/','The ZPanel static directory, used for storing welcome pages etc. etc.','Static path','text',NULL,0),(31,'webalizer_reps','C:/ZPanel/panel/apps/webalizer/','The webalizer reports directory.','Webalizer Reports directory','text',NULL,1),(32,'parking_path','C:/ZPanel/panel/static/parking/','The path to the parking website, this will be used by all clients.','Parking path','text',NULL,0),(33,'hmailserver_db','zpanel_hmail','The MySQL database name of the hMailServer.','hMailServer DB Name','text',NULL,1),(34,'hmailserver_et','2','hMailServer account encryption method (2 = Default)',NULL,'text',NULL,0),(35,'hmailserver_mms','200','The default mailbox storage limit in megabytes. (Default 100MB)','Default Mailbox space quota','text',NULL,1),(36,'filezilla_root','C:/ZPanel/bin/filezilla/','The installation directory of where FileZilla server is installed in. (with a trailing slash \'/\')',NULL,'text',NULL,0),(37,'webalizer_exe','C:/ZPanel/bin/webalizer/Webalizer.exe','The full path to the webalizer executable.',NULL,'text',NULL,0),(38,'current_month','201000','The current month number (YYYYMM)',NULL,'text',NULL,0),(39,'temp_dir','C:/ZPanel/temp/','The path to the ZPanel temporary directory (with trailing slash)','Temp Directory','text',NULL,1),(40,'7z_exe','C:/ZPanel/bin/7zip/7z.exe','The path and filename of the 7z compression tool.',NULL,'text',NULL,0),(41,'mysqldump_exe','C:/ZPanel/bin/mysql/bin/mysqldump.exe',NULL,NULL,'text',NULL,0),(42,'login_url','Unknown','Caches the last know login URL, Speeds up control panel access times.',NULL,'text',NULL,0),(43,'server_admin','Unknown','The name of the server admin',NULL,'text',NULL,0),(44,'install_date','Unknown','The date that ZPanel was installed.',NULL,'text',NULL,NULL),(45,'last_update','Never','The date that ZPanel was last updated.',NULL,'text',NULL,NULL);

DROP TABLE IF EXISTS `z_vhosts`;

CREATE TABLE `z_vhosts` (
  `vh_id_pk` int(6) unsigned NOT NULL AUTO_INCREMENT,
  `vh_acc_fk` int(6) DEFAULT NULL,
  `vh_name_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `vh_directory_vc` varchar(255) COLLATE latin1_general_ci DEFAULT NULL,
  `vh_type_in` int(1) DEFAULT '1',
  `vh_active_in` int(1) DEFAULT '0',
  `vh_created_ts` int(30) DEFAULT NULL,
  `vh_deleted_ts` int(30) DEFAULT NULL,
  PRIMARY KEY (`vh_id_pk`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;