pag1
Código PHP:
<html>
<head>
</head>
<body>
<form action="2.php" method="post">
Ingrese su matricula:<input type='text' name='matricula' /><br><br>
<input type="submit" value="confirmar">
</form>
</body>
</html>
Código PHP:
<?php
$matricula=$_POST['matricula'];
if($matricula)
{
include "config.php";
$consulta=mysql_query("SELECT * FROM registrados WHERE matricula='".$matricula."'");
$filas=mysql_fetch_array($consulta);
$matriculabd=$filas['matricula'];
$id=$filas['id'];
if($matricula==$matriculabd){
session_start();
$_SESSION['usuario']=$matriculabd;
$_SESSION['id']=$id;
echo "
<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=3.php'>
<script>
alert('Bienvenido');
</script>
</head>
</html>
";
}
else{
echo "
<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=index.php'>
<script>
alert('Has ingresado una matricula incorrecta, intente de nuevo!');
</script>
</head>
</html>
";
}
}
else{
echo "
<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=index.php'>
<script>
alert('Favor de ingresar su matricula!');
</script>
</head>
</html>
";
}
?>
Código PHP:
<?php
session_start();
$usuario=$_SESSION['usuario'];
$id=$_SESSION['id'];
if($usuario AND $id){
//echo "holaaaaaa"."<a href='cerrarsession.php'>Cerrar</a>";
echo "
<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=4.php'>
<script>
</script>
</head>
</html>
";
}
else{
echo "
<html>
<head>
<meta http-equiv='REFRESH' content='0 ; url=index.php'>
<script>
alert('Matricula incorrecta!');
</script>
</head>
</html>
";
}
?>
Código PHP:
<?php
session_start();
include "config.php";
$registros=mysql_query("select * from registrados where matricula='$_REQUEST[matricula]'",$conexion) or
die("Problemas en el select:".mysql_error());
if ($reg=mysql_fetch_array($registros))
{
echo "Nombre:".$reg['nombre']."<br>";
}
else
{
echo "No existe un alumno con ese mail.";
}
mysql_close($conexion);
?>