Файл: 4wx.ru/isp/func/db.users.edit.php
Строк: 349
<?php
if (empty($_GET['elid'])) {
if (empty($_POST['submit'])) {
echo '<div class="menu"><img src="images/t-new.png" alt="." />Создание пользователя базы данных ' . htmlentities($_GET['plid'], ENT_QUOTES, 'UTF-8') . '<br />' . "n";
echo '</div>' . "n";
echo '<div class="post"><form action="?func=db.users.edit&plid=' . urlencode($_GET['plid']) . '" method="post">' . "n";
echo 'Имя пользователя:<br />' . "n";
echo '<input name="dbusername" /><br />' . "n";
echo 'Пароль:<br />' . "n";
echo '<input name="dbpassword" type="password" /><br />' . "n";
echo 'Подтверждение:<br />' . "n";
echo '<input name="dbconfirm" type="password" /><br />' . "n";
echo '<input type="checkbox" name="dbuserhost" value="on" /> Удаленный доступ<br />' . "n";
echo '<br />' . "n";
echo 'Доступ к данным:<br />' . "n";
echo '<input type="checkbox" name="select_priv" value="on" checked="checked" /> select<br />' . "n";
echo '<input type="checkbox" name="delete_priv" value="on" checked="checked" /> delete<br />' . "n";
echo '<input type="checkbox" name="insert_priv" value="on" checked="checked" /> insert<br />' . "n";
echo '<input type="checkbox" name="update_priv" value="on" checked="checked" /> update<br />' . "n";
echo 'Доступ к структуре:<br />' . "n";
echo '<input type="checkbox" name="create_priv" value="on" /> create<br />' . "n";
echo '<input type="checkbox" name="drop_priv" value="on" /> drop<br />' . "n";
echo '<input type="checkbox" name="alter_priv" value="on" /> alter<br />' . "n";
echo '<input type="checkbox" name="index_priv" value="on" /> index<br />' . "n";
echo 'Другое:<br />' . "n";
echo '<input type="checkbox" name="grant_priv" value="on" /> grant<br />' . "n";
echo '<input type="checkbox" name="refer_priv" value="on" /> refer<br />' . "n";
echo '<input type="checkbox" name="lock_priv" value="on" /> lock<br />' . "n";
echo '<input name="submit" type="submit" value="Создать" /><br />' . "n";
echo '</form>' . "n";
echo '</div>' . "n";
echo '<div class="menu"><img src="images/t-back.png" alt=".." /><a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Вернуться</a>' . "n</div>";
} else {
if ($_POST['dbpassword'] <> $_POST['dbconfirm'] or $_POST['dbpassword'] == '') {
echo '<div class="post"><div style="text-align:center">' . "n";
echo 'Ошибка при создании пользователя базы данных!<br />' . "n";
echo 'Пароль не подтвержден.<br />' . "n";
echo '<a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Продолжить»</a>' . "n";
echo '</div></div>' . "n";
} else {
$dbuserhost = isset($_POST['dbuserhost'])?'on':'';
$select_priv = isset($_POST['select_priv'])?'on':'';
$delete_priv = isset($_POST['delete_priv'])?'on':'';
$insert_priv = isset($_POST['insert_priv'])?'on':'';
$update_priv = isset($_POST['update_priv'])?'on':'';
$create_priv = isset($_POST['create_priv'])?'on':'';
$drop_priv = isset($_POST['drop_priv'])?'on':'';
$alter_priv = isset($_POST['alter_priv'])?'on':'';
$index_priv = isset($_POST['index_priv'])?'on':'';
$grant_priv = isset($_POST['grant_priv'])?'on':'';
$refer_priv = isset($_POST['refer_priv'])?'on':'';
$lock_priv = isset($_POST['lock_priv'])?'on':'';
$content = api_query('https://' . $server . '/manager/ispmgr?func=db.users.edit&plid=' . urlencode($_GET['plid']) . '&select_priv=' . $select_priv . '&delete_priv=' . $delete_priv . '&insert_priv=' . $insert_priv . '&update_priv=' . $update_priv . '&create_priv=' . $create_priv . '&drop_priv=' . $drop_priv . '&alter_priv=' . $alter_priv . '&index_priv=' . $index_priv . '&grant_priv=' . $grant_priv . '&refer_priv=' . $refer_priv . '&lock_priv=' . $lock_priv . '&dbuserhost=' . $dbuserhost . '&dbconfirm=' . urlencode($_POST['dbconfirm']) . '&dbpassword=' . urlencode($_POST['dbpassword']) . '&dbusername=' . urlencode($_POST['dbusername']) . '&dbuser=newuser&sok=ok&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
$parse_xml = simplexml_load_string($content);
if (isset($parse_xml->ok)) {
echo '<div class="post"><div style="text-align:center">' . "n";
echo 'Пользователь бызы данных успешно создан!<br />' . "n";
echo '<a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Продолжить»</a>' . "n";
echo '</div></div>' . "n";
} else {
echo '<div class="post"><div style="text-align:center">' . "n";
echo 'Ошибка при создании пользователя базы данных!<br />' . "n";
echo '<a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Продолжить»</a>' . "n";
echo '</div></div>' . "n";
}
}
}
} else {
$content = api_query('https://' . $server . '/manager/ispmgr?func=db.users.edit&elid=' . urlencode($_GET['elid']) . '&plid=' . urlencode($_GET['plid']) . '&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
$parse_xml = simplexml_load_string($content);
if (empty($_POST['submit'])) {
echo '<img src="images/t-edit.png" alt="." />Изменение пользователя базы данных ' . htmlentities($_GET['plid'], ENT_QUOTES, 'UTF-8') . '<br />' . "n";
echo '<br />' . "n";
echo '<form action="?func=db.users.edit&elid=' . urlencode($_GET['elid']) . '&plid=' . urlencode($_GET['plid']) . '" method="post">' . "n";
echo 'Имя пользователя:<br />' . "n";
echo '<input name="dbusername" value="' . htmlentities((string)$parse_xml->dbusername, ENT_QUOTES, 'UTF-8') . '" /><br />' . "n";
echo 'Пароль:<br />' . "n";
echo '<input name="dbpassword" type="password" /><br />' . "n";
echo 'Подтверждение:<br />' . "n";
echo '<input name="dbconfirm" type="password" /><br />' . "n";
echo '<input type="checkbox" name="dbuserhost" value="on"';
if (isset($parse_xml->dbuserhost)) {
echo ' checked="checked"';
}
echo ' /> Удаленный доступ<br />' . "n";
echo '<br />' . "n";
echo 'Доступ к данным:<br />' . "n";
echo '<input type="checkbox" name="select_priv" value="on"';
if (isset($parse_xml->select_priv)) {
echo ' checked="checked"';
}
echo ' /> select<br />' . "n";
echo '<input type="checkbox" name="delete_priv" value="on"';
if (isset($parse_xml->delete_priv)) {
echo ' checked="checked"';
}
echo ' /> delete<br />' . "n";
echo '<input type="checkbox" name="insert_priv" value="on"';
if (isset($parse_xml->insert_priv)) {
echo ' checked="checked"';
}
echo ' /> insert<br />' . "n";
echo '<input type="checkbox" name="update_priv" value="on"';
if (isset($parse_xml->update_priv)) {
echo ' checked="checked"';
}
echo ' /> update<br />' . "n";
echo 'Доступ к структуре:<br />' . "n";
echo '<input type="checkbox" name="create_priv" value="on"';
if (isset($parse_xml->create_priv)) {
echo ' checked="checked"';
}
echo ' /> create<br />' . "n";
echo '<input type="checkbox" name="drop_priv" value="on"';
if (isset($parse_xml->drop_priv)) {
echo ' checked="checked"';
}
echo ' /> drop<br />' . "n";
echo '<input type="checkbox" name="alter_priv" value="on"';
if (isset($parse_xml->alter_priv)) {
echo ' checked="checked"';
}
echo ' /> alter<br />' . "n";
echo '<input type="checkbox" name="index_priv" value="on"';
if (isset($parse_xml->index_priv)) {
echo ' checked="checked"';
}
echo ' /> index<br />' . "n";
echo 'Другое:<br />' . "n";
echo '<input type="checkbox" name="grant_priv" value="on"';
if (isset($parse_xml->grant_priv)) {
echo ' checked="checked"';
}
echo ' /> grant<br />' . "n";
echo '<input type="checkbox" name="references_priv" value="on"';
if (isset($parse_xml->references_priv)) {
echo ' checked="checked"';
}
echo ' /> refer<br />' . "n";
echo '<input type="checkbox" name="lock_priv" value="on"';
if (isset($parse_xml->lock_priv)) {
echo ' checked="checked"';
}
echo ' /> lock<br />' . "n";
echo '<input name="submit" type="submit" value="Изменить" /><br />' . "n";
echo '</form>' . "n";
echo '<hr />' . "n";
echo '<img src="images/t-back.png" alt=".." /><a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Вернуться</a>' . "n";
} else {
if ($_POST['dbpassword'] <> $_POST['dbconfirm'] or $_POST['dbpassword'] == '') {
echo '<div style="text-align:center">' . "n";
echo 'Ошибка при изменении пользователя базы данных!<br />' . "n";
echo 'Пароль не подтвержден.<br />' . "n";
echo '<a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Продолжить»</a>' . "n";
echo '</div>' . "n";
} else {
$dbuserhost = isset($_POST['dbuserhost'])?'on':'';
$select_priv = isset($_POST['select_priv'])?'on':'';
$delete_priv = isset($_POST['delete_priv'])?'on':'';
$insert_priv = isset($_POST['insert_priv'])?'on':'';
$update_priv = isset($_POST['update_priv'])?'on':'';
$create_priv = isset($_POST['create_priv'])?'on':'';
$drop_priv = isset($_POST['drop_priv'])?'on':'';
$alter_priv = isset($_POST['alter_priv'])?'on':'';
$index_priv = isset($_POST['index_priv'])?'on':'';
$grant_priv = isset($_POST['grant_priv'])?'on':'';
$references_priv = isset($_POST['references_priv'])?'on':'';
$lock_priv = isset($_POST['lock_priv'])?'on':'';
$content = api_query('https://' . $server . '/manager/ispmgr?func=db.users.edit&plid=' . urlencode($_GET['plid']) . '&select_priv=' . $select_priv . '&delete_priv=' . $delete_priv . '&insert_priv=' . $insert_priv . '&update_priv=' . $update_priv . '&create_priv=' . $create_priv . '&drop_priv=' . $drop_priv . '&alter_priv=' . $alter_priv . '&index_priv=' . $index_priv . '&grant_priv=' . $grant_priv . '&references_priv=' . $references_priv . '&lock_priv=' . $lock_priv . '&dbuserhost=' . $dbuserhost . '&dbconfirm=' . urlencode($_POST['dbconfirm']) . '&dbpassword=' . urlencode($_POST['dbpassword']) . '&dbusername=' . urlencode($_POST['dbusername']) . '&dbuser=' . urlencode($parse_xml->dbusername) . '&sok=ok&out=xml&authinfo=' . urlencode($_SESSION['username']) . ':' . urlencode($_SESSION['password']));
$parse_xml = simplexml_load_string($content);
if (isset($parse_xml->ok)) {
echo '<div style="text-align:center">' . "n";
echo 'Пользователь бызы данных успешно изменен!<br />' . "n";
echo '<a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Продолжить»</a>' . "n";
echo '</div>' . "n";
} else {
echo '<div style="text-align:center">' . "n";
echo 'Ошибка при изменении пользователя базы данных!<br />' . "n";
echo '<a href="?func=db.users&elid=' . urlencode($_GET['plid']) . '">Продолжить»</a>' . "n";
echo '</div>' . "n";
}
}
}
}
?>