<?php
function get_mysql_accounts($UID)
{
$UID = (int) $UID;
$result = DB::query("SELECT id, username, description, created FROM misc.mysql_accounts WHERE useraccount=$UID ORDER BY username");
if ($result->num_rows == 0)
return array();
$list = array();
while ($item = $result->fetch_assoc())
{
$list[] = $item;
}
return $list;
}
function get_mysql_databases($UID)
{
$UID = (int) $UID;
$result = DB::query("SELECT id, name, description, created FROM misc.mysql_database WHERE useraccount=$UID ORDER BY name");
if ($result->num_rows == 0)
return array();
$list = array();
while ($item = $result->fetch_assoc())
{
$list[] = $item;
}
return $list;
}
function set_database_description($dbname, $description)
{
$dbs = get_mysql_databases($_SESSION['userinfo']['uid']);
$thisdb = NULL;
foreach ($dbs as $db) {
if ($db['name'] == $dbname) {
$thisdb = $db;