APORTE TRABAJO
Fase 4 - Manejo de bases de datos
Presentado por:
Sindy Yohana Rojas Celis, Código 1083877119
Presentado a:
Yhon Jerson Robles Puentes
Grupo:
301127_15
Crear una aplicación web que controle el acceso a las salas de informática de la
UNAD, en donde existen N salas de computo, cada persona que acceso a la sala debe tener
en el sistema (Cedula, nombres, apellidos, sexo, ciudad, departamento), si es estudiante,
profesor o visitante, cuando va a ingresar a la sala la persona da su cedula y si existe en el
sistema le dice a qué sala va a ingresar, sino existe en el sistema, se le solicitaran los datos
para ingresarlo al sistema, cuando salga de la sala se dará salida del sistema.
Se debe generar informes sobre que asistentes fueron a las salas, por sala,
estudiantes que visitaron las salas, los visitantes que fueron a las salas, visitas que han
hecho un estudiante especifico, estos informes son en PDF. También se debe tener un
administrador del sistema que genere los informes y que cree las salas de sistemas, también
él puede generar la copia de seguridad del sistema
RESPUESTA:
<title>usuarios</title>
</head>
<?php
$mysqli=new mysqli("localhost","root","Fiscaliza13","sistema");
if(mysquli_connect_erno()){
echo'Conexion Falla:', mysquli_connect_error();
}
?>
<body>
</body>
</html>
<?php
requiere('conexion.php')
$resultado=$mysqli->query($query)
?>
html
<head>
<html>
<head>
</head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio colaborativo 3 <br>
</center>
<title></title>
</head>
<body>
<center><h1>Datos de Usuarios sala informatica UNAD</h1></center>
<p> </p>
<table width="377" border="1">
<tr>
<td width="22" bgcolor="#CCCCCC">Cédula</td>
<td width="22" bgcolor="#CCCCCC">Nombres</td>
<td width="22" bgcolor="#CCCCCC">Apellidos</td>
<td width="22" bgcolor="#CCCCCC">Sexo</td>
<td width="22" bgcolor="#CCCCCC">Ciudad </td>
<td width="22" bgcolor="#CCCCCC">Departamento</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p>
<input type="checkbox" value="estudiante" name="countries[]" />
<label>Estudiante</label>
<br/>
<input type="checkbox" value="docente" name="countries[]" />
<label>Docennte</label>
<br/>
<input type="checkbox" value="funcionario" name="countries[]" />
<label>Funcionario</label>
<br/>
<input type="checkbox" value="visitante" name="countries[]" />
<label>Visitante</label>
<br/>
<input type="submit" name="enviar" value="enviar" />
</p>
<p>
<?php
if (isset($_POST['enviar'])) {
if (is_array($_POST['countries'])) {
$selected = '';
$num_countries = count($_POST['countries']);
$current = 0;
foreach ($_POST['countries'] as $key => $value) {
if ($current != $num_countries-1)
$selected .= $value.', ';
else
$selected .= $value.'.';
$current++;
}
}
else {
$selected = 'debes elegir un rol';
}
<html>
<head>
<title>Usuarios</title>
</head>
<body>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio trabajo colaborativo 3 <br>
</center>
<center>
<h1>Nuevo Usuario de la sala de informática
UNAD</h1></center>
<td colspan="2"><center>
<p>Debe elegir un rol </p>
<p>
<input type="checkbox" value="estudiante"
name="countries[]" />
<label>Estudiante</label>
<br/>
<input type="checkbox" value="docente"
name="countries[]" />
<label>Docennte</label>
<br/>
<input type="checkbox" value="funcionario"
name="countries[]" />
<label>Funcionario</label>
<br/>
<input type="checkbox" value="visitante"
name="countries[]" />
<label>Visitante</label>
</p>
<p>
<input type="submit" name="eviar"
value="Registrar" />
</p>
</center></td>
</tr>
</table>
</form>
</body>
<body>
</body>
</html>
<html>
<head>
</head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio trabajo colaborativo 3 <br>
</center>
<?php
require('conexion.php');
$codigo=$_POST['Código'];
$nombres=$_POST['Nombres'];
$apellidos=$_POST['Apellidos'];
$Edad=$_POST['Edad'];
$resultado=$mysqli->query($query);
?>
<html>
<head>
<title>Guardar usuario</title>
<body>
<center>
<?php } ?>
<p></p>
<a href="index.php">Regresar</a>
</center>
</body>
</html>
<?php
require('conexion.php');
$id=$_GET['id'];
$resultado=$mysqli->query($query);
$row=$resultado->fetch_assoc();
?>
<html>
<head>
<title>Usuarios</title>
</head>
<body>
<html>
<head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio trabajo colaborativo 3 <br>
</center>
<center>
<h1>Modificar Usuario Nuevo de la sala de informatica
UNAD</h1></center>
<table width="50%">
<tr>
<input type="hidden" name="id"
value="<?php echo $id; ?>">
<td width="20"><b>Cédula</b></td>
<td width="30"><input type="text"
name="cedula" size="25" value="<?php echo $row['usuario']; ?>"
/></td>
</tr>
<tr>
<td><b>Nombres</b></td>
<td><input type="nombres" name="nombres"
size="25" value="<?php echo $row['nombre']; ?>" /></td>
</tr>
<tr>
<td><b>Apellidos</b></td>
<td><input type="text" name="apellidos"
size="25" value="<?php echo $row['apellidos']; ?>" /></td>
</tr>
<tr>
<td><b>Sexo</b></td>
<td><input type="text" name="sexo"
size="25" value="<?php echo $row['sexo']; ?>" /></td>
</tr>
<tr>
<td><b>Ciudad</b></td>
<td><input type="text" name="ciudad"
size="25" value="<?php echo $row['ciudad']; ?>" /></td>
</tr> <tr>
<td><b>Departamento</b></td>
<td><input type="text"
name="departamento" size="25" value="<?php echo
$row['departamento']; ?>" /></td>
</tr>
<tr>
<td><b>Rol en la Insitucion</b></td>
<td><input type="text" name="rol en la
institucion" size="25" value="<?php echo $row['rol en la
institucion']; ?>" /></td>
</tr><tr>
<td colspan="2"><center>
<p>Debe elegir un rol </p>
<p>
<input type="checkbox" value="estudiante"
name="countries[]" />
<label>Estudiante</label>
<br/>
<input type="checkbox" value="docente"
name="countries[]" />
<label>Docennte</label>
<br/>
<input type="checkbox" value="funcionario"
name="countries[]" />
<label>Funcionario</label>
<br/>
<input type="checkbox" value="visitante"
name="countries[]" />
<label>Visitante</label>
</p>
<p>
<input type="submit" name="Guardar"
value="Guardar" />
</p>
</center></td>
</tr>
</table>
<p> </p>
<p><br/>
</p>
</form>
</body>
</html>
<html>
<head>
</head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio trabajo colaborativo 3 <br>
</center>
<?php
require('conexion.php');
$codigo=$_POST['codigo'];
$nombres=$_POST['nombres'];
$apellidos=$_POST['apellidos'];
$edad=$_POST['edad'];
$query="UPDATE usuarios SET cedula='$cedula',
nombres='$nombres', apellidos='$apellidos', sexo='$sexo',
ciudad='$ciudad', departamento='$departamento', rol en la
institucion='$rol en la institucion' WHERE codigo='$codigo'";
$resultado=$mysqli->query($query);
?>
<html>
<head>
<title>Modificar usuario</title>
<body>
<center>
<?php
if($resultado>0){
?>
<?php } ?>
<p></p>
<a href="index.php">Regresar</a>
</center>
</body>
</html>
<html>
<head>
</head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio trabajo colaborativo 3 <br>
</center>
<?php
require('conexion.php');
$id=$_GET['codigo'];
$resultado=$mysqli->query($query);
?>
<html>
<head>
<title>Eliminar usuario</title>
<body>
<center>
<?php
if($resultado>0){
?>
<?php } ?>
<p></p>
<a href="index.php">Regresar</a>
</center>
</body>
</html>
<html>
<head>
</head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio trabajo colaborativo 3 <br>
</center>
<?php
require('conexion.php');
$id=$_GET['codigo'];
?>
<html>
<head>
<title>Eliminar usuario</title>
<body>
<center>
<?php
if($resultado>0){
?>
<?php } ?>
<p></p>
<a href="index.php">Regresar</a>
</center>
</body>
</html>
<html>
<head>
</head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio colaborativo 3 <br>
</center>
<?php
requiere_once("dompsdf/dompdf_config.inc.php");
$conexion= mysql_connect("localhost","root","");
mysql_select_db("trabajo3",$conexion);
$codigoHTML='
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"
/>
<title>Lista</title>
</head>
<body>
<div aling="center">
<table width="200" border="1">
<tr>
<td bgcolor="#999999"><strong>Cédula</strong></td>
<td bgcolor="#999999"><strong>Nombres</strong></td>
<td bgcolor="#999999"><strong>Apellidos</strong></td>
<td bgcolor="#999999"><strong>Sexo</strong></td>
<td bgcolor="#999999"><strong>Ciudad</strong></td>
<td
bgcolor="#999999"><strong>Departamento</strong></td>
</tr>';
$codigoHTML=utf8_decode($codigoHTML);
$dompdf=new DOMPDF();
$dompdf->load_html($codigoHTML);
ini_set("memory_limit","128M");
$dompdf->render();
$dompdf->stream("Lista de Usuarios Sala de Informática
UNAD.pdf");
?>
<html>
<head>
</head>
<body>
<center><h2> UNAD- PROGRAMACION DE SITIOS WEB 2015 </h2>
programcion php <br>
Ejercicio colaborativo 3 <br>
</center>
<?php
$conexion = mysql_connect("localhost","root","");
mysql_select_db("tarea",$conexion);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"
/>
<body>
<h1 align="center"><a href="lista.php" title="Reporte de
Empleados">Lista de Usuarios Sala de Informática UNAD</a></h1>
</body>
</html>
REFERENCIAS BIBLIOGRÁFICAS
Cómo Listar, añadir, editar y borrar records de una tabla con PHP y Dreamweaver.
Consultado en https://www.youtube.com/watch?v=ieeRfZEFOAc
Curso PHP orientado a Objetos - como crear una tabla y sus campos desde el código.
Consultado en https://www.youtube.com/watch?v=M4ri9LmVv7w
Curso PHP orientado a Objetos - como crear una tabla y campos desde una clase 2.
Consultado en https://www.youtube.com/watch?v=Rn8vLnyMypU