From 9d58f0fc09a8773137f313e3ee2e01333428b831 Mon Sep 17 00:00:00 2001 From: Ada Date: Wed, 12 Feb 2020 12:18:32 -0500 Subject: [PATCH 1/2] Se agrgaron configuraciones al .htaccess --- .htaccess | 33 +++++++++++++++++++++++ controladores/formularios.controlador.php | 4 +-- 2 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .htaccess diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..e793d18 --- /dev/null +++ b/.htaccess @@ -0,0 +1,33 @@ +Options All -Indexes + +RewriteEngine On + +RewriteRule ^([a-zA-Z0-9/]+$) index.php?pagina=$1 + +#asegurando el archivo htaccess + + +order allow, deny +deny from allow + + +#denegar acceso a robots maliciosos, extractores webs y navegadores offline + +RewriteBase / +RewriteCond %{HTTP_USER_AGENT} ^Anarchie [OR] +RewriteCond %{HTTP_USER_AGENT} ^ASPSeek [OR] +RewriteCond %{HTTP_USER_AGENT} ^attach [OR] +RewriteCond %{HTTP_USER_AGENT} ^autoemailspider [OR] +RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR] +RewriteCond %{HTTP_USER_AGENT} ^Xenu [OR] +RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR] +RewriteCond %{HTTP_USER_AGENT} ^Zeus +RewriteRule ^.* - [F,L] + +#https://uniwebsidad.com/tutoriales/trucos-y-ejemplos-de-configuracion-del-archivo-htaccess-de-apache?from=librosweb + +#https://ayudawp.com/todo-sobre-htaccess/#Limitando_metodos_de_peticion_GET_yPUT_al_servidor + +#http://www.emenia.es/como-crear-urls-amigables-con-htaccess/ + +#https://www.webempresa.com/blog/codigos-utiles-htaccess-para-wordpress.html \ No newline at end of file diff --git a/controladores/formularios.controlador.php b/controladores/formularios.controlador.php index 549907f..070f106 100644 --- a/controladores/formularios.controlador.php +++ b/controladores/formularios.controlador.php @@ -63,7 +63,7 @@ public function ctrIngreso(){ if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } - window.location = "index.php?pagina=inicio" + window.location = "inicio" '; }else{ @@ -175,7 +175,7 @@ public function ctrEliminarRegistro(){ if ( window.history.replaceState ) { window.history.replaceState( null, null, window.location.href ); } - window.location = "index.php?pagina=inicio" + window.location = "inicio" '; From 52a93b1f9893d891290ba9adf54396a8f27bb171 Mon Sep 17 00:00:00 2001 From: Ada Date: Wed, 12 Feb 2020 14:00:16 -0500 Subject: [PATCH 2/2] =?UTF-8?q?Se=20hicieron=20cambios=20a=20=C3=BAltima?= =?UTF-8?q?=20hora?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .htaccess | 26 ----------------------- controladores/formularios.controlador.php | 6 ++++-- modelos/formularios.modelo.php | 5 +++-- vistas/paginas/editar.php | 1 + 4 files changed, 8 insertions(+), 30 deletions(-) diff --git a/.htaccess b/.htaccess index e793d18..3d91ae6 100644 --- a/.htaccess +++ b/.htaccess @@ -4,30 +4,4 @@ RewriteEngine On RewriteRule ^([a-zA-Z0-9/]+$) index.php?pagina=$1 -#asegurando el archivo htaccess - -order allow, deny -deny from allow - - -#denegar acceso a robots maliciosos, extractores webs y navegadores offline - -RewriteBase / -RewriteCond %{HTTP_USER_AGENT} ^Anarchie [OR] -RewriteCond %{HTTP_USER_AGENT} ^ASPSeek [OR] -RewriteCond %{HTTP_USER_AGENT} ^attach [OR] -RewriteCond %{HTTP_USER_AGENT} ^autoemailspider [OR] -RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR] -RewriteCond %{HTTP_USER_AGENT} ^Xenu [OR] -RewriteCond %{HTTP_USER_AGENT} ^Zeus.*Webster [OR] -RewriteCond %{HTTP_USER_AGENT} ^Zeus -RewriteRule ^.* - [F,L] - -#https://uniwebsidad.com/tutoriales/trucos-y-ejemplos-de-configuracion-del-archivo-htaccess-de-apache?from=librosweb - -#https://ayudawp.com/todo-sobre-htaccess/#Limitando_metodos_de_peticion_GET_yPUT_al_servidor - -#http://www.emenia.es/como-crear-urls-amigables-con-htaccess/ - -#https://www.webempresa.com/blog/codigos-utiles-htaccess-para-wordpress.html \ No newline at end of file diff --git a/controladores/formularios.controlador.php b/controladores/formularios.controlador.php index 070f106..cb4316f 100644 --- a/controladores/formularios.controlador.php +++ b/controladores/formularios.controlador.php @@ -118,7 +118,7 @@ static public function ctrActualizarRegistro(){ $compararToken = md5($usuario["nombre"]."+".$usuario["email"]); - if($compararToken == $_POST["tokenUsuario"]){ + if($compararToken == $_POST["tokenUsuario"] && $_POST["idUsuario"] == $usuario["id"]){ if(isset($_POST["actualizarPassword"]) != ""){ @@ -131,9 +131,11 @@ static public function ctrActualizarRegistro(){ }else{ $password = $_POST["passwordActual"]; } - + $tabla = "registros"; + $actualizarToken = md5($_POST["actualizarNombre"]."+".$_POST["actualizarPassword"]); $datos = array( + "id" => $_POST["idUsuario"], "token" => $_POST["tokenUsuario"], "nombre" => $_POST["actualizarNombre"], "email" => $_POST["actualizarEmail"], diff --git a/modelos/formularios.modelo.php b/modelos/formularios.modelo.php index 8286acd..b581df0 100644 --- a/modelos/formularios.modelo.php +++ b/modelos/formularios.modelo.php @@ -63,13 +63,14 @@ static public function mdlActualizarRegristro($tabla, $datos){ #prepare previene inyeccioes SQL - $stmt = Conexion::conectar()->prepare("UPDATE registros SET nombre = :nombre, email = :email, - password = :password WHERE token = :token"); + $stmt = Conexion::conectar()->prepare("UPDATE registros SET token = :token, nombre = :nombre, email = :email, + password = :password WHERE id = :id"); $stmt->bindParam(":nombre", $datos["nombre"], PDO::PARAM_STR); $stmt->bindParam(":email", $datos["email"], PDO::PARAM_STR); $stmt->bindParam(":password", $datos["password"], PDO::PARAM_STR); $stmt->bindParam(":token", $datos["token"], PDO::PARAM_STR); + $stmt->bindParam(":id", $datos["id"], PDO::PARAM_INT); if($stmt->execute()){ return "ok"; diff --git a/vistas/paginas/editar.php b/vistas/paginas/editar.php index 82baa2f..c74ff33 100644 --- a/vistas/paginas/editar.php +++ b/vistas/paginas/editar.php @@ -39,6 +39,7 @@ "> "> + ">