Location: PHPKode > projects > O - OpenSource GroupWare > osgw/config/create_config.php
<?php
/**************************************************************************
   This program 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.

   @Authors:	Ryan Thompson(hide@address.com)
***************************************************************************/
if($_SERVER['HTTP_REFERER'] != "http://{$_SERVER['HTTP_HOST']}/config/")
{
	//die("Error");
}
include('../osgw/classes/class.config.php');
include('../osgw/global.inc.php');
$setup = new setup();

//First we need a configuration file to work with
if(isset($_POST['continue']))
{
	header("Location: config_setup.php");	
}

if(!$_POST['debug'])
{
	$_POST['debug'] = FALSE;
}
$setup->set_values($_POST);
if(!$setup->verify_password($_POST['db_pass_confirm']))
{
	//If the password verification failed we're returning to index
	//Send back the original values so the user doesn't have to rewrite them.
	$data = urlencode(serialize($_POST));
	header('Location: index.php?fl='. $data .'&r=pass');	
}

if(!$setup->db_test_connection())
{
	//Test Db connection -Same as above.	
	$data = urlencode(serialize($_POST));
	header('Location: index.php?fl='. $data .'&r=db');	
}

$template = $setup->create_config();
	if(isset($_POST['download_config']))
	{
		echo "Download File";
	} elseif(isset($_POST['write_config']))
	{
		$setup->write_file($template);	
	} elseif(isset($_POST['display_config']))
	{
		echo "Print";
	}

	header('Location: general_config.php');
?>

Return current item: O - OpenSource GroupWare