Example #1
0
<?php

//Log
ini_set("log_errors", "1");
ini_set("error_log", "errors.log");
ini_set("display_errors", "0");
require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/config.php';
require_once __ROOT__ . '/php/utils/db_sql.php';
try {
    if (PDO_DRIVER == 'sqlite') {
        $db = new PDO(PDO_DSN);
    } else {
        $db = new PDO(PDO_DSN, PDO_USER, PDO_PASSWORD);
    }
    if (PDO_DRIVER == 'pgsql') {
        install_pgsql($db, DB_PREFIX);
    } elseif (PDO_DRIVER == 'sqlite') {
        install_sqlite($db, DB_PREFIX);
    } else {
        install_mysql($db, DB_PREFIX);
    }
    print "Success!";
} catch (Exception $e) {
    print "Connection failed : " . $e->getMessage();
}
Example #2
0
             <td height="25"></td>
           </tr>
           <tr>
             <td align="right"><a href="install.php?action=database">&raquo; Weiter</a></td>
           </tr>
         </table>';
         }
     } else {
         include basePath . '/_installer/html/mysql.php';
         include basePath . '/_installer/html/mysql_data.php';
     }
     break;
 case 'database':
     if ($_GET['do'] == "install") {
         if ($_POST['login'] && $_POST['nick'] && $_POST['pwd'] && $_POST['email']) {
             install_mysql($_POST['login'], $_POST['nick'], $_POST['pwd'], $_POST['email']);
             update_mysql_1_4();
             update_mysql_1_5();
             update_mysql_1_5_1();
             update_mysql_1_5_2();
             update_mysql_1_5_4();
             header("Location: install.php?action=done");
         } else {
             echo '<table width="100%" cellpadding="1" cellspacing="1" class="error">
           <tr>
             <td class="error_text"><b>Fehler:</b></td>
           </tr>
           <tr>
             <td class="error_text">Sie haben mindestens ein Feld nicht ausgef&uuml;llt oder die Datenbankverbindung wurde unterbrochen!
             </td>
           </tr>
Example #3
0
<?php

switch ($db_type) {
    case 'mysql':
        install_mysql();
        break;
    case 'access':
        install_access();
        break;
}
function install_mysql()
{
    global $db_host, $db_name, $db_user, $db_pass, $db_prefix;
    $db_host = post('db_host');
    $db_name = post('db_name');
    $db_user = post('db_user');
    $db_pass = post('db_pass');
    $db_prefix = post('db_prefix');
    $help = '';
    if ($db_host == '' || $db_name == '' || $db_user == '') {
        echo '数据库信息不足,安装失败!<br />';
        echo $help;
        exit;
    } elseif (mysql_connect($db_host, $db_user, $db_pass)) {
        if (mysql_select_db($db_name)) {
            echo '连接数据库成功,正在创建数据表...<br />';
        } else {
            echo '数据库' . $db_name . '不存在,正在创建数据库...<br />';
            if (mysql_query('create database ' . $db_name)) {
                echo '创建数据库成功,重新连接数据库...<br />';
                if (!mysql_select_db($db_name)) {
Example #4
0
function selectauth()
{
    global $HTTP_POST_VARS, $INSTALLDIR, $CONFIGFILE;
    //lets test our db access.
    if ($HTTP_POST_VARS['dbtype'] == "mysql") {
        $cont = install_mysql();
    } elseif ($HTTP_POST_VARS['dbtype'] == "pgsql") {
        $cont = install_pgsql();
    } else {
        die("ERROR: UNKNOWN DBMS SELECTED.");
    }
    //if ($cont != 0) we will draw the selectauth form.
    if ($cont != 0) {
        //now we will create the config file contents
        printf("Writing config file: ");
        $config_contents = "<?\r\n";
        $config_contents .= "//****************************************************************************\r\n";
        $config_contents .= "//*     This file was generated by the fishCMS installer.\r\n";
        $config_contents .= "//*     PLEASE DO NOT EDIT THE CONTENTS OF THIS FILE UNLESS YOU ARE 100% SURE!\r\n";
        $config_contents .= "//****************************************************************************\r\n";
        $config_contents .= "\$db_type='" . $HTTP_POST_VARS['dbtype'] . "';\r\n";
        $config_contents .= "\$db_host='" . $HTTP_POST_VARS['db_host'] . "';\r\n";
        $config_contents .= "\$db_username='******'db_username'] . "';\r\n";
        $config_contents .= "\$db_password='******'db_password'] . "';\r\n";
        $config_contents .= "\$db_database='" . $HTTP_POST_VARS['db_database'] . "';\r\n";
        $config_contents .= "\$list_prefix='" . $HTTP_POST_VARS['list_prefix'] . "';\r\n";
        $config_contents .= "?>\r\n";
        if ($file = @fopen($INSTALLDIR . $CONFIGFILE, "w")) {
            fwrite($file, $config_contents);
            fclose($file);
            printf("<font color='#00ff00'>OK</font><br>\r\n");
        } else {
            printf("<font color='#ff0000'>ERROR</font><br>\r\n");
            printf("Please copy and paste the following text in your FishCMS directory as %s<BR>\r\n", $CONFIGFILE);
            printf("<pre>%s</pre>\r\n", htmlspecialchars($config_contents));
            printf("<BR><BR>");
        }
        //now we will draw the authentication table
        printf("<h2>Authentication module selection.</h2>\r\n");
        printf("<form method='post' action='install.php?mode=siteconfig'>\r\n");
        printf("<table border=0>\r\n");
        printf("<tr><td>Authentication type:</td><td><select name='authtype'>\r\n");
        printf("   <option value='fishauth'>FishCMS</option>\r\n");
        printf("   <option value='phpbbauth'>phpBB2</option>\r\n");
        printf("</select></td></tr>\r\n");
        printf("</table>\r\n");
        printf("<input type='submit' value='Next &gt;&gt;'>\r\n");
        printf("</form>\r\n");
    }
}