Error! Server configuration problem!';
echo '';
echo 'Missing configuration file `'.$config_file.'`.';
echo '
';
die();
}
require_once($config_file);
require_once("includes/misc.php");
require_once("includes/password_modules.php");
require_once("includes/database.php");
// clean output buffer
ob_end_clean();
$pony_db = new pony_db();
if (!$pony_db->connect($mysql_host, $mysql_user, $mysql_pass))
{
echo 'Error! Server configuration problem!
';
echo '';
echo 'Cannot connect to mysql database, check settings in configuration file `config.php`.
';
echo 'MySQL error: '.mysql_error();
echo '
';
die();
}
if (!$pony_db->select_db($mysql_database))
{
echo 'Error! Server configuration problem!
';
echo '';
echo('Cannot select mysql database, please, check if the `'.$mysql_database.'` database exists or you have enough rights to create new databases.
');
echo 'MySQL error: '.mysql_error().'.';
echo '
';
die();
}
$all_tables_exist = $pony_db->all_tables_exist();
$some_tables_exist = $pony_db->some_tables_exist();
if (!$pony_db->state)
{
echo 'Error! Server configuration problem!
';
echo '';
echo 'Unknown MySQL error occured: '.mysql_error().'.';
echo '
';
die();
}
if (!install_check(false, true))
{
echo 'Attention! Server configuration problem!
';
echo '';
install_check(true, true);
echo '
';
}
$set_admin_pass = trim(assign($_REQUEST['set_admin_pass'])) == '1';
if (!$all_tables_exist && $set_admin_pass)
{
$admin_login = trim(assign($_REQUEST['login']));
$admin_pass = trim(assign($_REQUEST['password']));
$admin_pass_verify = trim(assign($_REQUEST['confirm_password']));
if (!$admin_login)
{
die("Empty login names are now allowed!
Go back and try again.");
}
if (!$admin_pass)
{
die("Empty passwords are now allowed!
Go back and try again.");
}
if ($admin_pass != $admin_pass_verify)
{
die("Admin and confirm passwords mismatch!
Go back and try again.");
}
if ($pony_db->create_tables() && $pony_db->add_user($admin_login, $admin_pass, 'admin_all'))
{
echo "Installation complete!
";
echo "Proceed to administration panel.";
} else
{
die("Installation failed: `".mysql_error()."`");
}
die();
}
if (!$all_tables_exist)
{
if ($some_tables_exist && trim(assign($_REQUEST['delete_tables']) == '1'))
{
$pony_db->delete_tables();
$some_tables_exist = $pony_db->some_tables_exist();
}
if ($some_tables_exist)
{
echo 'Error! Server configuration problem!
';
echo '';
echo 'Missing required MySQL tables. Please, delete Pony MySQL tables and try again.
';
echo '
';
echo 'Delete Pony MySQL tables and restart installation process.';
die();
}
die ("MySQL database installation. Please, provide administrator credentials:");
} else
{
die('Installation complete!
'.
"Proceed to administration panel.".
'
To restart installation process, please, delete MySQL tables.
'
);
}