htmlentities in sql_getparams + check if db not found

This commit is contained in:
Benjamin Sonntag 2016-05-23 16:37:32 +02:00
parent aef4f58e8a
commit 93ce8ffd0f
2 changed files with 18 additions and 7 deletions

View File

@ -38,7 +38,10 @@ if (!$r=$mysql->get_dblist()) {
$error=$err->errstr(); $error=$err->errstr();
} }
$r=$mysql->get_defaultsparam($dbname);
if (!$r) {
$error=$err->errstr();
}
?> ?>
<h3><?php __("MySQL Databases"); ?></h3> <h3><?php __("MySQL Databases"); ?></h3>
@ -47,8 +50,9 @@ if (!$r=$mysql->get_dblist()) {
<?php <?php
if (isset($error) && $error) { if (isset($error) && $error) {
echo "<p class=\"alert alert-danger\">$error</p><p>&nbsp;</p>"; echo "<p class=\"alert alert-danger\">$error</p><p>&nbsp;</p>";
} include_once("foot.php");
$r=$mysql->get_defaultsparam($dbname); exit();
}
?> ?>
<p><?php __("Your current connection settings are"); ?> : </p> <p><?php __("Your current connection settings are"); ?> : </p>
<table class="tedit"> <table class="tedit">
@ -61,7 +65,7 @@ $r=$mysql->get_defaultsparam($dbname);
</tr> </tr>
<tr> <tr>
<th><?php __("Database"); ?></th> <th><?php __("Database"); ?></th>
<td><code><?php echo $dbname; ?></code></td> <td><code><?php ehe($dbname); ?></code></td>
</tr> </tr>
<?php <?php
if(isset($r['user'])){ if(isset($r['user'])){

View File

@ -589,7 +589,8 @@ class m_mysql {
$this->dbus->query("Select * from mysql.db where Db= ? and User!= ? ;", array($dbn, $cuid."_myadm")); $this->dbus->query("Select * from mysql.db where Db= ? and User!= ? ;", array($dbn, $cuid."_myadm"));
if (!$db->num_rows()) { if (!$db->num_rows()) {
return $r; $err->raise("mysql",_("Database not found"));
return false;
} }
while ($db->next_record()) { while ($db->next_record()) {
$variable = $db->Record; $variable = $db->Record;
@ -652,12 +653,18 @@ class m_mysql {
} }
} }
} //endwhile } //endwhile
if (!count($r)) {
$err->raise("mysql",_("Database not found"));
return false;
}
if (!$db->query("SELECT name,password from dbusers where name= ? ;", array($dbu))) { if (!$db->query("SELECT name,password from dbusers where name= ? ;", array($dbu))) {
return $r; $err->raise("mysql",_("Database not found"));
return false;
} }
if (!$db->num_rows()) { if (!$db->num_rows()) {
return $r; $err->raise("mysql",_("Database not found"));
return false;
} }
$db->next_record(); $db->next_record();
$r['user'] = $db->f('name'); $r['user'] = $db->f('name');