SlideShare a Scribd company logo
1 of 24
Download to read offline
index.php




<!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>Inicio de Sesion</title>
<style type="text/css">
<!--
body,td,th {
        color: #FFF;
}
body {
        background-color: #000;
}
-->
</style></head>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
  <table width="800" border="0">
    <tr>
      <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
    </tr>
    <tr>
      <td colspan="3">
         <div align="center">
            <table width="220" height="180" border="0">
             <form action="menu.php" method="post">
<tr>
                 <td colspan="3"><div align="center">
                 <h1><strong>Inicio de Sesion</strong></h1>
                 </div></td>
               </tr>
               <tr>
                 <td width="60%"><div align="right"><strong>Usuario</strong></div></td>
                 <td width="35%"><input type="text" name="txtUsser" id="txtUsser"/></td>
               </tr>
               <tr>
                 <td><div align="right"><strong>Contraseña</strong></div></td>
                 <td><input type="password" name="txtPass" id="txtPass" /></td>
               </tr>
               <tr>
                 <td colspan="3"><div align="right">
                 <input type="submit" name="btnEnviar" id="btnEnviar" value="Login" />
               </div></td>
               </tr>
             </form>
           </table>
       </div></td>
    </tr>
  </table>
</div>
</body>
</html>

                                           menu.php
<?php
session_start();
include("conexion.php");
if(isset($_POST['txtUsser']) && !empty($_POST['txtUsser']) && isset($_POST['txtPass']) &&
!empty($_POST['txtPass']))
{
     $con = mysql_connect($host, $user, $password) or die("hay problemas con el servidor");
         mysql_select_db($db, $con) or die("hay problemas con la base de datos");
     $seleccion = mysql_query("SELECT Usuario, Clave FROM Registros WHERE Usuario =
'$_POST[txtUsser]'", $con);
     $sesion = mysql_fetch_array($seleccion);
     if($_POST['txtPass'] == $sesion['Clave'])
     {
?>
<!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>menu</title>
</head>
<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
     <table width="800" border="0">
     <tr>
     <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
     </tr>
     <tr bgcolor="white">
   <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="listado.php">Administrar</a></strong></div></td>
   <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="ver.php">Consultar</a></strong></div></td>
   <td width="200" bgcolor="#000000"><div align="center"><a
href="logout.php"><strong>LogOut</strong></a></div></td>
   </tr>
</table>
</body>
</html>
<?Php
     }else{
?>
<!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>listado</title>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
    <table width="800" border="0">
    <tr>
    <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
    </tr>

    <tr>
       <td colspan="5">
       <center>
       <a href="index.php">
       <h4>Usuario o Contraseña incorrecta</h4></a>
<?Php
          header("Location : index.php");
    }
}else{
?>
<!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>listado</title>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
    <table width="800" border="0">
    <tr>
    <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
    </tr>
    <tr>
      <td colspan="3">
      <center>
      <a href="index.php">
      <h4>Llenar los Campos son Obligatorios</h4></a>
<?Php
         header("Location : index.php");
}
?>

                                         listado.php




<?php
        include("conexion.php");
        $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el
servidor");
        mysql_select_db($db, $conexion) or die("hay problemas con la base de datos");// Selecciona
la base de datos
$tabla = mysql_query("SELECT * FROM Matriculas"); // Selecciono todos los registros de la
tabla
?>
<!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>listado</title>
<style type="text/css">
<!--
body,td,th {
          color: #FFF;
}
-->
</style></head>
<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
     <table width="800" border="0">
     <tr>
        <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
     </tr>
     <tr bgcolor="white">
   <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="listado.php">Administrar</a></strong></div></td>
   <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="ver.php">Consultar</a></strong></div></td>
   <td width="200" bgcolor="#000000"><div align="center"><a
href="logout.php"><strong>LogOut</strong></a></div></td>
   </tr>
   <tr>
        <td colspan="3">
        <center>
   <h1>Lista de Alumnos</h1>
</center>
<form id="MyForm" name="MyForm" method="post" action="">
<table align="Center" border="1" width="60%" cellspacing="0" cellpadding="2">
          <tr align="center">
          <td>Id</td>
          <td>Dni</td>
          <td>Apellidos</td>
          <td>Nombres</td>
          <td>Email</td>
          <td>Especialidad </td>
          <td>Turno</td>
          <td>Semestre</td>
          </tr>

<?php
        while ($Registro = mysql_fetch_array($tabla))
        {
?>
        <tr>
                <td>
        <?php
                $Id=$Registro['Id'];
                echo "<input type='checkbox' id='chkRegistro' name='chkRegistro' value='$Id'>";
                echo $Registro['Id'];
                ?>
        </td>
        <td><?php   echo   $Registro['Dni'];?></td>
        <td><?php   echo   $Registro['Apellidos'];?></td>
        <td><?php   echo   $Registro['Nombres'];?></td>
        <td><?php   echo   $Registro['Email'];?></td>
        <td><?php   echo   $Registro['Especialidad'];?></td>
        <td><?php   echo   $Registro['Turno'];?></td>
        <td><?php   echo   $Registro['Semestre'];?></td>
        </tr>
<?php
        }
        mysql_free_result($tabla);
        mysql_close($conexion);
?>
</table>
<center>
<p>
<input type="button" onclick="this.form.action='eliminar.php' ;this.form.submit();"
name="btnEliminar" value="Eliminar" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
       <input type="button" onclick="this.form.action='consulta.php' ;this.form.submit();"
name="btnActualizar" value="Actualizar" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
           <input type="button" onclick="this.form.action='mostrar.php' ;this.form.submit();"
name="btnInsertar" value="Insertar" />
</p>
</center>
</form>
</td>
</tr>
</table>
</div>
</body>
</html>
                                           mostrar.php




<!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>mostrar</title>
<style type="text/css">
<!--
body,td,th {
        color: #FFF;
}
-->
</style></head>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
  <table width="800" border="0">
    <tr>
    <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
    </tr>
    <tr bgcolor="white">
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="listado.php">Administrar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="ver.php">Consultar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><a
href="logout.php"><strong>LogOut</strong></a></div></td>
  </tr>
    <tr>
      <td colspan="3">
         <div align="center">
         &nbsp; &nbsp;
         <table align="center">
        <form id="form1" name="form1" method="post" action="insertar.php">
         <tr>
           <td colspan="2"><div align="center"><strong>Matricular Alumnos</strong></div></td>
         </tr>
         <tr>
           <td><div align="right">Dni:</div></td>
           <td><input name="txtDni" type="text" id="txtDni" size="30" maxlength="8"/></td>
         </tr>
         <tr>
           <td><div align="right">Apellidos:</div></td>
           <td><input name="txtApellidos" type="text" id="txtApellidos" size="30" maxlength="50"
/></td>
         </tr>
         <tr>
           <td><div align="right">Nombres:</div></td>
           <td><input name="txtNombres" type="text" id="txtNombres" size="30" maxlength="50"
/></td>
         </tr>
         <tr>
           <td><div align="right">Email:</div></td>
           <td><input name="txtEmail" type="text" id="txtEmail" size="30" maxlength="50" /></td>
         </tr>
         <tr>
           <td><div align="right">Especialidad:</div></td>
           <td>
              <select name="cboEspecialidad" id="cboEspecialidad">
                  <option value="Computacion e Informatica">Computacion e Informatica</option>
                  <option value="Contabilidad">Contabilidad</option>
                  <option value="Secretariado">Secretariado</option>
                  <option value="Administracion">Administracion</option>
                  <option value="Enfemeria">Enfermeria</option>
                  <option value="Diseño Grafico">Diseño Grafico</option>
                  <option value="Electronica">Electronica</option>
                  <option value="Cursos corto">Cursos cortos</option>
                </select>
           </td>
         </tr>
<tr>
           <td><div align="right">Turno:</div></td>
           <td>
              <select name="cboTurno" id="cboturno">
                   <option value="M">Mañana</option>
                   <option value="T">Tarde</option>
                   <option value="N;">Nocturna</option>
                </select>
           </td>
         </tr>
          <tr>
           <td><div align="right">Semestre:</div></td>
           <td>
              <select name="cboSemestre" id="cboSemestre">
                   <option value="1">Semestre 1</option>
                   <option value="2">Semestre 2</option>
                   <option value="3;">Semestre 3</option>
                   <option value="4;">Semestre 4</option>
                   <option value="5;">Semestre 5</option>
                   <option value="6;">Semestre 6</option>
              </select>
           </td>
         </tr>
         <tr>
           <td colspan="2"><div align="center">
              <p>
                <input type="submit" name="btnEnviar" id="btnEnviar" value="Agregar" /> &nbsp;
&nbsp; &nbsp; &nbsp;
                <input type="reset" name="btnRestablecer" id="btnRestablecer" value="Restaurar" />
              </p>
           </div></td>
         </tr>
        </form>
</table>
</div>
</tr>
</table>
</div>
</body>
</html>
buscar.php




<?php
          include("conexion.php");
          $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor");
          mysql_select_db($db, $conexion) or die("hay problemas con la base de datos");

          $Especialidad = $_POST["cboEspecialidad"];
          $Turno = $_POST['cboTurno'];
          $Semestre = $_POST['cboSemestre'];
          $Dni = $_POST['txtDni'];

          if($Dni=="" && $Especialidad=="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" && $Turno=="Seleccione
Turno")
          {
?>
<!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>Llenar los Campos son Obligatorios</title>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
 <table width="800" border="0">
  <tr>
   <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
  </tr>

  <tr>
   <td colspan="3">
   <center>
   <a href="ver.php">
   <h4>Seleccionar algun Criterio de Busqueda</h4></a>
</script>
<?Php
               header("Location :ver.php");
        }

       else
       {
              if($Dni!="" && ($Especialidad=="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" &&
$Turno=="Seleccione Turno" ) ||
                                        ($Especialidad!="Seleccione Especialidad" || $Semestre!="Seleccione Semestre" ||
$Turno!="Seleccione Turno" ))
              {
                      $query = "SELECT * FROM Matriculas WHERE Dni='$Dni'";
              }
              if($Especialidad!="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" && $Turno=="Seleccione
Turno" && $Dni=="")
              {
                      $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad'";
              }
              if($Semestre!="Seleccione Semestre" && $Especialidad=="Seleccione Especialidad" && $Turno=="Seleccione
Turno" && $Dni=="")
              {
                      $query = "SELECT * FROM Matriculas WHERE Semestre='$Semestre'";
              }
              if($Turno!="Seleccione Turno" && $Especialidad=="Seleccione Especialidad" && $Semestre=="Seleccione
Semestre" && $Dni=="")
              {
                      $query = "SELECT * FROM Matriculas WHERE Turno='$Turno'";
              }
              if($Turno=="Seleccione Turno" && $Especialidad!="Seleccione Especialidad" && $Semestre!="Seleccione
Semestre" && $Dni=="")
              {
                      $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad' AND Semestre='$Semestre'";
              }
if($Turno!="Seleccione Turno" && $Especialidad!="Seleccione Especialidad" && $Semestre=="Seleccione
Semestre" && $Dni=="")
                 {
                         $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad' AND Turno='$Turno'";
                 }
                 if($Turno!="Seleccione Turno" && $Especialidad=="Seleccione Especialidad" && $Semestre!="Seleccione
Semestre" && $Dni=="")
                 {
                         $query = "SELECT * FROM Matriculas WHERE Semestre='$Semestre' AND Turno='$Turno'";
                 }
                 if($Turno!="Seleccione Turno" && $Especialidad!="Seleccione Especialidad" && $Semestre!="Seleccione Semestre"
&& $Dni=="")
                 {
                         $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad' AND Semestre='$Semestre' AND
Turno='$Turno'";
                 }
                 $result = mysql_query($query) or die("ERROR...");
                 $numero = 0;
?>
<!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>buscar</title>
<style type="text/css">
<!--
body,td,th {
         color: #FFF;
}
-->
</style></head>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
 <table width="800" border="0">
  <tr>
   <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
  </tr>
  <tr bgcolor="white">
 <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td>
 <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td>
 <td width="200" bgcolor="#000000"><div align="center"><a
href="logout.php"><strong>LogOut</strong></a><strong></strong></div></td>
 </tr>
  <tr>
   <td colspan="3">
    <div align="center">
 <h1>Resultados</h1>
 <table border="1" width="900">
<tr align="center">
    <td>Id</td>
    <td width="100">Dni</td>
    <td>Apellidos y Nombres</td>
    <td>Email</td>
    <td>Especialidad</td>
    <td>Turno</td>
    <td>Semestre</td>
   </tr>
<?Php
 while($row = mysql_fetch_array($result))
 {
?>
          <tr>
          <td><?Php echo $row["Id"];?></td>
          <td><?Php echo $row["Dni"]; ?></td>
          <td><?Php echo $row["Apellidos"]." ".$row["Nombres"]; ?></td>
          <td><?Php echo $row["Email"];?></td>
     <td><?Php echo $row["Especialidad"];?></td>
     <td><?Php echo $row["Turno"];?></td>
     <td><?Php echo $row["Semestre"];?></td>
   </tr>
<?Php
   $numero++;
 }
 mysql_free_result($result);
 mysql_close($conexion);
?>
</table>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>
<?Php
 }
?>
Ver.php




<!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>ver</title>
<style type="text/css">
<!--
body,td,th {
        color: #FFF;
}
-->
</style></head>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
  <table width="800" border="0">
    <tr>
      <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
   </tr>
<tr bgcolor="white">
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="listado.php">Administrar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="ver.php">Consultar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><a
href="logout.php"><strong>LogOut</strong></a><strong></strong></div></td>
  </tr>
    <tr>
      <td colspan="3">
      <div align="center">
<form id="form1" name="form1" method="post" action="buscar.php">
  <table width="700">
    <tr>
    <td align="center" colspan=5><h1>Busqueda de Alumnos</h1></td></tr>
    <tr><td align="center"><b>Especialidad</li></b>
    </td><td align="center"><b>Turno</li></b>
    </td><td align="center"><b>Semestre</li></b>
    </td><td><b>Dni del Alumno</li></b>
    </td>
    </tr>
    <tr>
      <td align="center">
         <select name="cboEspecialidad" id="cboEspecialidad">
           <option value="Seleccione Especialidad">Seleccione Especialidad</option>
           <option value="Computacion e Informatica">Computacion e Informatica</option>
           <option value="Contabilidad">Contabilidad</option>
           <option value="Secretariado;">Secretariado</option>
           <option value="Administracion">Administracion</option>
           <option value="Enfemeria">Enfermeria</option>
           <option value="Diseño Grafico">Diseño Grafico</option>
           <option value="Electronica">Electronica</option>
           <option value="Cursos corto">Cursos cortos</option>
           </select></td>

       <td align="center">
         <select name="cboTurno" id="cboturno">
            <option value="Seleccione Turno">Seleccione Turno</option>
            <option value="M">Mañana</option>
            <option value="T">Tarde</option>
            <option value="N;">Nocturna</option>
            </select>
         </td><td align="center">
            <select name="cboSemestre" id="cboSemestre">
              <option value="Seleccione Semestre">Seleccione Semestre</option>
              <option value="1">Semestre 1</option>
              <option value="2">Semestre 2</option>
              <option value="3">Semestre 3</option>
              <option value="4">Semestre 4</option>
              <option value="5">Semestre 5</option>
              <option value="6">Semestre 6</option>
            </select>
            </td>
       <td>
         <input type="text" name="txtDni" size=20 maxlength=8 />
         </td>
       </tr>
           <tr>
         <td align="center" colspan="4"><br/>
                  <input type="submit" name="btnBuscar" value="Buscar" /> &nbsp; &nbsp; &nbsp;
                  <input type="reset" name="btnRestablecer" value="Restaurar" />
         </td>
         </tr>
</table>
</form>
</div>
</td>
</tr>
</table>
</div>
</body>
</html>




                                                       actualizar.php

<?php
        include("conexion.php");

        $Id=$_POST['txtId'];
        $strDni=$_POST['txtDni'];
        $strApellidos=$_POST['txtApellidos'];
        $strNombres=$_POST['txtNombres'];
        $strEmail=$_POST['txtEmail'];
        $strEspecialidad=$_POST['txtEspecialidad'];
        $strTurno=$_POST['txtTurno'];
        $strSemestre=$_POST['txtSemestre'];

        $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor");
        mysql_select_db($db, $conexion) or die("hay problemas en la base de datos");

        if(isset($strDni) && !empty($strDni) &&
          isset($strApellidos) && !empty($strApellidos) &&
          isset($strNombres) && !empty($strNombres) &&
          isset($strEmail) && !empty($strEmail) &&
          isset($strEspecialidad) && !empty($strEspecialidad) &&
          isset($strTurno) && !empty($strTurno) &&
          isset($strTurno) && !empty($strTurno))
        {
                 $Sql="UPDATE Matriculas SET Dni='$strDni',
                 Apellidos='$strApellidos',
                 Nombres='$strNombres',
                 Email='$strEmail',
                 Especialidad='$strEspecialidad',
                 Turno='$strTurno',
                 Semestre='$strSemestre'
                 WHERE Id='$Id'";
                 mysql_query($Sql);
                 header ("Location: listado.php");
        }else{
                 echo "Es obligatorio llenar todos los campos";
        }
?>
conexion.php

<?php
  $host = "localhost";
  $user = "system_usuario";
  $password = "/45468853";
  $db   = "system_instituto";
?>
consulta.php




<?php
        if(isset($_POST['chkRegistro']))
        {
                include("conexion.php");
                $conexion = mysql_connect($host, $user, $password) or die("Problemas con Server");
                mysql_select_db($db, $conexion) or die("Ploblemas con BD");// Selecciona la base
de datos
                $Id=$_POST['chkRegistro'];
                $sql=mysql_query("SELECT * FROM Matriculas WHERE Id=$Id");
                $Registro = mysql_fetch_array($sql);
?>
<!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>consulta</title>
<style type="text/css">
<!--
body,td,th {
        color: #FFF;
}
-->
</style></head>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
  <table width="800" border="0">
    <tr>
      <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
    </tr>
    <tr bgcolor="white">
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="listado.php">Administrar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="ver.php">Consultar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><a
href="logout.php"><strong>LogOut</strong></a><strong></strong></div></td>
  </tr>
    <tr>
      <td colspan="3">
      <center>
  <h1> Actualizar Matricula</h1></center>
<form id="form1" name="form1" method="post" action="actualizar.php">
<table width="35%" border="0" cellpadding="2" cellspacing="2" align="center">
        <tr>
        <?php echo "<input name='txtId' type='hidden' value='$Registro[0]'>";?>
        </tr>
    <tr>
        <td align="right">Dni</td>
                <td><?php echo "<input name='txtDni' type='text' size='30'
value='$Registro[1]'>";?></td>
        </tr>
    <tr>
        <td align="right">Apellidos</td>
         <td><?php echo "<input name='txtApellidos' type='text' size='30'
value='$Registro[2]'>";?></td>
        </tr>
        <tr>
        <td align="right">Nombres</td>
         <td><?php echo "<input name='txtNombres' type='text' size='30'
value='$Registro[3]'>";?></td>
        </tr>
    <tr>
        <td align="right">Email</td>
         <td><?php echo "<input name='txtEmail' type='text' size='30'
value='$Registro[4]'>";?></td>
        </tr>
    <tr>
        <td align="right">Especialidad</td>
         <td><?php echo "<input name='txtEspecialidad' type='text' size='30'
value='$Registro[5]'>";?></td>
        </tr>
    <tr>
        <td align="right">Turno</td>
         <td><?php echo "<input name='txtTurno' type='text' size='30'
value='$Registro[6]'>";?></td>
        </tr>
    <tr>
        <td align="right">Semestre</td>
         <td><?php echo "<input name='txtSemestre' type='text' size='30'
value='$Registro[7]'>";?></td>
        </tr>
    <tr>
        <td colspan="2" align="center">
         <input type="submit" name="Submit" value="Actualizar" />
         </td>
        </tr>
</table>
</form>
    </td>
    </tr>

   </table>
</div>
</body>
</html>
<?Php
         }else{
?>
<?Php
                  $pagina = "http://alain.systemsecret.net/error.php";
                          Header("Location: $pagina");
        }
?>



                                             eliminar.php

<?php
        include("conexion.php");

        if(isset($_POST['chkRegistro']))
        {
                       $valor=$_POST['chkRegistro'];
                       $conexion = mysql_connect($host, $user, $password) or die("hay problemas
con el servidor");
                       mysql_select_db($db, $conexion) or die("hay problemas con la base de
datos");
                       mysql_query("DELETE FROM Matriculas WHERE Id =$valor");
                       $pagina = "http://alain.systemsecret.net/listado.php";
                       Header("Location: $pagina");
        }else{
?>
<?Php
                       $pagina = "http://alain.systemsecret.net/error.php";
                       Header("Location: $pagina");
        }
?>



                                               error.php
<?php
        include("conexion.php");
        $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el
servidor");
        mysql_select_db($db, $conexion) or die("hay problemas con la base de datos");
        $tabla = mysql_query("SELECT * FROM Matriculas");
?>
<!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>listado</title>
<style type="text/css">
<!--
body,td,th {
        color: #FFF;
}
body {
        background-color: #000;
}
-->
</style></head>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
  <table width="800" border="0">
    <tr>
<td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
    </tr>
    <tr bgcolor="white">
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="listado.php">Administrar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><strong><a
href="ver.php">Consultar</a></strong></div></td>
  <td width="200" bgcolor="#000000"><div align="center"><a
href="logout.php"><strong>LogOut</strong></a></div></td>
  </tr>
  <tr>
       <td colspan="3">
       <center>
       <a href="listado.php">
       <h4>Debe selecionar un Registro</h4></a>
</center>
</form>
  </td>
  </tr>
</div>
</body>
</html>



                                           insertar.php

<?php
        include("conexion.php");

        $strDni=$_POST['txtDni'];
        $strApellidos=$_POST['txtApellidos'];
        $strNombres=$_POST['txtNombres'];
        $strEmail=$_POST['txtEmail'];
        $strEspecialidad=$_POST['cboEspecialidad'];
        $strTurno=$_POST['cboTurno'];
        $strSemestre=$_POST['cboSemestre'];

        $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el
servidor");
        mysql_select_db($db, $conexion) or die("hay problemas con la base de datos");

        if(isset($strDni) && !empty($strDni) &&
           isset($strApellidos) && !empty($strApellidos) &&
           isset($strNombres) && !empty($strNombres) &&
           isset($strEmail) && !empty($strEmail) &&
           isset($strEspecialidad) && !empty($strEspecialidad) &&
           isset($strTurno) && !empty($strTurno) &&
           isset($strSemestre) && !empty($strSemestre))
        {
                $Sql="INSERT INTO Matriculas (Id, Dni, Apellidos, Nombres, Email, Especialidad,
Turno, Semestre)".
                " VALUES (NULL, '$strDni', '$strApellidos', '$strNombres', '$strEmail',
'$strEspecialidad', '$strTurno', '$strSemestre')";
                mysql_query($Sql);
                header ("Location: listado.php");

        }else{
?>
<!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>listado</title>

<body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF">
<div align="center">
<table width="800" border="0">
     <tr>
       <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td>
     </tr>
     <tr>
       <td colspan="3">
       <center>
       <a href="mostrar.php">
       <h4>Llenar los Campos son Obligatorios</h4></a>
<?Php
          header("Location : mostrar.php");
}
?>



                                            logout.php

<?php
session_start();
session_destroy();
header( 'Location: index.php' ) ;
?>


                                          Matriculas.SQL
Registros.sql

More Related Content

What's hot

Php codigos interfaces fredy guzman cusihunca
Php codigos interfaces   fredy guzman cusihuncaPhp codigos interfaces   fredy guzman cusihunca
Php codigos interfaces fredy guzman cusihuncaTigger_Fred
 
Php & mysql
Php & mysqlPhp & mysql
Php & mysqlola98z
 
Blogger template-squeeze-page-angelogrande
Blogger template-squeeze-page-angelograndeBlogger template-squeeze-page-angelogrande
Blogger template-squeeze-page-angelograndeangelogrande782
 
Template 6786628199202133222.index
Template 6786628199202133222.indexTemplate 6786628199202133222.index
Template 6786628199202133222.indexhandryus
 
WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説
WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説
WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説Takashi Uemura
 
New text document (2) 2
New text document (2) 2New text document (2) 2
New text document (2) 2raj lex
 

What's hot (14)

Php codigos interfaces fredy guzman cusihunca
Php codigos interfaces   fredy guzman cusihuncaPhp codigos interfaces   fredy guzman cusihunca
Php codigos interfaces fredy guzman cusihunca
 
Seleccion
SeleccionSeleccion
Seleccion
 
Sis quiz
Sis quizSis quiz
Sis quiz
 
Php & mysql
Php & mysqlPhp & mysql
Php & mysql
 
Test
TestTest
Test
 
Ver
VerVer
Ver
 
Blogger template-squeeze-page-angelogrande
Blogger template-squeeze-page-angelograndeBlogger template-squeeze-page-angelogrande
Blogger template-squeeze-page-angelogrande
 
A z railphp v1.0
A z railphp v1.0A z railphp v1.0
A z railphp v1.0
 
Template 6786628199202133222.index
Template 6786628199202133222.indexTemplate 6786628199202133222.index
Template 6786628199202133222.index
 
WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説
WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説
WordPressのテンプレートをカスタマイズするために必要なphpを初歩から解説
 
New text document (2) 2
New text document (2) 2New text document (2) 2
New text document (2) 2
 
Phpex3
Phpex3Phpex3
Phpex3
 
Jsoon
JsoonJsoon
Jsoon
 
DestakNews
DestakNewsDestakNews
DestakNews
 

Viewers also liked

Darden school of business elective encourages entrepreneurship
Darden school of business elective encourages entrepreneurshipDarden school of business elective encourages entrepreneurship
Darden school of business elective encourages entrepreneurshipBill Gray Ogilvy
 
Тренажер. Состав числа 9.
Тренажер. Состав числа 9.Тренажер. Состав числа 9.
Тренажер. Состав числа 9.olganach
 
[Ayp 39][orangeapy] Bán xôi chiên và móc khoá
[Ayp 39][orangeapy] Bán xôi chiên và móc khoá[Ayp 39][orangeapy] Bán xôi chiên và móc khoá
[Ayp 39][orangeapy] Bán xôi chiên và móc khoáYukimura Sanada
 
PuertoricoPresentationFinal
PuertoricoPresentationFinalPuertoricoPresentationFinal
PuertoricoPresentationFinalcscott54
 
unidad 1 quimica
unidad 1 quimicaunidad 1 quimica
unidad 1 quimicaguestfa8773
 
Land Use Policy in Israel
Land Use Policy in IsraelLand Use Policy in Israel
Land Use Policy in Israelylerman
 
Film trailer past student work
Film trailer past student workFilm trailer past student work
Film trailer past student workemzy_95
 
I A M S E09 Kathryn Mc Mahon
I A M S E09  Kathryn Mc MahonI A M S E09  Kathryn Mc Mahon
I A M S E09 Kathryn Mc MahonJulie Hewett
 
Evaluacion inicialo o diagnostica
Evaluacion inicialo o diagnosticaEvaluacion inicialo o diagnostica
Evaluacion inicialo o diagnosticaSEGE
 
Site plan field
Site plan fieldSite plan field
Site plan fieldStephWebb
 
Jueves 21 de agosto de 2014
Jueves 21 de agosto de 2014Jueves 21 de agosto de 2014
Jueves 21 de agosto de 2014Divia Soria
 
예비판정의결서(공개본)
예비판정의결서(공개본)예비판정의결서(공개본)
예비판정의결서(공개본)Gori Communication
 

Viewers also liked (18)

Darden school of business elective encourages entrepreneurship
Darden school of business elective encourages entrepreneurshipDarden school of business elective encourages entrepreneurship
Darden school of business elective encourages entrepreneurship
 
Тренажер. Состав числа 9.
Тренажер. Состав числа 9.Тренажер. Состав числа 9.
Тренажер. Состав числа 9.
 
Tongnian
TongnianTongnian
Tongnian
 
[Ayp 39][orangeapy] Bán xôi chiên và móc khoá
[Ayp 39][orangeapy] Bán xôi chiên và móc khoá[Ayp 39][orangeapy] Bán xôi chiên và móc khoá
[Ayp 39][orangeapy] Bán xôi chiên và móc khoá
 
PuertoricoPresentationFinal
PuertoricoPresentationFinalPuertoricoPresentationFinal
PuertoricoPresentationFinal
 
unidad 1 quimica
unidad 1 quimicaunidad 1 quimica
unidad 1 quimica
 
Turkey Trouble Standorf1
Turkey Trouble Standorf1Turkey Trouble Standorf1
Turkey Trouble Standorf1
 
Land Use Policy in Israel
Land Use Policy in IsraelLand Use Policy in Israel
Land Use Policy in Israel
 
Film trailer past student work
Film trailer past student workFilm trailer past student work
Film trailer past student work
 
Chuong6
Chuong6Chuong6
Chuong6
 
I A M S E09 Kathryn Mc Mahon
I A M S E09  Kathryn Mc MahonI A M S E09  Kathryn Mc Mahon
I A M S E09 Kathryn Mc Mahon
 
Evaluacion inicialo o diagnostica
Evaluacion inicialo o diagnosticaEvaluacion inicialo o diagnostica
Evaluacion inicialo o diagnostica
 
Clarin Presentacion
Clarin PresentacionClarin Presentacion
Clarin Presentacion
 
Site plan field
Site plan fieldSite plan field
Site plan field
 
Tic
TicTic
Tic
 
Graffiti
GraffitiGraffiti
Graffiti
 
Jueves 21 de agosto de 2014
Jueves 21 de agosto de 2014Jueves 21 de agosto de 2014
Jueves 21 de agosto de 2014
 
예비판정의결서(공개본)
예비판정의결서(공개본)예비판정의결서(공개본)
예비판정의결서(공개본)
 

Alaindavila

  • 1. index.php <!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>Inicio de Sesion</title> <style type="text/css"> <!-- body,td,th { color: #FFF; } body { background-color: #000; } --> </style></head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr> <td colspan="3"> <div align="center"> <table width="220" height="180" border="0"> <form action="menu.php" method="post">
  • 2. <tr> <td colspan="3"><div align="center"> <h1><strong>Inicio de Sesion</strong></h1> </div></td> </tr> <tr> <td width="60%"><div align="right"><strong>Usuario</strong></div></td> <td width="35%"><input type="text" name="txtUsser" id="txtUsser"/></td> </tr> <tr> <td><div align="right"><strong>Contraseña</strong></div></td> <td><input type="password" name="txtPass" id="txtPass" /></td> </tr> <tr> <td colspan="3"><div align="right"> <input type="submit" name="btnEnviar" id="btnEnviar" value="Login" /> </div></td> </tr> </form> </table> </div></td> </tr> </table> </div> </body> </html> menu.php
  • 3. <?php session_start(); include("conexion.php"); if(isset($_POST['txtUsser']) && !empty($_POST['txtUsser']) && isset($_POST['txtPass']) && !empty($_POST['txtPass'])) { $con = mysql_connect($host, $user, $password) or die("hay problemas con el servidor"); mysql_select_db($db, $con) or die("hay problemas con la base de datos"); $seleccion = mysql_query("SELECT Usuario, Clave FROM Registros WHERE Usuario = '$_POST[txtUsser]'", $con); $sesion = mysql_fetch_array($seleccion); if($_POST['txtPass'] == $sesion['Clave']) { ?> <!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>menu</title> </head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr bgcolor="white"> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><a href="logout.php"><strong>LogOut</strong></a></div></td> </tr> </table> </body> </html> <?Php }else{ ?> <!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>listado</title> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr> <td colspan="5"> <center> <a href="index.php"> <h4>Usuario o Contraseña incorrecta</h4></a> <?Php header("Location : index.php"); } }else{ ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  • 4. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>listado</title> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr> <td colspan="3"> <center> <a href="index.php"> <h4>Llenar los Campos son Obligatorios</h4></a> <?Php header("Location : index.php"); } ?> listado.php <?php include("conexion.php"); $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor"); mysql_select_db($db, $conexion) or die("hay problemas con la base de datos");// Selecciona la base de datos
  • 5. $tabla = mysql_query("SELECT * FROM Matriculas"); // Selecciono todos los registros de la tabla ?> <!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>listado</title> <style type="text/css"> <!-- body,td,th { color: #FFF; } --> </style></head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr bgcolor="white"> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><a href="logout.php"><strong>LogOut</strong></a></div></td> </tr> <tr> <td colspan="3"> <center> <h1>Lista de Alumnos</h1> </center> <form id="MyForm" name="MyForm" method="post" action=""> <table align="Center" border="1" width="60%" cellspacing="0" cellpadding="2"> <tr align="center"> <td>Id</td> <td>Dni</td> <td>Apellidos</td> <td>Nombres</td> <td>Email</td> <td>Especialidad </td> <td>Turno</td> <td>Semestre</td> </tr> <?php while ($Registro = mysql_fetch_array($tabla)) { ?> <tr> <td> <?php $Id=$Registro['Id']; echo "<input type='checkbox' id='chkRegistro' name='chkRegistro' value='$Id'>"; echo $Registro['Id']; ?> </td> <td><?php echo $Registro['Dni'];?></td> <td><?php echo $Registro['Apellidos'];?></td> <td><?php echo $Registro['Nombres'];?></td> <td><?php echo $Registro['Email'];?></td> <td><?php echo $Registro['Especialidad'];?></td> <td><?php echo $Registro['Turno'];?></td> <td><?php echo $Registro['Semestre'];?></td> </tr>
  • 6. <?php } mysql_free_result($tabla); mysql_close($conexion); ?> </table> <center> <p> <input type="button" onclick="this.form.action='eliminar.php' ;this.form.submit();" name="btnEliminar" value="Eliminar" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="button" onclick="this.form.action='consulta.php' ;this.form.submit();" name="btnActualizar" value="Actualizar" /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="button" onclick="this.form.action='mostrar.php' ;this.form.submit();" name="btnInsertar" value="Insertar" /> </p> </center> </form> </td> </tr> </table> </div> </body> </html> mostrar.php <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  • 7. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>mostrar</title> <style type="text/css"> <!-- body,td,th { color: #FFF; } --> </style></head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr bgcolor="white"> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><a href="logout.php"><strong>LogOut</strong></a></div></td> </tr> <tr> <td colspan="3"> <div align="center"> &nbsp; &nbsp; <table align="center"> <form id="form1" name="form1" method="post" action="insertar.php"> <tr> <td colspan="2"><div align="center"><strong>Matricular Alumnos</strong></div></td> </tr> <tr> <td><div align="right">Dni:</div></td> <td><input name="txtDni" type="text" id="txtDni" size="30" maxlength="8"/></td> </tr> <tr> <td><div align="right">Apellidos:</div></td> <td><input name="txtApellidos" type="text" id="txtApellidos" size="30" maxlength="50" /></td> </tr> <tr> <td><div align="right">Nombres:</div></td> <td><input name="txtNombres" type="text" id="txtNombres" size="30" maxlength="50" /></td> </tr> <tr> <td><div align="right">Email:</div></td> <td><input name="txtEmail" type="text" id="txtEmail" size="30" maxlength="50" /></td> </tr> <tr> <td><div align="right">Especialidad:</div></td> <td> <select name="cboEspecialidad" id="cboEspecialidad"> <option value="Computacion e Informatica">Computacion e Informatica</option> <option value="Contabilidad">Contabilidad</option> <option value="Secretariado">Secretariado</option> <option value="Administracion">Administracion</option> <option value="Enfemeria">Enfermeria</option> <option value="Diseño Grafico">Diseño Grafico</option> <option value="Electronica">Electronica</option> <option value="Cursos corto">Cursos cortos</option> </select> </td> </tr>
  • 8. <tr> <td><div align="right">Turno:</div></td> <td> <select name="cboTurno" id="cboturno"> <option value="M">Mañana</option> <option value="T">Tarde</option> <option value="N;">Nocturna</option> </select> </td> </tr> <tr> <td><div align="right">Semestre:</div></td> <td> <select name="cboSemestre" id="cboSemestre"> <option value="1">Semestre 1</option> <option value="2">Semestre 2</option> <option value="3;">Semestre 3</option> <option value="4;">Semestre 4</option> <option value="5;">Semestre 5</option> <option value="6;">Semestre 6</option> </select> </td> </tr> <tr> <td colspan="2"><div align="center"> <p> <input type="submit" name="btnEnviar" id="btnEnviar" value="Agregar" /> &nbsp; &nbsp; &nbsp; &nbsp; <input type="reset" name="btnRestablecer" id="btnRestablecer" value="Restaurar" /> </p> </div></td> </tr> </form> </table> </div> </tr> </table> </div> </body> </html>
  • 9. buscar.php <?php include("conexion.php"); $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor"); mysql_select_db($db, $conexion) or die("hay problemas con la base de datos"); $Especialidad = $_POST["cboEspecialidad"]; $Turno = $_POST['cboTurno']; $Semestre = $_POST['cboSemestre']; $Dni = $_POST['txtDni']; if($Dni=="" && $Especialidad=="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" && $Turno=="Seleccione Turno") { ?> <!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>
  • 10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Llenar los Campos son Obligatorios</title> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr> <td colspan="3"> <center> <a href="ver.php"> <h4>Seleccionar algun Criterio de Busqueda</h4></a> </script> <?Php header("Location :ver.php"); } else { if($Dni!="" && ($Especialidad=="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" && $Turno=="Seleccione Turno" ) || ($Especialidad!="Seleccione Especialidad" || $Semestre!="Seleccione Semestre" || $Turno!="Seleccione Turno" )) { $query = "SELECT * FROM Matriculas WHERE Dni='$Dni'"; } if($Especialidad!="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" && $Turno=="Seleccione Turno" && $Dni=="") { $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad'"; } if($Semestre!="Seleccione Semestre" && $Especialidad=="Seleccione Especialidad" && $Turno=="Seleccione Turno" && $Dni=="") { $query = "SELECT * FROM Matriculas WHERE Semestre='$Semestre'"; } if($Turno!="Seleccione Turno" && $Especialidad=="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" && $Dni=="") { $query = "SELECT * FROM Matriculas WHERE Turno='$Turno'"; } if($Turno=="Seleccione Turno" && $Especialidad!="Seleccione Especialidad" && $Semestre!="Seleccione Semestre" && $Dni=="") { $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad' AND Semestre='$Semestre'"; }
  • 11. if($Turno!="Seleccione Turno" && $Especialidad!="Seleccione Especialidad" && $Semestre=="Seleccione Semestre" && $Dni=="") { $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad' AND Turno='$Turno'"; } if($Turno!="Seleccione Turno" && $Especialidad=="Seleccione Especialidad" && $Semestre!="Seleccione Semestre" && $Dni=="") { $query = "SELECT * FROM Matriculas WHERE Semestre='$Semestre' AND Turno='$Turno'"; } if($Turno!="Seleccione Turno" && $Especialidad!="Seleccione Especialidad" && $Semestre!="Seleccione Semestre" && $Dni=="") { $query = "SELECT * FROM Matriculas WHERE Especialidad='$Especialidad' AND Semestre='$Semestre' AND Turno='$Turno'"; } $result = mysql_query($query) or die("ERROR..."); $numero = 0; ?> <!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>buscar</title> <style type="text/css"> <!-- body,td,th { color: #FFF; } --> </style></head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr bgcolor="white"> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><a href="logout.php"><strong>LogOut</strong></a><strong></strong></div></td> </tr> <tr> <td colspan="3"> <div align="center"> <h1>Resultados</h1> <table border="1" width="900">
  • 12. <tr align="center"> <td>Id</td> <td width="100">Dni</td> <td>Apellidos y Nombres</td> <td>Email</td> <td>Especialidad</td> <td>Turno</td> <td>Semestre</td> </tr> <?Php while($row = mysql_fetch_array($result)) { ?> <tr> <td><?Php echo $row["Id"];?></td> <td><?Php echo $row["Dni"]; ?></td> <td><?Php echo $row["Apellidos"]." ".$row["Nombres"]; ?></td> <td><?Php echo $row["Email"];?></td> <td><?Php echo $row["Especialidad"];?></td> <td><?Php echo $row["Turno"];?></td> <td><?Php echo $row["Semestre"];?></td> </tr> <?Php $numero++; } mysql_free_result($result); mysql_close($conexion); ?> </table> </div> </td> </tr> </table> </div> </body> </html> <?Php } ?>
  • 13. Ver.php <!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>ver</title> <style type="text/css"> <!-- body,td,th { color: #FFF; } --> </style></head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr>
  • 14. <tr bgcolor="white"> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><a href="logout.php"><strong>LogOut</strong></a><strong></strong></div></td> </tr> <tr> <td colspan="3"> <div align="center"> <form id="form1" name="form1" method="post" action="buscar.php"> <table width="700"> <tr> <td align="center" colspan=5><h1>Busqueda de Alumnos</h1></td></tr> <tr><td align="center"><b>Especialidad</li></b> </td><td align="center"><b>Turno</li></b> </td><td align="center"><b>Semestre</li></b> </td><td><b>Dni del Alumno</li></b> </td> </tr> <tr> <td align="center"> <select name="cboEspecialidad" id="cboEspecialidad"> <option value="Seleccione Especialidad">Seleccione Especialidad</option> <option value="Computacion e Informatica">Computacion e Informatica</option> <option value="Contabilidad">Contabilidad</option> <option value="Secretariado;">Secretariado</option> <option value="Administracion">Administracion</option> <option value="Enfemeria">Enfermeria</option> <option value="Diseño Grafico">Diseño Grafico</option> <option value="Electronica">Electronica</option> <option value="Cursos corto">Cursos cortos</option> </select></td> <td align="center"> <select name="cboTurno" id="cboturno"> <option value="Seleccione Turno">Seleccione Turno</option> <option value="M">Mañana</option> <option value="T">Tarde</option> <option value="N;">Nocturna</option> </select> </td><td align="center"> <select name="cboSemestre" id="cboSemestre"> <option value="Seleccione Semestre">Seleccione Semestre</option> <option value="1">Semestre 1</option> <option value="2">Semestre 2</option> <option value="3">Semestre 3</option> <option value="4">Semestre 4</option> <option value="5">Semestre 5</option> <option value="6">Semestre 6</option> </select> </td> <td> <input type="text" name="txtDni" size=20 maxlength=8 /> </td> </tr> <tr> <td align="center" colspan="4"><br/> <input type="submit" name="btnBuscar" value="Buscar" /> &nbsp; &nbsp; &nbsp; <input type="reset" name="btnRestablecer" value="Restaurar" /> </td> </tr> </table> </form> </div> </td> </tr>
  • 15. </table> </div> </body> </html> actualizar.php <?php include("conexion.php"); $Id=$_POST['txtId']; $strDni=$_POST['txtDni']; $strApellidos=$_POST['txtApellidos']; $strNombres=$_POST['txtNombres']; $strEmail=$_POST['txtEmail']; $strEspecialidad=$_POST['txtEspecialidad']; $strTurno=$_POST['txtTurno']; $strSemestre=$_POST['txtSemestre']; $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor"); mysql_select_db($db, $conexion) or die("hay problemas en la base de datos"); if(isset($strDni) && !empty($strDni) && isset($strApellidos) && !empty($strApellidos) && isset($strNombres) && !empty($strNombres) && isset($strEmail) && !empty($strEmail) && isset($strEspecialidad) && !empty($strEspecialidad) && isset($strTurno) && !empty($strTurno) && isset($strTurno) && !empty($strTurno)) { $Sql="UPDATE Matriculas SET Dni='$strDni', Apellidos='$strApellidos', Nombres='$strNombres', Email='$strEmail', Especialidad='$strEspecialidad', Turno='$strTurno', Semestre='$strSemestre' WHERE Id='$Id'"; mysql_query($Sql); header ("Location: listado.php"); }else{ echo "Es obligatorio llenar todos los campos"; } ?>
  • 16. conexion.php <?php $host = "localhost"; $user = "system_usuario"; $password = "/45468853"; $db = "system_instituto"; ?>
  • 17. consulta.php <?php if(isset($_POST['chkRegistro'])) { include("conexion.php"); $conexion = mysql_connect($host, $user, $password) or die("Problemas con Server"); mysql_select_db($db, $conexion) or die("Ploblemas con BD");// Selecciona la base de datos $Id=$_POST['chkRegistro']; $sql=mysql_query("SELECT * FROM Matriculas WHERE Id=$Id"); $Registro = mysql_fetch_array($sql); ?> <!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>consulta</title> <style type="text/css"> <!-- body,td,th { color: #FFF;
  • 18. } --> </style></head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr bgcolor="white"> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><a href="logout.php"><strong>LogOut</strong></a><strong></strong></div></td> </tr> <tr> <td colspan="3"> <center> <h1> Actualizar Matricula</h1></center> <form id="form1" name="form1" method="post" action="actualizar.php"> <table width="35%" border="0" cellpadding="2" cellspacing="2" align="center"> <tr> <?php echo "<input name='txtId' type='hidden' value='$Registro[0]'>";?> </tr> <tr> <td align="right">Dni</td> <td><?php echo "<input name='txtDni' type='text' size='30' value='$Registro[1]'>";?></td> </tr> <tr> <td align="right">Apellidos</td> <td><?php echo "<input name='txtApellidos' type='text' size='30' value='$Registro[2]'>";?></td> </tr> <tr> <td align="right">Nombres</td> <td><?php echo "<input name='txtNombres' type='text' size='30' value='$Registro[3]'>";?></td> </tr> <tr> <td align="right">Email</td> <td><?php echo "<input name='txtEmail' type='text' size='30' value='$Registro[4]'>";?></td> </tr> <tr> <td align="right">Especialidad</td> <td><?php echo "<input name='txtEspecialidad' type='text' size='30' value='$Registro[5]'>";?></td> </tr> <tr> <td align="right">Turno</td> <td><?php echo "<input name='txtTurno' type='text' size='30' value='$Registro[6]'>";?></td> </tr> <tr> <td align="right">Semestre</td> <td><?php echo "<input name='txtSemestre' type='text' size='30' value='$Registro[7]'>";?></td> </tr> <tr> <td colspan="2" align="center"> <input type="submit" name="Submit" value="Actualizar" /> </td> </tr> </table>
  • 19. </form> </td> </tr> </table> </div> </body> </html> <?Php }else{ ?> <?Php $pagina = "http://alain.systemsecret.net/error.php"; Header("Location: $pagina"); } ?> eliminar.php <?php include("conexion.php"); if(isset($_POST['chkRegistro'])) { $valor=$_POST['chkRegistro']; $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor"); mysql_select_db($db, $conexion) or die("hay problemas con la base de datos"); mysql_query("DELETE FROM Matriculas WHERE Id =$valor"); $pagina = "http://alain.systemsecret.net/listado.php"; Header("Location: $pagina"); }else{ ?> <?Php $pagina = "http://alain.systemsecret.net/error.php"; Header("Location: $pagina"); } ?> error.php
  • 20. <?php include("conexion.php"); $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor"); mysql_select_db($db, $conexion) or die("hay problemas con la base de datos"); $tabla = mysql_query("SELECT * FROM Matriculas"); ?> <!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>listado</title> <style type="text/css"> <!-- body,td,th { color: #FFF; } body { background-color: #000; } --> </style></head> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center"> <table width="800" border="0"> <tr>
  • 21. <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr bgcolor="white"> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="listado.php">Administrar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><strong><a href="ver.php">Consultar</a></strong></div></td> <td width="200" bgcolor="#000000"><div align="center"><a href="logout.php"><strong>LogOut</strong></a></div></td> </tr> <tr> <td colspan="3"> <center> <a href="listado.php"> <h4>Debe selecionar un Registro</h4></a> </center> </form> </td> </tr> </div> </body> </html> insertar.php <?php include("conexion.php"); $strDni=$_POST['txtDni']; $strApellidos=$_POST['txtApellidos']; $strNombres=$_POST['txtNombres']; $strEmail=$_POST['txtEmail']; $strEspecialidad=$_POST['cboEspecialidad']; $strTurno=$_POST['cboTurno']; $strSemestre=$_POST['cboSemestre']; $conexion = mysql_connect($host, $user, $password) or die("hay problemas con el servidor"); mysql_select_db($db, $conexion) or die("hay problemas con la base de datos"); if(isset($strDni) && !empty($strDni) && isset($strApellidos) && !empty($strApellidos) && isset($strNombres) && !empty($strNombres) && isset($strEmail) && !empty($strEmail) && isset($strEspecialidad) && !empty($strEspecialidad) && isset($strTurno) && !empty($strTurno) && isset($strSemestre) && !empty($strSemestre)) { $Sql="INSERT INTO Matriculas (Id, Dni, Apellidos, Nombres, Email, Especialidad, Turno, Semestre)". " VALUES (NULL, '$strDni', '$strApellidos', '$strNombres', '$strEmail', '$strEspecialidad', '$strTurno', '$strSemestre')"; mysql_query($Sql); header ("Location: listado.php"); }else{ ?> <!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>listado</title> <body background="imagenes/estrellas.gif" link="#FF0000" vlink="#FFFF00" alink="#CC00FF"> <div align="center">
  • 22. <table width="800" border="0"> <tr> <td colspan="3"><img src="imagenes/logo.jpg" width="900" height="200"/></td> </tr> <tr> <td colspan="3"> <center> <a href="mostrar.php"> <h4>Llenar los Campos son Obligatorios</h4></a> <?Php header("Location : mostrar.php"); } ?> logout.php <?php session_start(); session_destroy(); header( 'Location: index.php' ) ; ?> Matriculas.SQL
  • 23.