-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.php
41 lines (34 loc) · 1.24 KB
/
install.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
require_once 'app'.DIRECTORY_SEPARATOR.'Bootstrap.php';
$config = Config::get();
$basename = $config['db']['name'];
$table_users = $config['tables']['users'];
$table_msgs = $config['tables']['msgs'];
$db = new Db(false);
$query = "CREATE DATABASE IF NOT EXISTS $basename";
$db->query($query);
$db->query("use $basename");
$db->query("DROP TABLE IF EXISTS `".$table_users."`");
$query = "
CREATE TABLE IF NOT EXISTS `".$table_users."` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`nick` varchar(20) NOT NULL,
`profile` varchar(255) NOT NULL DEFAULT '',
`date` int(10) NOT NULL DEFAULT '0',
`ip_addr` CHAR(16) binary NOT NULL DEFAULT '0' DEFAULT '',
`site` tinyint(1) unsigned NOT NULL default '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;";
$db->query($query);
//$db->query("truncate $table_users");
$db->query("DROP TABLE IF EXISTS `".$table_msgs."`");
$query="
CREATE TABLE IF NOT EXISTS `".$table_msgs."` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`id_nick` int(10) NOT NULL DEFAULT '0',
`textmsg` varchar(255) NOT NULL,
`date` int(10) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=0 ;";
$db->query($query);
//$db->query("truncate $table_msgs");