' . $lang_title . '';
    }
}
include('lang/' . $install_lang . '/lang.php');
$output_panel = '';
switch ($option) {
    
    case 'license':
        /* ###########
         * # LICENSE #
         */###########
        $license_file = 'LICENSE.txt';
        if (file_exists($license_file)) {
            $fp = fopen($license_file, 'r');
            $license = fread($fp, 88192);
        } else {
            $license = 'No license file.';
        }
        $title = $lang['ins_license'];
        $output_panel = '
        
        ' . $lang['ins_accept'] . '
        ';
        break;
        
    case 'database':
        /* ################
         * # SET DATABASE #
         */################
        if (file_exists('db.php')) {
            $output_panel_info.= $lang['ins_db_exist'] . '
';
        }
        $title = $lang['inst_conn_db'];
        $output_panel = '
            ';
        break;
        
    case 'success':
        /* ##################
         * # CHECK DATABASE #
         */##################
        $conn_install = mysql_connect($_POST['host'] . ':' . $_POST['port'], $_POST['login'], $_POST['pass']);
        if (!$conn_install) {
            die($lang['ins_could_connect'] . ' - ' . mysql_error());
        }
        $create_sql = 'CREATE DATABASE IF NOT EXISTS ' . $_POST['database'];
        mysql_q($create_sql);
        
        $sel_install = mysql_select_db($_POST['database']);
        if (!$sel_install) {
            die($lang['ins_could_connect'] . ' - ' . mysql_error());
        }
        create_table($mysql_tables, $mysql_indexes, $lang, $version, 1);
        
        // create db.php
        $to_write = '';
        $fp = @fopen('db.php', 'w');
        if (!$fp) {
            $title = $lang['ins_error'];
            if (file_exists('db.php')) {
                $output_panel_error.= $lang['ins_file_db_ex'] . ' ' . substr(decoct(fileperms('db.php')), -3) . '
';
            } else {
                $output_panel_error.= $lang['ins_file_db_not'] . ' ' . substr(decoct(fileperms('.')), -3) . '
';
            }
            $output_panel = '
                ' . $lang['ins_file_db_cre'] . ':
                ';
        } else {
            fwrite($fp, $to_write);
            fclose($fp);
            $title = $lang['ins_finished'];
            $output_panel = '' . $lang['ins_admin'] . '';
        }
        
        // delete session var
        $_SESSION = array();
        
        break;
        
    default:
        /* ##########
         * # README #
         */##########
        
        $readme_file = 'lang/' . $_SESSION['install_lang'] . '/readme';
        if (!file_exists($readme_file)) {
            $readme_file = 'README.txt';
        }
        $fp = fopen($readme_file, 'r');
        $readme = fread($fp, 88192);
        $title = $lang['ins_lang_file'];
        $output_panel = '
            
            
            ' . $lang['ins_next'] . '
        ';
        break;
        
}
/* ##############
 * # PANEL INFO #
 */##############
if ($output_panel_info !== '') {
    $output_panel_info = '' . $output_panel_info . '
';
}
if ($output_panel_error !== '') {
    $output_panel_error = '' . $output_panel_error . '
';
}
?>
    
        MovieLib -