diff --git a/assets/php/common/manager_dao.php b/assets/php/common/manager_dao.php index 67d4f71..d4002e4 100644 --- a/assets/php/common/manager_dao.php +++ b/assets/php/common/manager_dao.php @@ -15,14 +15,22 @@ //Create a new user Manager. public function createManager($id, $username, $email, $pass, $rol){ - $sql = sprintf( "INSERT INTO `users`( `id`, `username`, `email`, `password`, `rol`) + $password = $this->encryptPass($pass); + $sql = sprintf( "INSERT INTO `users`( `id`, `username`, `email`, `passwd`, `rol`) VALUES ( '%d', '%s', '%s', '%s', '%s')", - $id, $username, $email, $pass, $rol); + $id, $username, $email, $password, $rol); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); return $resul; } + private function encryptPass($password){ + //$password = hash('sha256', $password); + $password = password_hash($password, PASSWORD_DEFAULT); + + return $password; + } + //Returns a query to get All the managers. public function allManagersData(){ @@ -72,9 +80,10 @@ //Edit manager. public function editManager($id, $username, $email, $pass, $rol){ - $sql = sprintf( "UPDATE users SET email = '%s' , pass = '%s', + $password = $this->encryptPass($pass); + $sql = sprintf( "UPDATE users SET email = '%s' , passwd = '%s', WHERE users.id = '%d';", - $email, $pass, $id); + $email, $password, $id); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); diff --git a/panel_admin/manage_managers.php b/panel_admin/manage_managers.php index 34c88b2..12ca0a9 100644 --- a/panel_admin/manage_managers.php +++ b/panel_admin/manage_managers.php @@ -84,10 +84,10 @@ function addManager(){ echo'
-

Añadir promoción

+

Añadir gerente

-
- Datos dela Promoción +
+ Datos del manager
@@ -95,7 +95,10 @@
- + +
+
+
@@ -111,7 +114,7 @@ function deleteManager() { echo'
-

Editar Promoción

+

Borrar gerente

@@ -136,7 +139,7 @@ function editManager() { echo'
-

Editar promoción

+

Editar gerente