bernd
typo
bernd commited c171183 at 2009-09-14 18:32:17
<?php
function get_mysql_accounts($UID)
{
$UID = (int) $UID;
$result = db_query("SELECT username, description, created FROM misc.mysql_accounts WHERE useraccount=$UID");
if (mysql_num_rows($result) == 0)
return array();
$list = array();
while ($item = mysql_fetch_assoc($result))
{
$list[] = $item;
}
return $list;
}
function get_mysql_databases($UID)
{
$UID = (int) $UID;
$result = db_query("SELECT name, description, created FROM misc.mysql_database WHERE useraccount=$UID");
if (mysql_num_rows($result) == 0)
return array();
$list = array();
while ($item = mysql_fetch_assoc($result))
{
$list[] = $item;
}
return $list;
}
function get_mysql_access($db, $account)
{
$uid = $_SESSION['userinfo']['uid'];
global $mysql_access;
if (!is_array($mysql_access))
{
$mysql_access = array();
$result = db_query("SELECT db.name AS db, acc.username AS user FROM misc.mysql_access AS access LEFT JOIN misc.mysql_database AS db ON (db.id=access.database) LEFT JOIN misc.mysql_accounts AS acc ON (acc.id = access.user) WHERE acc.useraccount={$uid} OR db.useraccount={$uid};");
if (mysql_num_rows($result) == 0)
return false;
while ($line = mysql_fetch_object($result))
$mysql_access[$line->db][$line->user] = true;
}
return (array_key_exists($db, $mysql_access) && array_key_exists($account, $mysql_access[$db]));
}
function set_mysql_access($db, $account, $status)
{
$uid = $_SESSION['userinfo']['uid'];
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX