<?php

//CONEXION A LA BASE DE DATOS
include ("conexion.php");

//CAPTURA DE DATOS DEL URL
$matricula=$_POST['matricula'];
$apellidos=$_POST['apellidos'];
$nombre=$_POST['nombre'];
$semestre=$_POST['semestre'];
$status=$_POST['status'];
$grupo=$_POST['grupo'];

$cons1="SELECT * FROM personal WHERE CvePersonal='$matricula'";
$res1=mysql_query($cons1,$conex) or die ("No se realizo cons1");
$existe=mysql_fetch_row($res1);

if ($existe==0)
{
	$cons2="insert into personal (CvePersonal,ApePersonal,NomPersonal,semestre,status,grupo) values ('$matricula','$apellidos','$nombre','$semestre','$status','$grupo')" ;
	$res2=mysql_query($cons2,$conex) or die (mysql_error() . "No se pudo insertar nuevo alumno");
}
else
{
?>
	<script>
		location.href="main.php?a=4741&error=1";
	</script>
<?php
}
mysql_close($conex);
?>
<!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=iso-8859-1" />
<title>UCA :.</title>
<link href="ucaestilos.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	background-color: #CCCCCC;
}
-->
</style></head>

<body>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td><img src="img/top02.jpg" width="800" height="100"></td>
  </tr>
  <tr>
    <td><p>&nbsp;</p>
    <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td><div align="center"><img src="img/confproc.jpg"  /></div></td>
      </tr>
    </table>
    <br><table width="200" border="0" align="center" cellspacing="10">
  <tr>
    <td width="97"><form id="form1" name="form1" method="post" action="main.php?a=4741">
      <div align="center">
        <p>
          <input name="Submit" type="submit" class="boton2" value="Registrar otro" />
        </p>
        </div>
    </form></td>
    <td width="93"><form id="form1" name="form1" method="post" action="main.php?a=474">
      <div align="center">
        <p>
          <input name="Submit" type="submit" class="boton2" value="Volver a alumnos" />
        </p>
        </div>
    </form></td>
  </tr>
</table>

    
    <p>&nbsp;</p>
    <table width="100%" border="0">
     <tr>
        <td height="26" style="background-color:#0D3356;">
        <div align="center" id="noimprimible">
          <table width="99%" border="0" align="center" cellpadding="2" cellspacing="0">
            <tr>
              <td align="center" class="style8">Desarrollado para la Universidad Cuauht&eacute;moc por <a href="http://www.upweb.mx" target="_blank"><img src="img/webmaster.svg" style="height:16px; vertical-align:bottom;"></a></td>
            </tr>
          </table>
        </div></td>
        </tr>
    </table>    </td>
  </tr>
  
</table>
</body>
</html>
