<?php $conexion = new conexion($hostname, $user, $password, $dataBase); if ($conexion->connect()) { $query = "SELECT * FROM PRINCIPAL"; $result = $conexion->select($query); $html = ""; while ($row = mysqli_fetch_array($result)) { $html .= $row[1]; } echo $html; } else { echo "<div class='alert alert-danger'>Error al establecer conexion con la base de datos.</div>"; } ?>
function ListarContratos() { require_once "DatosConexion.php"; $con = new conexion($hostname, $user, $password, $dataBase); if ($con->connect()) { if ($rs = $con->select("SELECT * FROM TIPO_CONTRATO")) { ?> <table id="tblContrato" class="table table-bordered"> <tr class="info"><th><center>Nombre</center></th><th><center>Acción</center></th></tr> <?php while ($fila = mysqli_fetch_assoc($rs)) { ?> <tr id="fila_<?php echo $fila["TICO_ID"]; ?> "> <td><center id="col_<?php echo $fila["TICO_ID"]; ?> "><?php echo $fila["TICO_TIPOCONTRATO"]; ?> </center></td> <td> <center> <button title="Eliminar" type="button" class="btn btn-default" aria-label="Left Align" onclick="javascript:EliminarContrato('<?php echo $fila["TICO_ID"]; ?> ')"> <span class="glyphicon glyphicon-trash" aria-hidden="true"></span> </button> <button title="Editar" type="button" class="btn btn-default" aria-label="Left Align" onclick="javascript:EditarContrato(<?php echo $fila["TICO_ID"]; ?> )"> <span class="glyphicon glyphicon glyphicon-edit" aria-hidden="true"></span> </button> </center> </td> </tr> <?php } mysqli_free_result($rs); ?> </table> <?php } else { echo "Error al obtener los datos del servidor."; } } }
function stop() { if ($this->estado == 1) { //solo se puede parar si esta en curso //obtener el tiempo en curso de la tarea actual $tiempo = new Tiempo(); $db = new conexion(); $sql = "SELECT * FROM " . $tiempo->tabla . " \n\t\t\t\t\t\tWHERE id_tarea = " . $this->id . " AND \n\t\t\t\t\t\t\t\tfin = '0000-00-00 00:00:00'"; $t = $db->select($sql); $tiempo2 = new Tiempo($t[0]['id']); $tiempo2->parar(); $this->setEstado(0); $this->dbsave(); return $this->getTiempos(); } }
<?php require_once '../../conexion/DatosConexion.php'; require_once '../../conexion/Conexion.php'; session_start(); //print_r($_POST); if (isset($_POST)) { $conexion = new conexion($hostname, $user, $password, $dataBase); if ($conexion->connect()) { if (!empty($_POST['password']) and !empty($_POST['password_2'])) { $nuevaContraseña = $_POST['password']; $nuevaContraseña2 = $_POST['password_2']; $idUsuario = $_SESSION['idUsuario']; if ($nuevaContraseña == $nuevaContraseña2) { $query = "UPDATE USUARIO SET USUA_PASSWORD ='******'\n\t\t\t\t\t\t\tWHERE USUA_ID='{$idUsuario}'"; if ($conexion->select($query)) { echo "0"; } else { echo "1"; } } else { echo "2"; } } else { echo "3"; } } else { echo "4"; } } else { //header('location: ../../index.php');