Ejemplo n.º 1
0
 //**************PLACE THE DATABASE IS STORED***********//
 $sql = new txtSQL('./data/');
 //***********CONNECT TO DATABASE****************//
 $sql->connect($db_username, $db_password) or die('Unable to Connect To' . $database);
 //**********CREATE THE DATABASE**************//
 $sql->createdb(array('db' => $database)) or die('Error creating txtSQL DB, txtSQL said: ' . $sql->get_last_error());
 //**********SELECT DATABASE TO USE**************//
 if (!$sql->selectdb($database)) {
     print $database . 'Could not be selected, check to make sure it exists';
 }
 //****************CREATE TABLES IN DATABASE*****************//
 $nav = array('id' => array('type' => 'int', 'auto_increment' => 1), 'name' => array('type' => 'string'), 'page' => array('type' => 'string'), 'short_url' => array('type' => 'string'), 'order_id' => array('type' => 'int'));
 $sql->createtable(array('db' => $database, 'table' => 'nav', 'columns' => $nav));
 /*******************************************/
 $nav = array('name' => "News", 'page' => "index.php", 'short_url' => "news");
 if (!$sql->insert(array('db' => $database, 'table' => 'nav', 'values' => $nav))) {
     die('An error occurred, txtSQL said: ' . $sql->get_last_error());
 }
 /********************************************/
 $con = array('id' => array('type' => 'int', 'auto_increment' => 1), 'title' => array('type' => 'string'), 'name' => array('type' => 'string'), 'welcome' => array('type' => 'string'), 'template' => array('type' => 'string'), 'front_page' => array('type' => 'string'), 'date_format' => array('type' => 'string'), 'news_comments' => array('type' => 'int'), 'news_comments_loggedin' => array('type' => 'int'), 'user_reg' => array('type' => 'int'), 'user_active' => array('type' => 'int'), 'min_pass_length' => array('type' => 'int'), 'min_user_length' => array('type' => 'int'), 'login_time' => array('type' => 'int'), 'install_date' => array('type' => 'date'));
 $sql->createtable(array('db' => $database, 'table' => 'config', 'columns' => $con));
 /*******************************************/
 $con = array('title' => "Carbon2 Alpha", 'name' => "Carbon<sup>2</sup> Alpha", 'welcome' => "Welcome to Carbon<sup>2</sup> Alpha", 'date_format' => "M jS, Y @ G:i:s", 'template' => "carbon", 'front_page' => "news", 'news_comments' => "1", 'user_reg' => "1", 'user_active' => "1", 'login_time' => "3600", 'min_pass_length' => "6", 'min_user_length' => "4");
 if (!$sql->insert(array('db' => $database, 'table' => 'config', 'values' => $con))) {
     die('An error occurred, txtSQL said: ' . $sql->get_last_error());
 }
 /*******************************************/
 $users = array('id' => array('type' => 'int', 'auto_increment' => 1), 'active' => array('type' => 'int'), 'rank' => array('type' => 'int'), 'username' => array('type' => 'string'), 'username_f' => array('type' => 'string'), 'password' => array('type' => 'string'), 'email' => array('type' => 'string'), 'show_email' => array('type' => 'int'), 'avatar' => array('type' => 'string'), 'security_q' => array('type' => 'string'), 'security_a' => array('type' => 'string'), 'date' => array('type' => 'date'));
 $sql->createtable(array('db' => $database, 'table' => 'users', 'columns' => $users));
 /*******************************************/
 $usn = strtolower($_POST['admin_username']);