} } public function getOneRow($sql) { $res = $this->query($sql); if ($res !== false) { return mysqli_fetch_assoc($res); } else { return false; } } public function getRowsNum($sql) { $query = $this->query($sql); return mysqli_num_rows($query); } private function ErrorMsg($value = '') { if ($value) { echo $value; } else { echo @mysqli_error(); } exit; } } $db = new db_mysqli(); $db->connect(DB_HOST, DB_USER, DB_PWD, DB_NAME); if (function_exists('date_default_timezone_set')) { date_default_timezone_set('PRC'); }
<body> <h1>FutureBB Installation</h1> <?php if (!function_exists('mysqli_connect')) { echo '<p>It appears your server does not have any of the database drivers we support.</p></body></html>'; } if (isset($config['ready'])) { echo '<p>Your forum is pretty much ready! You just need to download your <a href="?downloadcfg">config.xml</a> file and place it in the forum root.</p>'; } else { if (isset($_POST['form_sent_cfg'])) { include FORUM_ROOT . '/app_resources/database/' . $config['db_type'] . '.php'; include FORUM_ROOT . '/app_resources/includes/functions.php'; $db_info = array('host' => $config['db_host'], 'username' => $config['db_user'], 'password' => $config['db_pass'], 'name' => $config['db_name'], 'prefix' => $config['db_prefix']); echo '<p>Testing database '; $db = new db_mysqli($db_info); if (!$db->link) { echo '<b style="color:#F00">[Failed]</b></p></body></html>'; die; } echo '<b style="color:#0A0">[Success]</b></p>'; echo '<p>Updating .htaccess file '; if (!file_exists(FORUM_ROOT . '/htaccess.tpl')) { echo '<b style="color:#F00">[Failed]</b></p></body></html>'; die; } $data = file_get_contents(FORUM_ROOT . '/htaccess.tpl'); $basepath = str_replace('static/install.php', '', $_SERVER['REQUEST_URI']); $data = str_replace('<baseurl>', $basepath, $data); @file_put_contents(FORUM_ROOT . '/.htaccess', $data); if (!strstr(file_get_contents(FORUM_ROOT . '/.htaccess'), $basepath)) {
<?php namespace cd; set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../core/'); require_once 'db_mysqli.php'; die('XXX: need better db testing code'); $db = new db_mysqli(array('host' => 'localhost', 'username' => 'root', 'password' => '')); if (!$db->findDatabase('dbKUK')) { $db->createDatabase('dbKUK'); } $db->selectDatabase('dbKUK'); $layout = array('commentId' => array('bigint:20:unsigned', 'null:NO', 'key:PRI', 'extra:auto_increment'), 'commentType' => array('tinyint:3:unsigned', 'null:NO'), 'commentText' => array('text'), 'commentPrivate' => array('tinyint:3:unsigned', 'null:NO'), 'timeCreated' => array('datetime', 'null:YES'), 'timeDeleted' => array('datetime', 'null:YES'), 'deletedBy' => array('bigint:20:unsigned', 'null:NO'), 'ownerId' => array('bigint:20:unsigned', 'null:NO'), 'userId' => array('bigint:20:unsigned', 'null:NO'), 'userIP' => array('bigint:20:unsigned', 'null:NO')); //$parsed = $db->parseLayout($layout); if (!$db->findTable('tblKEX1')) { if (!$db->createTable('tblKEX1', $layout)) { $db->status(); } } if (!$db->verifyTable('tblKEX1', $layout)) { echo "FAIL1"; }
<?php include_once "config.php"; include_once "includes/db_mysqli.php"; $db = new db_mysqli($config); $created = time(); $username = "******"; $password = "******"; $values = array(&$username, &$created); $db->prepare_insert_query("user", array("username", "created"), $values, array("s", "i")); // testing