-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathportal.php
115 lines (101 loc) · 3.28 KB
/
portal.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?php
//view_form.php
/**
* * Descripción: Ejemplo de proyecto
* *
* *
* *
* * @author Rafael Berlanga
* * @copyright 2020 Rafa B.
* * @license http://www.fsf.org/licensing/licenses/gpl.txt GPL 2 or later
* * @version 1
* */
session_start();
include(dirname(__FILE__)."/includes/ejecutarSQL.php");
include(dirname(__FILE__)."/partials/header.php");
include(dirname(__FILE__)."/partials/menu.php");
include(dirname(__FILE__)."/includes/conector_BD.php");
include(dirname(__FILE__)."/includes/table2html.php");
include(dirname(__FILE__)."/includes/registrar_usuario.php");
include(dirname(__FILE__)."/includes/autentificar_usuario.php");
include(dirname(__FILE__)."/includes/registrar_producto.php");
include(dirname(__FILE__)."/includes/añadirCesta.php");
include(dirname(__FILE__)."/includes/verCesta.php");
include(dirname(__FILE__)."/includes/eliminarDeCesta.php");
include(dirname(__FILE__)."/includes/realizarCompra.php");
include(dirname(__FILE__)."/partials/ventanita.php");
include(dirname(__FILE__)."/includes/phpToJs.php");
include(dirname(__FILE__)."/partials/cestaV2.php");
//include(dirname(__FILE__)."/includes/visor.php");
if (isset($_REQUEST['action'])) {
$action = $_REQUEST["action"];
} else {
$action = "home";
}
switch ($action) {
case "home":
$central = "/partials/centro.php";
break;
case "login":
$central = "/partials/login.php"; //formulario login
break;
case "do_login":
$central = autentificar_usuario(); //fijar $_SESSION["usuario"]
break;
case "registrar_usuario":
$central = "/partials/registro_usuario.php"; //formulario usuarios
break;
case "insertar_usuario":
$central = registrar_usuario("clientes_portal"); //tabla usuarios
break;
case "listar_productos":
$central = "/includes/visor.php";
//tabla productos
break;
case "registrar_producto":
$central = "/partials/registro_producto.php"; //formulario producto
break;
case "insertar_producto":
$central = registro_p("productos"); //tabla productos
break;
case "ver_cesta":
$central = verCesta(); //cesta en $_SESSION["cesta"]
break;
case "comprar":
$central = realizarCompra("compras"); //tabla compras
break;
case "realizar_compra":
if ($_SESSION["id_usuario"]=="") {
$central = "/partials/login.php";
} else {
$central = realizarCompra("compras");
} //cesta en $_SESSION["cesta"]
break;
case "filtrar_precio":
$central = "/includes/visor.php";
break;
case "logout":
$_SESSION["usuario"] = null;
$_SESSION["id_usuario"] = "";
$_SESSION["cesta"] = null;
$central="/partials/centro.php";
header("Location: http://localhost:3000/portal.php?action=home");
exit();
break;
case "add":
$central=añadirCesta();
break;
case "delete":
$central=eliminarDeCesta();
break;
case "upload":
$central = subirImagen();
break;
default:
$data["error"] = "Accion No permitida";
$central = "/partials/centro.php";
}
if ($central <> "") {
include(dirname(__FILE__).$central);
}
include(dirname(__FILE__)."/partials/footer.php");