* @version 2.0 * @package Configuration * @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org
The contents of this file are subject to the Mozilla Public License Version 1.1 * @filesource * @license http://www.mozilla.org/MPL/ MPL */ /******************************************************************************************** * check, if user is logged in as administrator, if not permission denied * *********************************************************************************************/ if (!isset($_SESSION['admin']) || !$_SESSION['admin']) { $sql= "SELECT ID_User FROM user"; $result = mysqli_query($GLOBALS["___mysqli_ston"], $sql); if(mysqli_num_rows($result) > 0) { $TestAdmin = false; echo "Sorry, you don't have permission for editing connection parameters! Please login as administrator or contact an admin."; } else { $Test = true; } } if($Test == "true" or (isset($_SESSION['admin']) || $_SESSION['admin'])) { ?> "; $test = true; } if($_POST['host'] == "") { echo ""; $test = true; } if($_POST['database'] == "") { echo ""; $test = true; } if($_POST['user'] == "") { echo ""; $test = true; } if($test != true) { /******************************************************************************************** * saving database connection parameters into an xml file (config/provider.xml) * * START * *********************************************************************************************/ if(file_exists("config/provider.xml")) { $file = "config/provider.xml"; } else { $file = "../config/provider.xml"; } $newfile = fopen($file,"w+"); rewind($newfile); $newxml = ' '.$_REQUEST['DBMS'].' '.$_REQUEST['host'].' '.$_REQUEST['database'].' '.$_REQUEST['user'].' '.$_REQUEST['password'].' '; fwrite($newfile, $newxml); fclose($newfile); } } /******************************************************************************************** * saving database connection parameters into an xml file (config/provider.xml) * * END * *********************************************************************************************/ if(file_exists("config/loaddnaprovider.php")) { /** * Start page, try to load exiting xml parser, just in case connection has been set up already, (config/loaddnaprovider.php -> config/provider.xml) */ include ("config/loaddnaprovider.php"); } else { /** * Start page, alternative path for xml parser */ include("../config/loaddnaprovider.php");} echo ""; ?>
Please select a DBMS!
Please enter the host of the database!
Please select the database!
Please enter the user!
Connection to database: "; if($DBMS == "mysql") { $connID = @($GLOBALS["___mysqli_ston"] = mysqli_connect($host, $user, $passwd)); if ($connID) { $connection = ((bool)mysqli_query($GLOBALS["___mysqli_ston"], "USE $dbname")); if($connection) { echo "OK"; } if(!$connection) { echo "Not OK"; }} if(!$connID) { echo "Not OK"; } } echo "
DBMS Currently only MySQL can be used as database management system for DNA Module.
Host The host of the database.
Database The name of the database.
User User name.
Password Password, can be left empty if not assigned.