} } } } } } } } } } } else { $function = $_GET["function"]; if ($function == 'getHistoricoPedidos') { getHistoricoPedidos($_GET["cliente_id"]); } elseif ($function == 'getClientes') { getClientes(); } elseif ($function == 'getFotos') { getFotos(); } elseif ($function == 'getDescargas') { getDescargas(); } elseif ($function == 'getCupones') { getCupones($_GET["cliente_id"], $_GET["numero"]); } } function forgotPassword($email) { $db = new MysqliDb(); $options = ['cost' => 12]; $new_password = randomPassword(); $password = password_hash($new_password, PASSWORD_BCRYPT, $options); $data = array('password' => $password);
include_once $_SERVER['DOCUMENT_ROOT'] . "/vistas/barraMenu.php"; ?> </header> <div id="main"> <h2>Lista de Clientes:</h2> <?php include_once $_SERVER['DOCUMENT_ROOT'] . "/dominio/Cliente.php"; include_once $_SERVER['DOCUMENT_ROOT'] . "/repositorio/repositorioClientes.php"; $username = $_SESSION['username']; $password = $_SESSION['password']; echo "<table id=\"example\" class=\"display\" cellspacing=\"0\" width=\"100%\">"; echo "<thead>\n <tr>\n <th>Nombre</th>\n <th>DNI</th>\n <th>Teléfono</th>\n <th>Email</th>\n <th>Zona</th>\n <th></th>\n </tr>\n </thead>"; echo "<tfoot>\n <tr>\n <th>Nombre</th>\n <th>DNI</th>\n <th>Teléfono</th>\n <th>Email</th>\n <th>Zona</th>\n <th></th>\n </tr>\n </tfoot>"; $array = getClientes($username, $password); echo "<tbody>"; if ($username == 'admin') { foreach ($array as $clave => $valor) { echo "<tr>"; echo "<td>" . $valor->getNombre() . "</td>"; echo "<td>" . $valor->getDNI() . "</td>"; echo "<td>" . $valor->getTelefono() . "</td>"; echo "<td>" . $valor->getEmail() . "</td>"; echo "<td>" . $valor->getCreadoPor() . "</td>"; echo '<td><a href="crearReparacion.php?id=' . $valor->getId() . '"><img class="icono" src="../images/tools.ico"/></a><a href="editarCliente.php?id=' . $valor->getId() . '"><img class="icono" src="../images/edit.png"/></a></td>'; echo "</tr>"; } } else { foreach ($array as $clave => $valor) { if ($valor->getCreadoPor() == 'empleado') {
<?php include "db.php"; include "clienteDaoTest.php"; if ($_SERVER['REQUEST_METHOD'] == "GET") { if ($_GET["id"]) { return getClienteById($db, $_GET["id"]); } else { return getClientes($db); } } if ($_SERVER['REQUEST_METHOD'] == "POST") { $postdata = file_get_contents("php://input"); $request = json_decode($postdata); return saveCliente($db, $request); } if ($_SERVER['REQUEST_METHOD'] == "PUT") { $postdata = file_get_contents("php://input"); $request = json_decode($postdata); return updateCliente($db, $request); }
/* Entrar a edición de una planta */ /**************************************************************************************************/ if (isset($_POST['accion']) and $_POST['accion'] == 'Editar') { include direction . functions . 'conectadb.inc.php'; $id = $_POST['id']; try { $sql = 'SELECT * FROM plantastbl WHERE id=:id'; $s = $pdo->prepare($sql); $s->bindValue(':id', $id); $s->execute(); $valores = $s->fetch(); } catch (PDOException $e) { $mensaje = 'Hubo un error al tratar de insertar la planta. Favor de intentar nuevamente.' . $e; throwError($mensaje); } $clientes = getClientes(); $pestanapag = 'Editar planta'; $titulopagina = 'Editar una planta'; $boton = 'Salvar Planta'; include 'formacapturaplanta.html.php'; exit; } /**************************************************************************************************/ /* Salvar edición de una planta */ /**************************************************************************************************/ if (isset($_POST['accion']) and $_POST['accion'] == 'Salvar Planta') { include direction . functions . 'conectadb.inc.php'; try { $pdo->beginTransaction(); $sql = 'UPDATE plantastbl SET razonsocial=:razonsocial,
// WEBSERVICES DE LA TABLA LEADS (clientes potenciales) //-------------------------------------------------------------------------------------------------- $app->get('/getClientes', function () { //Importa el archivo que contiene el método require_once 'Servicios/getClientes.php'; $app = new \Slim\Slim(); require_once 'Servicios/Auth.php'; $deviceId = $app->request->headers->get('deviceID'); $hash = $app->request->headers->get('hash'); $respuesta = auth($deviceId, $hash); if ($respuesta != "Auth_OK") { echo $respuesta; return; } //LLama el método que lee de la base de datos y obtiene la respuesta $respuesta = getClientes(); //Muestra la respuesta al cliente echo $respuesta; }); //-------------------------------------------------------------------------------------------------- $app->get('/getCliente', function () { //Importa el archivo que contiene el método require_once 'Servicios/getCliente.php'; $app = new \Slim\Slim(); require_once 'Servicios/Auth.php'; $deviceId = $app->request->headers->get('deviceID'); $hash = $app->request->headers->get('hash'); $respuesta = auth($deviceId, $hash); if ($respuesta != "Auth_OK") { echo $respuesta; return;