· 9 years ago · Jun 06, 2017, 10:22 PM
1<?php
2// Should simply include config.php, however using post/get
3// for these 4 variables below will do better, mainly
4// since we want to only install if config.php doesn't exist.
5
6$host = "127.0.0.1"; //What is the local host of your database?
7$username = 'root'; //What username will be used to access the database?
8$password = ''; //What is the password to access your database?
9$db = "interforum"; //What is the name of the database?
10
11mysql_connect($host,$username,$password);
12@mysql_select_db($db) or die( "You have supplied invalid database information.");
13
14
15// Create the database we are going to use.
16mysql_query("CREATE DATABASE IF NOT EXISTS <?php echo $db ?>");
17
18// Create table set 1, on the database we are using.
19mysql_query("CREATE TABLE IF NOT EXISTS `forum_activations` (
20 `code` text COLLATE utf8_unicode_ci NOT NULL,
21 `username` varchar(20) COLLATE utf8_unicode_ci NOT NULL
22 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci");
23
24// Create table set 2, on the database we are using.
25mysql_query("CREATE TABLE IF NOT EXISTS `forum_catagories` (
26 `title` text COLLATE utf8_unicode_ci NOT NULL,
27 `desc` text COLLATE utf8_unicode_ci NOT NULL,
28 `position` int(11) NOT NULL AUTO_INCREMENT,
29 PRIMARY KEY (`position`)
30 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1");
31
32// Create table set 3, on the database we are using.
33mysql_query("CREATE TABLE IF NOT EXISTS `forum_replys` (
34 `id` int(11) NOT NULL AUTO_INCREMENT,
35 `topicid` int(11) NOT NULL,
36 `date` text COLLATE utf8_unicode_ci NOT NULL,
37 `message` text COLLATE utf8_unicode_ci NOT NULL,
38 `posterid` int(11) NOT NULL,
39 `deleted` int(11) NOT NULL DEFAULT '0',
40 PRIMARY KEY (`id`)
41 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1");
42
43// Create table set 4, on the database we are using.
44mysql_query("CREATE TABLE IF NOT EXISTS `forum_topics` (
45 `id` int(11) NOT NULL AUTO_INCREMENT,
46 `forum` text COLLATE utf8_unicode_ci NOT NULL,
47 `subject` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
48 `message` text COLLATE utf8_unicode_ci NOT NULL,
49 `date` text COLLATE utf8_unicode_ci NOT NULL,
50 `posterid` int(11) NOT NULL,
51 `deleted` int(11) NOT NULL DEFAULT '0',
52 `type` int(11) NOT NULL,
53 PRIMARY KEY (`id`)
54 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1");
55
56// Create table set 5, on the database we are using.
57mysql_query("CREATE TABLE IF NOT EXISTS `forum_users` (
58 `id` int(11) NOT NULL AUTO_INCREMENT,
59 `username` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
60 `password` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
61 `email` text COLLATE utf8_unicode_ci NOT NULL,
62 `displayname` varchar(20) COLLATE utf8_unicode_ci NOT NULL,
63 `ip` text COLLATE utf8_unicode_ci NOT NULL,
64 `rank` int(11) NOT NULL DEFAULT '1',
65 `signature` varchar(500) COLLATE utf8_unicode_ci NOT NULL,
66 `admin` int(11) NOT NULL DEFAULT '0',
67 `picture url` text COLLATE utf8_unicode_ci NOT NULL,
68 `posts` int(11) NOT NULL,
69 `joindate` text COLLATE utf8_unicode_ci NOT NULL,
70 `activated` int(11) NOT NULL DEFAULT '0',
71 PRIMARY KEY (`id`)
72 ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=1");
73mysql_close();
74?>