Skip to content
Browse files

Estilo y edición de usuarios

  • Loading branch information...
1 parent ec3fe34 commit d665e1fff6fd7988e6592595ba16730842aeb730 @racSOker committed Apr 21, 2012
Showing with 35 additions and 7 deletions.
  1. +0 −2 action/createUser.php
  2. +12 −0 action/editUser.php
  3. +7 −0 db/mysql.php
  4. +2 −2 theme/css/style.css
  5. +2 −2 theme/header.php
  6. +1 −1 view/listUser.php
  7. +11 −0 view/userEditForm.php
View
2 action/createUser.php
@@ -1,7 +1,5 @@
<?php
if($_POST['create']){
- $db= new MySQLdBO();
- echo $db->connect();
$user = $_POST['user'];
$server = $_POST['server'];
$password = $_POST['password'];
View
12 action/editUser.php
@@ -0,0 +1,12 @@
+<?php
+ $user = $_REQUEST['user'];
+ $server = $_REQUEST['server'];
+ if($_POST['edit']){
+
+ $password = $_POST['password'];
+ changePassword($user,$server,$password,$db);
+ $messagesOK[] = "Se hacambiado la contrase&ntilde;a";
+ }
+ $view = "userEditForm";
+ $title = "Editar usuario";
+?>
View
7 db/mysql.php
@@ -57,6 +57,13 @@ function revokePrivileges($user,$server,$privileges,$object,$grant=false,$dbo){
$GLOBALS['messagesSQL'][]= $query;
}
}
+
+ function changePassword($user,$server="%",$password,$dbo){
+ $query = "SET PASSWORD FOR '" . $user . "'@'".$server."' = PASSWORD('$password'); ";
+ $dbo->execQuery($query);
+ $query = "SET PASSWORD FOR '" . $user . "'@'".$server."' = PASSWORD('*******'); ";
+ $GLOBALS['messagesSQL'][]= $query;
+ }
?>
View
4 theme/css/style.css
@@ -125,7 +125,7 @@ th {
text-shadow: 0 1px 0 #FFFFFF;
}
-table,form {
+table,form ,h2{
border: 1px solid #CACACA;
border-radius: 3px 3px 3px 3px;
margin: 0;
@@ -234,4 +234,4 @@ input[type="text"],input[type="password"]{
font-size: 14px;
margin: 10px 0;
padding: 4px;
-}
+}
View
4 theme/header.php
@@ -1,6 +1,5 @@
<div id="header">
- <h1><img src="theme/images/mysql.gif" width="200px"/> Admin</h1>
- <p><a href="index.php?action=logout">Ingresar/Salir</a></p>
+ <div><h1><img src="theme/images/mysql.gif" width="200px"/> Admin</h1></div>
</div>
<nav id="navmenu" >
<ul>
@@ -13,4 +12,5 @@
</li>
</ul>
+ <ul style="float:right"><li><a href="index.php?action=logout">Ingresar/Salir</a></li></ul>
</nav>
View
2 view/listUser.php
@@ -12,7 +12,7 @@
echo "<tr>";
echo "<td>".$us->getUser()."</td>";
echo "<td>".$us->getHost()."</td>";
- echo "<td><a href='index.php?action=editUser&userLogin=".$us->getUser()."@".$us->getHost()."'><img src='theme/images/edit.png'></a></td>";
+ echo "<td><a href='index.php?action=editUser&user=".$us->getUser()."&server=".$us->getHost()."'><img src='theme/images/edit.png'></a></td>";
echo "<td><a href='index.php?action=dropUser&userLogin=".$us->getUser()."@".$us->getHost()."'><img src='theme/images/userdel.png'></a></td>";
echo "<td><a href='index.php?action=privilegios&user=".$us->getUser()."&server=".$us->getHost()."'><img src='theme/images/key.png'></a></td>";
echo "</tr>";
View
11 view/userEditForm.php
@@ -0,0 +1,11 @@
+<!--Representa s—lo el formularo de creaci—n de usuarios. -->
+<h2>Editar usuario</h2>
+<p>
+Cambia la contrase&ntilde;a
+</p>
+<form action="index.php?action=editUser" method="post">
+<label for="user">Usuario:</label><input type="text" name="user" value="<?php echo $user ?>"></input><br>
+<label for="server">Servidor:</label><input type="text" name="server" value="<?php echo $server ?>"></input><br>
+<label for="password">Contrase&ntilde;a:</label><input type="password" name="password" ></input><br>
+<input type="submit" name="edit" value="Crear"></input>
+</form>

0 comments on commit d665e1f

Please sign in to comment.
Something went wrong with that request. Please try again.