Raggaer
Godly Member
This will auto install your Znote tables into the database
*Note : you first need to configure the Config.php values!
- Install -
Open your engine/database/connect.php paste this code
Then create a file called dbSCHEMA.txt and paste this
We are done
*Note : you first need to configure the Config.php values!
- Install -
Open your engine/database/connect.php paste this code
Then create a file called dbSCHEMA.txt and paste this
Code:
CREATE TABLE `znote` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`version` varchar(30) NOT NULL COMMENT 'Znote AAC version',
`installed` int(10) NOT NULL,
`cached` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
INSERT INTO `znote` (`version`, `installed`) VALUES
('$version', '$time');
CREATE TABLE `znote_accounts` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL,
`ip` int(10) NOT NULL,
`created` int(10) NOT NULL,
`points` int(10) DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;
INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`) VALUES
('1', '0', '$time');
CREATE TABLE `znote_paypal` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`txn_id` varchar(30) NOT NULL,
`email` varchar(255) NOT NULL,
`accid` int(11) NOT NULL,
`price` int(11) NOT NULL,
`points` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE `znote_players` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`player_id` int(11) NOT NULL,
`created` int(11) NOT NULL,
`hide_char` tinyint(4) NOT NULL,
`comment` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
INSERT INTO `znote_players` (`player_id`, `created`, `hide_char`, `comment`) VALUES
('1', '$time', '0', '. . .');
CREATE TABLE `znote_shop` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`type` int(11) NOT NULL,
`itemid` int(11) DEFAULT NULL,
`count` int(11) NOT NULL DEFAULT '1',
`describtion` varchar(255) NOT NULL,
`points` int(11) NOT NULL DEFAULT '10',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE `znote_shop_logs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL,
`player_id` int(11) NOT NULL,
`type` int(11) NOT NULL,
`itemid` int(11) NOT NULL,
`count` int(11) NOT NULL,
`points` int(11) NOT NULL,
`time` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE `znote_shop_orders` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`account_id` int(11) NOT NULL,
`type` int(11) NOT NULL,
`itemid` int(11) NOT NULL,
`count` int(11) NOT NULL,
`time` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE `znote_visitors` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip` int(11) NOT NULL,
`value` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
CREATE TABLE `znote_visitors_details` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`ip` int(11) NOT NULL,
`time` int(11) NOT NULL,
`type` tinyint(4) NOT NULL,
`account_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;
PHP:
<?php
$time = time();
if (!isset($version)) $version = '1.2_PUBLIC';
$connect1 = mysql_connect($config['sqlHost'], $config['sqlUser'], $config['sqlPassword']) or die('<h1>Failed to connect to database.</h1>');
$select = mysql_select_db($config['sqlDatabase']);
$install;
if ($connect1 && $select && $install != 0) {
$db = file_get_contents("engine/database/dbSCHEMA.txt");
$databases = explode(";" , $db);
$i = 0;
foreach ($databases as $add) {
mysql_query($add);
$i++;
}
$install == 0;
echo 'Number of querys added to database : '.$i;
}
?>
We are done