예제 #1
0
<?php

session_start();
if (isset($_SESSION['step1'])) {
    header('location: step2.php');
} else {
    if (isset($_POST['host']) && isset($_POST['user']) && isset($_POST['pass']) && isset($_POST['db'])) {
        $db = verifyConnection($_POST['host'], $_POST['user'], $_POST['pass'], $_POST['db']);
        if ($db) {
            $file = '../includes/config.php';
            $data = file_get_contents($file);
            //data conversion
            $old = array('{host}', '{user}', '{name}', '{pass}');
            $new = array($_POST['host'], $_POST['user'], $_POST['db'], $_POST['pass']);
            $written = str_replace($old, $new, $data);
            $f = fopen($file, 'w');
            fwrite($f, $written);
            fclose($f);
            //IMPLEMENT SQL TABLES & ROWS & DATA
            //banned_ips
            $db->query("CREATE TABLE `banned_ips` (\n            `id` int(11) NOT NULL AUTO_INCREMENT,\n            `ip` varchar(20) COLLATE latin1_german2_ci NOT NULL,\n            PRIMARY KEY (`id`)\n            ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci AUTO_INCREMENT=1 ;");
            //cats
            $db->query("CREATE TABLE `cats` (\n            `id` int(11) NOT NULL AUTO_INCREMENT,\n            `title` varchar(40) COLLATE latin1_german2_ci NOT NULL,\n            `type` int(11) NOT NULL,\n            `pos` int(11) NOT NULL,\n            PRIMARY KEY (`id`)\n            ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci AUTO_INCREMENT=2 ;");
            $db->query("INSERT INTO `cats` VALUES(1, 'Staff', 1, 1)");
            $db->query("INSERT INTO `cats` VALUES(2, 'General', 0, 2)");
            //config
            $db->query("CREATE TABLE `config` (\n            `maintenance` int(11) NOT NULL DEFAULT '0',\n            `floodlimit` int(11) NOT NULL DEFAULT '0',\n            `lastset` int(11) NOT NULL,\n            `postcount` int(11) NOT NULL,\n            `reportforum` int(11) NOT NULL\n            ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_german2_ci;");
            $db->query("INSERT INTO `config` VALUES(0, 15, 1340316455, 0, 2);");
            //dailyscreenshots
            $db->query("CREATE TABLE `dailyscreenshots` (\n            `id` int(11) NOT NULL AUTO_INCREMENT,\n            `filename` varchar(54) NOT NULL,\n            `caption` text NOT NULL,\n            PRIMARY KEY (`id`)\n            ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;");
            //forums
예제 #2
0
파일: cw.php 프로젝트: zendtech/ibmitoolkit
/**
 * i5_output() returns variables from i5_program_call, i5_userspace_get, and sometimes i5_command.
 * 
 * @return bool
 */
function i5_output()
{
    // get connection
    if (!($connection = verifyConnection())) {
        return false;
    }
    // return array of variables. Calling routine can do extract() with it.
    return $connection->getOutputVarsToExport();
}