Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Estilo y edición de usuarios

  • Loading branch information...
commit d665e1fff6fd7988e6592595ba16730842aeb730 1 parent ec3fe34
Oscar authored
2  action/createUser.php
... ... @@ -1,7 +1,5 @@
1 1 <?php
2 2 if($_POST['create']){
3   - $db= new MySQLdBO();
4   - echo $db->connect();
5 3 $user = $_POST['user'];
6 4 $server = $_POST['server'];
7 5 $password = $_POST['password'];
12 action/editUser.php
... ... @@ -0,0 +1,12 @@
  1 +<?php
  2 + $user = $_REQUEST['user'];
  3 + $server = $_REQUEST['server'];
  4 + if($_POST['edit']){
  5 +
  6 + $password = $_POST['password'];
  7 + changePassword($user,$server,$password,$db);
  8 + $messagesOK[] = "Se hacambiado la contrase&ntilde;a";
  9 + }
  10 + $view = "userEditForm";
  11 + $title = "Editar usuario";
  12 +?>
7 db/mysql.php
@@ -57,6 +57,13 @@ function revokePrivileges($user,$server,$privileges,$object,$grant=false,$dbo){
57 57 $GLOBALS['messagesSQL'][]= $query;
58 58 }
59 59 }
  60 +
  61 + function changePassword($user,$server="%",$password,$dbo){
  62 + $query = "SET PASSWORD FOR '" . $user . "'@'".$server."' = PASSWORD('$password'); ";
  63 + $dbo->execQuery($query);
  64 + $query = "SET PASSWORD FOR '" . $user . "'@'".$server."' = PASSWORD('*******'); ";
  65 + $GLOBALS['messagesSQL'][]= $query;
  66 + }
60 67
61 68
62 69 ?>
4 theme/css/style.css
@@ -125,7 +125,7 @@ th {
125 125 text-shadow: 0 1px 0 #FFFFFF;
126 126 }
127 127
128   -table,form {
  128 +table,form ,h2{
129 129 border: 1px solid #CACACA;
130 130 border-radius: 3px 3px 3px 3px;
131 131 margin: 0;
@@ -234,4 +234,4 @@ input[type="text"],input[type="password"]{
234 234 font-size: 14px;
235 235 margin: 10px 0;
236 236 padding: 4px;
237   -}
  237 +}
4 theme/header.php
... ... @@ -1,6 +1,5 @@
1 1 <div id="header">
2   - <h1><img src="theme/images/mysql.gif" width="200px"/> Admin</h1>
3   - <p><a href="index.php?action=logout">Ingresar/Salir</a></p>
  2 + <div><h1><img src="theme/images/mysql.gif" width="200px"/> Admin</h1></div>
4 3 </div>
5 4 <nav id="navmenu" >
6 5 <ul>
@@ -13,4 +12,5 @@
13 12 </li>
14 13
15 14 </ul>
  15 + <ul style="float:right"><li><a href="index.php?action=logout">Ingresar/Salir</a></li></ul>
16 16 </nav>
2  view/listUser.php
@@ -12,7 +12,7 @@
12 12 echo "<tr>";
13 13 echo "<td>".$us->getUser()."</td>";
14 14 echo "<td>".$us->getHost()."</td>";
15   - echo "<td><a href='index.php?action=editUser&userLogin=".$us->getUser()."@".$us->getHost()."'><img src='theme/images/edit.png'></a></td>";
  15 + echo "<td><a href='index.php?action=editUser&user=".$us->getUser()."&server=".$us->getHost()."'><img src='theme/images/edit.png'></a></td>";
16 16 echo "<td><a href='index.php?action=dropUser&userLogin=".$us->getUser()."@".$us->getHost()."'><img src='theme/images/userdel.png'></a></td>";
17 17 echo "<td><a href='index.php?action=privilegios&user=".$us->getUser()."&server=".$us->getHost()."'><img src='theme/images/key.png'></a></td>";
18 18 echo "</tr>";
11 view/userEditForm.php
... ... @@ -0,0 +1,11 @@
  1 +<!--Representa s�lo el formularo de creaci�n de usuarios. -->
  2 +<h2>Editar usuario</h2>
  3 +<p>
  4 +Cambia la contrase&ntilde;a
  5 +</p>
  6 +<form action="index.php?action=editUser" method="post">
  7 +<label for="user">Usuario:</label><input type="text" name="user" value="<?php echo $user ?>"></input><br>
  8 +<label for="server">Servidor:</label><input type="text" name="server" value="<?php echo $server ?>"></input><br>
  9 +<label for="password">Contrase&ntilde;a:</label><input type="password" name="password" ></input><br>
  10 +<input type="submit" name="edit" value="Crear"></input>
  11 +</form>

0 comments on commit d665e1f

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