owls

annotate Setup.php @ 0:3021ce32ee14

begin of using hg for owls
author "Meillo r e t u r n s <meillo@marmaro.de>"
date Sun, 03 Dec 2006 22:32:13 +0100
parents
children 144bc36a6c27
rev   line source
meillo@0 1 <?php
meillo@0 2
meillo@0 3 // you can customize the config here
meillo@0 4
meillo@0 5 $dbPrefix = 'rem__2_'; // the names of the db-tables will be prefixed with this string
meillo@0 6
meillo@0 7 //$modifyProtected = true; // are guests allowed to modify data? (true or false)
meillo@0 8
meillo@0 9 $defaultUser = 'admin'; // useraccount if "modifyProtected = true" above
meillo@0 10 $defaultUserPassword = 'admin'; // password for useraccount if "modifyProtected = true" above
meillo@0 11
meillo@0 12
meillo@0 13
meillo@0 14 // dont change anything form here on (except you know what you do)
meillo@0 15 //##################################################################
meillo@0 16
meillo@0 17 // write db-login-data to textfile
meillo@0 18
meillo@0 19
meillo@0 20 // connect to db and create tables
meillo@0 21 require('../Db.inc.php');
meillo@0 22
meillo@0 23
meillo@0 24 // table 'Owls' for the content data
meillo@0 25 mysql_query("
meillo@0 26 CREATE TABLE IF NOT EXISTS `". $dbPrefix ."Owls` (
meillo@0 27 `id` int(11) NOT NULL auto_increment,
meillo@0 28 `idParent` int(11) default '0',
meillo@0 29 `name` text NOT NULL,
meillo@0 30 `text` longtext NOT NULL,
meillo@0 31 `permission` tinyint(4) NOT NULL default '1',
meillo@0 32 `date` int(11) NOT NULL default '0',
meillo@0 33 PRIMARY KEY (`id`)
meillo@0 34 )
meillo@0 35 ") or die(mysql_error());
meillo@0 36
meillo@0 37 // insert startup nodes
meillo@0 38 mysql_query("INSERT INTO `". $dbPrefix ."Owls` VALUES (1, 0, 'Index', 'Thanks for using [url=http://prog.marmaro.de/owls/]Owls[/url]!', 0, now())") or die(mysql_error());
meillo@0 39
meillo@0 40
meillo@0 41
meillo@0 42 // login should be managed via text file in future
meillo@0 43 mysql_query("CREATE TABLE IF NOT EXISTS `". $dbPrefix ."User` (
meillo@0 44 `id` int(11) NOT NULL auto_increment,
meillo@0 45 `loginname` tinytext NOT NULL,
meillo@0 46 `password` tinytext NOT NULL,
meillo@0 47 PRIMARY KEY (`id`)
meillo@0 48 )") or die(mysql_error());
meillo@0 49
meillo@0 50 mysql_query("INSERT INTO `". $dbPrefix ."User` VALUES (1, '". $defaultUser ."', '". md5($defaultUserPassword) ."')") or die(mysql_error());
meillo@0 51
meillo@0 52 ?>