[Znote AAC] Auto installer

Raggaer

Godly Member
Joined
Jul 25, 2012
Messages
1,556
Best answers
8
Reaction score
895
Location
Spain
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

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
 

Dalt0n

Hiho:)
Joined
Dec 14, 2011
Messages
536
Best answers
0
Reaction score
30
Location
Italia
OMG, Excellent Raggaer, i will test this now
 

rafaelretro

New Member
Joined
Mar 19, 2014
Messages
8
Best answers
0
Reaction score
0
string(106) "SELECT `ip`, `created`, `points`, `cooldown`, `flag` FROM `znote_accounts` WHERE `account_id` = 6 LIMIT 1;"
(query - SQL error)
Type: select_single (select single row from database)

Unknown column 'cooldown' in 'field list'



please help me someone
 

Emky

Not Active Member
Joined
May 15, 2015
Messages
345
Best answers
0
Reaction score
44
string(106) "SELECT `ip`, `created`, `points`, `cooldown`, `flag` FROM `znote_accounts` WHERE `account_id` = 6 LIMIT 1;"
(query - SQL error)
Type: select_single (select single row from database)

Unknown column 'cooldown' in 'field list'



please help me someone
seems like your cooldown table don't exists in znote_accounts, maby you should try create a new one and import the stuff that's missing before you print it to your website
 

rafaelretro

New Member
Joined
Mar 19, 2014
Messages
8
Best answers
0
Reaction score
0
seems like your cooldown table don't exists in znote_accounts, maby you should try create a new one and import the stuff that's missing before you print it to your website
i dont know how can you help me please?
 

sirwill

New Member
Joined
Nov 28, 2010
Messages
34
Best answers
0
Reaction score
0
this code is even worse then the default one that comes with Znote.
Error On line 1 Lmfao
16:01:24 Restoring D:\ForgottenL Stuff\znote.sql
Running: mysql.exe --defaults-file="c:\users\will\appdata\local\temp\tmpab4wle.cnf" --protocol=tcp --host=localhost --user=root --port=3306 --default-character-set=utf8 --comments --database=theforgottenserver < "D:\\ForgottenL Stuff\\znote.sql"
ERROR 1366 (HY000) at line 9: Incorrect integer value: '$time' for column 'installed' at row 1

Operation failed with exitcode 1
16:01:25 Import of D:\ForgottenL Stuff\znote.sql has finished with 1 errors
 
Joined
Jun 22, 2019
Messages
22
Best answers
0
Reaction score
-1
INSERT INTO znote (version, installed) VALUES ('$version', '$time')
 
Top