<?php include './conexion.php'; include './DAOAdministracion/DAOUsuarios.php'; $cn = new conexion(); $dao = new DAOUsuarios(); $cn->conectarse(); $rs = $dao->dameUsuarios(); if ($rs == false) { echo mysql_error(); } else { if (mysql_affected_rows() > 0) { ?> <table class="table"> <thead> <th>Nombre</th> <th>Apellidos</th> <th>Correo</th> <th>Telefono</th> </thead> <tr> <?php while ($rsDatosUsuario = mysql_fetch_array($rs)) { ?> <td><?php echo $rsDatosUsuario["nombre"]; ?> </td> <td><?php echo $rsDatosUsuario["apellidoPaterno"] . " " . $rsDatosUsuario["apellidoMaterno"]; ?>
/** * Valida que se este autorizado para ejecutar el modulo * @param string $metodo */ protected function _seguridad($metodo) { $tipo_seguridad = $this->_metodos[$metodo]; switch ($tipo_seguridad) { case "session": $id_usuario = Usuario::getId(); $DAOUsuario = new DAOUsuarios(); $usuario = $DAOUsuario->getById($id_usuario); if (is_null($usuario)) { $this->_autorizado = false; } break; case "llave": $this->_chequearKey(); break; default: break; } }
<?php include './DAOAdministracion/DAOProductos.php'; include './DAOAdministracion/DAOUsuarios.php'; include './conexion.php'; $dao = new DAOProductos(); $daoUsuarios = new DAOUsuarios(); $cn = new conexion(); $cn->conectarse(); $rs = $dao->dameProductos(); $rsUsuarios = $daoUsuarios->dameUsuarios(); echo '<div><h1>Módulo de productos</h1><div>'; if ($rsUsuarios == false) { echo '<table class ="table"><tr><td>' . mysql_error() . '</td></tr></table>'; } else { echo '<select onchange="dameProductosUsuario();" id="cmbUsuarios">'; echo '<option>Seleccione un Usuario</option>'; while ($datosUsuario = mysql_fetch_array($rsUsuarios)) { echo '<option value ="' . $datosUsuario["idUsuario"] . '">' . $datosUsuario["nombre"] . '</option>'; } echo '</select>'; } echo '<br>'; echo '<br>'; if ($rs == true) { echo '<table class="table">'; echo '<thead> <th><center>Nombre</center></th> <th><center>Descripcion</center></th> <th><center>Precio</center></th> <th><center>Fecha Prublicacion</center></th>
<?php require 'daos/DAOUsuarios.php'; $method = $_SERVER['REQUEST_METHOD']; $dao = new DAOUsuarios(); if ($method === 'GET') { } else { if ($method === 'POST') { if (isset($_REQUEST['op'])) { $op = $_REQUEST['op']; if ($op === 'registro') { if (isset($_REQUEST['email']) && isset($_REQUEST['nombre']) && isset($_REQUEST['pass'])) { $res = $dao->addUsuario($_REQUEST['nombre'], $_REQUEST['email'], $_REQUEST['pass']); if ($res === USER_CREATED_SUCCESSFULLY) { echo '{"mensaje":"Se ha insertado correctamente el usuario","cod":"' . USER_CREATED_SUCCESSFULLY . '"}'; } else { if ($res == USER_ALREADY_EXISTED) { echo '{"mensaje":"El usuario ya existe","cod":"' . USER_ALREADY_EXISTED . '"}'; } else { if ($res == USER_CREATE_FAILED) { echo '{"mensaje":"Ha habido un error al crear eñ usuario","cod":"' . USER_CREATE_FAILED . '"}'; } } } } else { echo '{"mensaje":"Falta algun parametro","cod":"5"}'; } } else { if ($op === 'login') { if (isset($_REQUEST['email']) && isset($_REQUEST['pass'])) { $user = $dao->checkUsuario($_REQUEST['email'], $_REQUEST['pass']);