Location: PHPKode > projects > Buzzword > buzzword-0.8.12/index.php

 * buzzword
 * Copyright (c) 2003 Jon Tai
 * $Id: index.php,v 1.8 2004/01/08 21:25:19 jon Exp $
 * This file is part of buzzword.
 * buzzword is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * buzzword is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * GNU General Public License for more details.
 * You should have received a copy of the GNU General Public License
 * along with buzzword; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

// check for config file, if found, redirect to default module
if ( (is_file('./includes/config.inc')) && (is_readable('./includes/config.inc')) ) {
    header('Location: ./blog/index.php');

// common functions
require_once './includes/common.inc';

// no config file, show installer page
if (!get_request_var('config-submit')) {
    header('Content-Type: text/html; charset=ISO-8859-1');

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<title>buzzword installer</title>
<link rel="stylesheet" type="text/css" href="style.css">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<td id="content">
<h1>welcome to buzzword</h1>
<div class="content-container">
<p>buzzword requires a configuration file to run.  it appears that you don't 
have one, so you're probably setting up buzzword for the first time.</p>
<p>setting up buzzword is pretty easy.  just fill out the following form, 
and a sample configuration file will be generated for you.  save the file to 
your computer, then upload the file to the following location on the server:</p>
<code><?php echo dirname($_SERVER['SCRIPT_FILENAME']); ?>/includes/config.inc</code>
<h1>generate configuration file</h1>
<div class="content-container">
<form name="config" method="post" action="index.php">
<input type="hidden" name="config-submit" value="1">
<p>admin password:<br>
<input type="text" name="admin_password" class="input"></p>
<p>database host:<br>
<input type="text" name="db_host" value="localhost" class="input"></p>
<p>database username:<br>
<input type="text" name="db_user" value="root" class="input"></p>
<p>database password:<br>
<input type="text" name="db_pass" class="input"></p>
<p>database name:<br>
<input type="text" name="db_name" value="buzzword" class="input"></p>
<p>table prefix:<br>
<input type="text" name="db_prefix" value="buzzword_" class="input"></p>
<p><input type="submit" value="generate" class="submit"></p>

} else {
    // download auto-generated config
    header('Content-Type: text/plain');
    header('Content-Disposition: attachment; filename="config.inc"');

    $file = file('./includes/default-config.inc');
    foreach ($file as $line) {
        $line = preg_replace('/%%ADMIN_PASSWORD%%/', md5(get_request_var('admin_password')), $line);
        $line = preg_replace('/%%DB_HOST%%/', get_request_var('db_host'), $line);
        $line = preg_replace('/%%DB_USER%%/', get_request_var('db_user'), $line);
        $line = preg_replace('/%%DB_PASS%%/', get_request_var('db_pass'), $line);
        $line = preg_replace('/%%DB_NAME%%/', get_request_var('db_name'), $line);
        $line = preg_replace('/%%DB_PREFIX%%/', get_request_var('db_prefix'), $line);
        echo $line;

Return current item: Buzzword