Skip to content

Commit

Permalink
error 404 redirigie en funcion de admin o no
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelLucendo committed Jan 26, 2023
1 parent f4aadec commit 9f164c4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion controller/Controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

class Controller {

public function carga404() {
public function carga404($admin) {
include 'view/admin/error-404.php';
}
public function muestraHome() {
Expand Down
4 changes: 2 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
$c->muestraFichaProducto((int)$array_ruta[2]);
} else {
$c = new Controller;
$c->carga404();
$c->carga404(true);
}

// Quiere hacer consultas a la api de la aplicación
Expand Down Expand Up @@ -152,6 +152,6 @@
$fc->muestraPanelUsuario();
} else { // No ha encontrado la ruta a la que quiere acceder el usuario
$c = new Controller;
$c->carga404();
$c->carga404(false);
}
}
6 changes: 5 additions & 1 deletion view/admin/error-404.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@
</div>
<div class="row mt-5">
<div class="col-12 text-center mt-xl-2">
<a class="text-white font-weight-medium" href="index.php/admin/home">Volver a la home</a>
<?php if ($admin) { ?>
<a class="text-white font-weight-medium" href="index.php/admin/home">Volver a la home</a>
<?php } else { ?>
<a class="text-white font-weight-medium" href="index.php/home">Volver a la home</a>
<?php } ?>
</div>
</div>
<div class="row mt-5">
Expand Down

0 comments on commit 9f164c4

Please sign in to comment.