* it under the terms of the GNU Affero General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once "agenda.php"; $db = conectaDb(); cabecera("Modificar contacto", MENU_VOLVER); $id = recoger("id"); if ($id > 0) { $consulta = "SELECT * FROM {$dbTablaAgenda}\r\n WHERE id=:id"; $result = $db->prepare($consulta); $result->execute(array(":id" => $id)); $valor = $result->fetch(); print " <form action=\"modificar3.php\" method=\"" . FORM_METHOD . "\">\n"; print " <div style=\"text-align: center\"><h3>Modifique los campos que desee:</h3></div>\n"; print " \n"; ?> <div class="col-md-12" > <table class="table table-striped" style="width: 40%; margin: 0 auto;"> <tbody> <tr>
* any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once "agenda.php"; $db = conectaDb(); cabeceraNuevo("Registro nuevo usuario", MENU_VOLVER); $usuario = recoger("usuario"); $password = recoger("password"); $password2 = recoger("password2"); $usuarioOk = false; $passwordOk = false; $password2Ok = false; $igualesOk = false; if (mb_strlen($usuario, "UTF-8") > $tamNombre) { print " <h4 style='padding-left: 10px'>El usuario no puede tener más de {$tamNombre} caracteres.</h4>\n\n"; } elseif (mb_strlen($usuario, "UTF-8") < 1) { print " <h4 style='padding-left: 10px'>El usuario no puede estar vacío.</h4>\n\n"; } else { $usuarioOk = true; } if (mb_strlen($password, "UTF-8") > $tamPassword) { print " <h4 style='padding-left: 10px'>El Password no pueden tener más de {$tamPassword} caracteres.</h4>\n\n"; } elseif (mb_strlen($password, "UTF-8") < 1) { print " <h4 style='padding-left: 10px'>El password no puede estar vacío.</h4>\n\n";
* This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once "agenda.php"; $db = conectaDb(); cabecera("Añadir contacto", MENU_VOLVER); $nombre = recoger("nombre"); $apellidos = recoger("apellidos"); $telefono = recoger("telefono"); $correo = recoger("correo"); $direccion = recoger("direccion"); $nombreOk = false; $apellidosOk = false; $telefonoOk = false; $correoOk = false; $direccionOk = false; if (mb_strlen($nombre, "UTF-8") > $tamNombre) { print " <h4 style='padding-left: 10px'>El nombre no puede tener más de {$tamNombre} caracteres.</h4>"; } elseif (strlen($nombre) < 1) { print " <h4 style='padding-left: 10px'>El campo Nombre no puede estar vacio</h4>"; } else { $nombreOk = true; } if (mb_strlen($apellidos, "UTF-8") > $tamApellidos) { print " <h4 style='padding-left: 10px'>Los apellidos no pueden tener más de {$tamApellidos} caracteres.</h4>\n\n"; } elseif (strlen($apellidos) < 1) {
* the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once "agenda.php"; $db = conectaDb(); cabecera("Buscar contacto", MENU_VOLVER); $nombre = recoger("nombre"); $apellidos = recoger("apellidos"); $consulta = "SELECT * FROM {$dbTablaAgenda}\r\n WHERE nombre LIKE :nombre\r\n AND apellidos LIKE :apellidos\r\n AND usuario like '{$usuario}'\r\n "; $result = $db->prepare($consulta); $result->execute(array(":nombre" => "%{$nombre}%", ":apellidos" => "%{$apellidos}%")); print " <div style=\"text-align: center\"><h3>Registros encontrados:</h3></div>\n"; ?> <div class="col-md-12" > <table class="table table-striped" style="width: 40%; margin: 0 auto; text-align: center"> <thead> <tr> <th style="text-align: center">Nombre</th> <th style="text-align: center">Apellidos</th> <th style="text-align: center">Telefono</th> <th style="text-align: center">Correo</th> <th style="text-align: center">Direccion</th> </tr>
* the Free Software Foundation, either version 3 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ require_once "agenda.php"; $db = conectaDb(); sinCabecera("Login", MENU_VOLVER); $usuario = recoger("usuario"); $password = recoger("password"); $usuarioOk = false; $passwordOk = false; $consulta = "SELECT * FROM {$dbTablaLogin}"; $result = $db->prepare($consulta); $result->execute(array(":usuario" => "%{$usuario}%", ":password" => "%{$password}%")); foreach ($result as $comprueba) { if ($comprueba[usuario] == $usuario) { $usuarioOk = true; if ($comprueba[password] == $password) { $passwordOk = true; } } } if ($passwordOk && $usuarioOk) { $_SESSION['usuario'] = $usuario;