Dennis zapana perez
- 1. ACTUALIZAR .PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Dog care template</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<?PHP
session_start();
$d=$_SESSION['a'];
if($d!="s")
{
header('location: index.html');
}
?>
<body>
<div id="wrapper">
<div id="header">
<h1>Colegio Jesucristo Rey</h1>
<div id="nav-top">
<ul>
<li id="tab-map">
<div></div></li>
</ul>
</div>
<div id="nav">
- 2. <ul>
<li class="home"></li>
<li></li>
</ul>
</div>
</div>
<div id="content">
<center><h1>ActualizarLibros</h1></center>
<?php
$conexion =
mysql_connect("mysql14.000webhost.com","a1054738_gonza1","4pih7pox");
mysql_select_db('a1054738_cole', $conexion);
$id=$_POST['radregistro'];
if(isset($id) && $id!="")
{
$tabla=mysql_query("Select * from estudiante where idmatricula=$id");
$registro = mysql_fetch_array($tabla);
}
else
{
header ("Location: actualizar.php");
}
?>
<form id="form1" name="form1" method="post" action="edita.php">
<table width="35%" border="0" cellpadding="2" cellspacing="2"
align="center">
<tr>
<?php echo "<input name='txt1' type='hidden' value='$registro[0]'>";?>
</tr>
- 3. <tr>
<td align="right">DNI</td>
<td>
<?php echo "<input name='txt2' type='text' size='30'
value='$registro[1]'>";?>
</td>
</tr>
<tr>
<td align="right">Apellidos</td>
<td>
<?php echo "<input name='txt3' type='text' size='30' value='$registro[2]'>";?>
</td>
</tr>
<tr>
<td align="right">Nombres</td>
<td>
<?php echo "<input name='txt4' type='text' size='30' value='$registro[3]'>";?>
</td>
</tr>
<tr>
<td align="right">E-mail</td>
<td>
<?php echo "<input name='txt5' type='text' size='30'
value='$registro[4]'>";?>
</td>
</tr>
<tr>
<tdalign="right">Especialidad</td>
<td>
<selectname="especialidad">
<option>Computacion e Informtica</option>
- 4. <option>Contabilidad y Finanzas</option>
<option>EnfermeriaTecnica</option>
<option>Electronica digital</option>
</select>
</td>
</tr>
<tr>
<td align="right">Turno</td>
<td>
<select name="turno">
<option>Mañana</option>
<option>Tarde</option>
</select>
</td>
</tr>
<tr>
<td align="right">Semestre</td>
<td>
<select name="semestre">
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</select>
</td>
</tr>
<tr>
<td colspan="2" align="center">
- 5. <input type="submit" name="Submit" value="Actualizar" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table>
</form>
</div>
</div>
<div class="clear" id="footc"></div>
<div id="footer">
Copyright statement goes here. All rights reserved
</div>
</div>
</body>
</html>
BUSCAR.PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Dog care template</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<?PHP
session_start();
- 6. $d=$_SESSION['a'];
if($d!="s")
{
header('location: index.html');
}
?>
<body>
<div id="wrapper">
<div id="header">
<h1>Colegio Jesucristo Rey</h1>
<div id="nav-top">
<ul>
<li id="tab-map">
<div></div></li>
</ul>
</div>
<div id="nav">
<ul>
<li class="home"></li>
<li></li>
</ul>
</div>
</div>
<div id="content">
<div class="clear">
<form id="form1" name="form1" method="POST" action="busqueda.php">
<table width="94%" border="0" align="center">
<tr>
<td><table width="100%" border="0">
<tr align="center"><font size="+1">
- 7. <td width="31%">Especialidad</td>
<td width="31%">Turno</td>
<td width="31%">Semestre</td>
</font>
</tr>
<tr>
<tdalign="center"><labelfor="especialidad"></label>
<selectname="especialidad" id="especialidad">
<option>elegir</option>
<option>Computacion e Informatica</option>
<option>Contabilidad y Finanzas</option>
<option>EnfermeriaTecnica</option>
<option>Electronica Digital</option>
</select></td>
<tdalign="center"><labelfor="especialidad"></label>
<selectname="turno" id="turno">
<option>elegir</option>
<option>Mañana</option>
<option>Tarde</option>
</select></td>
<td align="center"><label for="especialidad"></label>
<select name="semestre" id="semestre">
<option>elegir</option>
<option>1</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
<option>6</option>
</select></td>
- 8. </tr>
</table></td>
</tr>
<tr align="center">
<td><input type="submit" name="button" id="button" value="Buscar" /></td>
</tr>
</table>
<a href="elegir.php">Regresar</a>
</form>
</div>
</div>
<div class="clear" id="footc"></div>
<div id="footer">
Copyright statement goes here. All rights reserved
</div>
</div>
</body>
</html>
EDITAR.PHP:
<?php
$id=$_POST['txt1'];
$dni=$_POST['txt2'];
$ap=$_POST['txt3'];
$nom=$_POST['txt4'];
$ema=$_POST['txt5'];
$esa=$_POST['especialidad'];
$tur=$_POST['turno'];
$se=$_POST['semestre'];
$conexion =
mysql_connect("mysql14.000webhost.com","a1054738_gonza1","4pih7pox");
- 9. mysql_select_db('a1054738_cole', $conexion);
$Sql="Update estudiante Set dni='$dni',apellidos='$ap',nombres='$nom',
email='$ema',especialidad='$esa',turno='$tur',semestre='$se' Whereidmatricula='$id'";
mysql_query($Sql);
header ("Location: actualizar.php");
?>
ELEGIR.PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Dog care template</title>
<link rel="stylesheet" href="style.css" type="text/css" charset="utf-8" />
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>ColegioJesucristo Rey</h1>
<div id="nav-top">
<ul>
<li id="tab-map"><div></div></li>
</ul>
</div>
<div id="nav">
<ul>
<li class="home"></li>
- 10. <li></li>
</ul>
</div>
</div>
<div id="content">
<div class="clear">
<?PHP
session_start();
$d=$_SESSION['a'];
if($d!="s")
{
header('location: index.html');
}
?>
<form id="form1" name="form1" method="POST" action="elegir.php">
<table width="100%" border="0">
<tr>
<td width="25%"><font size="+1"><a
href="suscripcion.php">INSERTAR</a></font></td>
<td width="25%"><font size="+1"><a href="buscar.php">BUSCAR</a></font></td>
<td width="26%"><font size="+1"><a href="actualizar.php">EDITAR</a></font></td>
<td width="24%"><font size="+1"><a
href="eliminacion.php">ELIMINAR</a></font></td>
</tr>
</table>
</form>
</div>
</div>
<div class="clear" id="footc"></div>
<div id="footer">
Copyright statement goes here. All rights reserved
- 11. </div>
</div>
</body>
</html>
ELIMINAR.PHP:
<?php
$v=implode(',',$_POST['chkregistro']);
$conexion =
mysql_connect("mysql14.000webhost.com","a1054738_gonza1","4pih7pox");
mysql_select_db('a1054738_cole', $conexion);
$tb= mysql_query("delete from estudiante where idmatricula IN(".$v.")");
header('location: eliminacion.php');
?>
ENLAZAR.PHP:
<?PHP
session_start();
if( (($_POST['txt1']=="gonza" &&isset($_POST['txt1']) && $_POST['txt1']!="")) &&
(($_POST['txt2']=="12345" &&isset($_POST['txt2']) && $_POST['txt2']!="")))
{
header('location: elegir.php');
$_SESSION['a']="s";
}
else
{
header('location: index.html');
}
?>
REGISTRAR.PHP:
<?PHP
functionvalida_email($email, $mx = false){
- 12. if(eregi("^([_a-z0-9-]+)(.[_a-z0-9-]+)*@([a-z0-9-]+)(.[a-z0-9-]+)*(.[a-z]{2,4})$",
$email))
if($mx){
list($username, $domain) = split("@", $email);
returngetmxrr($domain, $mxrecords);
}else
return true;
else
return false;
}
if((isset($_POST['txt1']) && $_POST['txt1']!="") && (isset($_POST['txt2']) &&
$_POST['txt2']!="") && (isset($_POST['txt4']) && $_POST['txt4']!=""
&&valida_email($_POST['txt4']) == true) && (isset($_POST['txt3']) &&
$_POST['txt3']!=""))
{
$d=$_POST["txt1"];
$ap=$_POST["txt2"];
$no=$_POST["txt3"];
$em=$_POST["txt4"];
$es=$_POST["especialidad"];
$tur=$_POST["turno"];
$se=$_POST["semestre"];
$conexion=mysql_connect("mysql14.000webhost.com","a1054738_gonza1","4pih7pox
") or die(mysql_error());
mysql_select_db("a1054738_cole",$conexion) or die(mysql_error());
$consulta="SELECT * FROM estudiante WHERE dni='$d'";
$consulta1="SELECT * FROM estudiante WHERE email='$em'";
$resultado=mysql_query($consulta,$conexion) or die("Operacion fallida: $consulta");
$resultado1=mysql_query($consulta1,$conexion) or die("Operacion fallida: $consulta");
if(mysql_num_rows($resultado))
{
header('location: suscripcion.php');
}
- 13. else
{
if(mysql_num_rows($resultado1))
{
header('location: suscripcion.php');
}
else
{
$sql="INSERT INTO
estudiante(dni,apellidos,nombres,email,especialidad,turno,semestre)
VALUES('$d','$ap','$no','$em','$es','$tur','$se')";
mysql_query($sql);
header('location: elegir.php');
}
}
}
else
{
header('location: suscripcion.php');
}
?>