Exemple #1
0
         $Beans->eliminarUsuario($_SESSION['valid_user']);
         eliminarSesion();
     } else {
         if (isset($_POST['modificar'])) {
             $Beans->modificarUsuario($_POST['nombre'], $_POST['apellido'], $_SESSION['valid_user'], $_POST['password']);
             header('Location: index.php');
         }
     }
 } else {
     if (isset($_GET['accion']) and strcmp($_GET['accion'], "logout") == 0) {
         eliminarSesion();
     } else {
         if (isset($_GET['accion']) and strcmp($_GET['accion'], "addProducto") == 0) {
             $carrito = new carrito();
             $producto = array("id" => $_POST['id'], "cantidad" => $_POST['cantidad'], "precio" => $_POST['precio'], "nombre" => $_POST['nombre']);
             $carrito->add($producto);
             header('Location: cesta.php');
         } else {
             if (isset($_GET['accion']) and strcmp($_GET['accion'], "modificarCesta") == 0) {
                 $carrito = new carrito();
                 if (isset($_POST['Eliminar'])) {
                     $carrito->remove_producto($_POST['id']);
                 } else {
                     if (isset($_POST['Modificar'])) {
                         $carrito->modificar_cantidad($_POST['id'], $_POST['cantidad']);
                     }
                 }
                 header('Location: cesta.php');
             } else {
                 if (isset($_GET['accion']) and strcmp($_GET['accion'], "confirmar") == 0) {
                     header('Location: checkout.php');