Bug sur l'edition du mot de passe d'un user SQL inexistant

This commit is contained in:
Alan Garcia 2013-01-31 16:45:20 +00:00
parent 869a871264
commit 6b8965bc45
3 changed files with 25 additions and 15 deletions

View File

@ -34,38 +34,39 @@ $fields = array (
"id" => array ("request", "string", ""), "id" => array ("request", "string", ""),
); );
getFields($fields); getFields($fields);
$r=$mysql->get_user_dblist($id);
?> ?>
<h3><?php __("Change this user's password"); echo " - ".$id ?></h3> <h3><?php __("Change this user's password"); echo " - ".$id ?></h3>
<hr id="topbar"/> <hr id="topbar"/>
<br /> <br />
<?php <?php
if (isset($error) && $error) { $r=$mysql->get_user_dblist($id);
echo "<p class=\"error\">$error</p><p>&nbsp;</p>"; if (!$r) {
} $error=_("This user doesn't exist");
}
if (! empty($error) ) {
echo "<p class=\"error\">$error</p>";
require_once('foot.php');
die();
}
?> ?>
<form method="post" action="sql_users_dopassword.php"> <form method="post" action="sql_users_dopassword.php">
<input type="hidden" name="id" value="<?php echo $id; ?>" /> <input type="hidden" name="id" value="<?php echo $id; ?>" />
<table cellspacing="0" cellpadding="4"> <table cellspacing="0" cellpadding="4" class="tedit">
<tr> <tr>
<td><label for="password"><?php __("Password"); ?></label></td> <th><label for="password"><?php __("Password"); ?></label></th>
<td><input type="password" class="int" name="password" id="password" value="" size="20" maxlength="64" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#password","#passwordconf"); ?></td> <td><input type="password" class="int" name="password" id="password" value="" size="20" maxlength="64" /><?php display_div_generate_password(DEFAULT_PASS_SIZE,"#password","#passwordconf"); ?></td>
</tr> </tr>
<tr> <tr>
<td><label for="passwordconf"><?php __("Confirm password"); ?></label></td> <th><label for="passwordconf"><?php __("Confirm password"); ?></label></th>
<td><input type="password" class="int" name="passwordconf" id="passwordconf" value="" size="20" maxlength="64" /></td> <td><input type="password" class="int" name="passwordconf" id="passwordconf" value="" size="20" maxlength="64" /></td>
</tr> </tr>
<tr>
<td>
<input type="submit" class="inb" value="<?php __("Change user password"); ?>" />
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='sql_users_list.php'"/>
</td>
</tr>
</table> </table>
<br/>
<input type="submit" class="inb" value="<?php __("Change user password"); ?>" />
<input type="button" class="inb" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='sql_users_list.php'"/>
</form> </form>
<?php include_once("foot.php"); ?> <?php include_once("foot.php"); ?>

View File

@ -93,6 +93,9 @@ fieldset {
} }
.inb { .inb {
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
border: 1px solid #999; border: 1px solid #999;
font-family: Verdana, Arial, Helvetica, sans-serif; font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px; font-size: 11px;

View File

@ -783,6 +783,12 @@ class m_mysql {
function get_user_dblist($user){ function get_user_dblist($user){
global $db,$err,$mem,$cuid; global $db,$err,$mem,$cuid;
$this->dbus->query("SELECT * FROM mysql.user WHERE User='".$user."' AND Host='".$this->dbus->Client."';");
if (!$this->dbus->next_record() ) {
$err->raise('mysql',_("This user does not exist in the MySQL/User database"));
return false;
}
$r=array(); $r=array();
$db->free(); $db->free();
$dblist=$this->get_dblist(); $dblist=$this->get_dblist();