auth->check_module_permissions('sites');
/* get the id of the database (must be int!) */
if (!isset($_GET['id'])){
die ("No DB selected!");
}
$databaseId = intval($_GET['id']);
/*
* Get the data to connect to the database
*/
$dbData = $app->dbmaster->queryOneRecord(
"SELECT sys_userid, sys_groupid, sys_perm_user, sys_perm_group, server_id, database_name, database_user, database_password FROM web_database WHERE database_id = " .
$databaseId);
/*
* We also need the data of the server
*/
$serverId = intval($dbData['server_id']);
if ($serverId == 0){
die ("No DB-Server found!");
}
$serverData = $app->dbmaster->queryOneRecord(
"SELECT server_name FROM server WHERE server_id = " .
$serverId);
/*
* Check if the user has the right to open phpmyadmin with this database
* (we will check only users, not admins)
*/
if($_SESSION["s"]["user"]["typ"] == 'user') {
/* Get the group of the client */
$client_group_id = $_SESSION["s"]["user"]["default_group"];
/* compare both */
if ($dbData['sys_groupid'] != $client_group_id){
die ("You don't have the right to access this db!");
}
}
/*
* Now generate the login-Form
*/
echo '
starting phpMyAdmin...