Last active
May 1, 2017 19:26
-
-
Save nomarlo/2809830831f9a9aa4196490b92fb8dbc to your computer and use it in GitHub Desktop.
Este codigo presenta malas practicas y es parte de un post que puedes consultar aquí: http://tripley.net/cronica-comportamiento-esperado
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
<title>Maestros</title> | |
<meta charset="utf-8" /> | |
<link rel="shortcut icon" href="css/favico.ico" /> | |
<link rel="stylesheet" href="css/estilomaestros.css" type="text/css" /> | |
<script type="text/javascript" src="js/PaginasMaestros.js"></script> | |
<script type="text/javascript" src="js/jquery-3.2.1.js"></script> | |
<script type="text/javascript" src="js/js.cookie.js"></script> | |
<?php | |
function pasandoMatricula() | |
{ | |
include 'Conexion.php'; | |
if (isset($_COOKIE["matr"])) { | |
$Matri = $_COOKIE["matr"]; | |
$sql = "SELECT * FROM alumnos WHERE matricula = '$Matri'"; | |
$ejecutar = $base->prepare($sql); | |
$ejecutar->execute(); | |
$numero = $ejecutar->rowCount(); | |
echo "<br>"; | |
echo $Matri."r"; | |
echo "<br>"; | |
echo $sql; | |
echo "<br>"; | |
echo $numero; | |
echo "<br>"; | |
if ($numero != 0) | |
{ | |
while($resultado = $ejecutar->fetch(PDO::FETCH_ASSOC)) | |
{ | |
$Nombre = $resultado['nombre'] . " " . $resultado['paterno'] . " " . $resultado['materno']; | |
} | |
echo $Nombre; | |
} | |
else | |
{ | |
echo "No hay ningun alumno registrado con esa matricula"; | |
} | |
} | |
} | |
?> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('.NombreAlumno font').html("<?php pasandoMatricula();?>"); | |
$('#matricula').keyup(function(){ | |
var caracteres = $('#matricula').val().length; | |
var matricula = $('#matricula').val(); | |
var pepe = 'hola'; | |
if (caracteres == 11) | |
{ | |
Cookies.set('matr', matricula); | |
alert(matricula); | |
window.location="/MaestrosReportes.php"; | |
} | |
else { | |
$('.NombreAlumno font').html(''); | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<!----------------------------------------------------------------------------------------------------------------------------------------------------> | |
<?php | |
include("CompruebaSesion.php"); | |
?> | |
<!----------------------------------------------------------------------------------------------------------------------------------------------------> | |
<!--<div class="opciones"> | |
<button name="BTNInicio" onclick="inicio();" type="button">Inicio</button> | |
<button name="BTNGrupos" onclick="grupos();" type="button">Grupos</button> | |
<button name="BTNReportes" onclick="reportes();" type="button">Reportes</button> | |
<button name="BTNSesion" onclick="logout();">Cerrar Sesion</button> | |
</div> | |
<!----------------------------------------------------------------------------------------------------------------------------------------------------> | |
<div class="cuerpo"> | |
<br> | |
<form action="AgregarReporte.php" method="post" id="reportes"> | |
Inserte el asunto del reporte: | |
<input type="text" name="titulo" /> | |
<br><br> | |
Inserte la descripcion del reporte: | |
<input type="text" name="cuerpo" /> | |
Inserte la fecha: | |
<input type="date" name="fecha"/> | |
<br><br> | |
Inserte la matricula: | |
<input type="text" name="matricula" id="matricula" value=""/><br><br> | |
<div class="NombreAlumno"> | |
<font color="red"> </font> | |
</div> | |
<button type="submit">Aplicar reporte</button> | |
</form> | |
</div> | |
<!----------------------------------------------------------------------------------------------------------------------------------------------------> | |
<div class="nombre"> | |
<?php | |
include("nombre.php"); | |
?> | |
</div> | |
<!----------------------------------------------------------------------------------------------------------------------------------------------------> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment