<?php

if (isset($_SESSION['usuario'])){

$user=$_SESSION['usuario'];

}

else{

?>

<script>

location.href="index.php?errorusuario=3";

</script>

<?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=iso-8859-1" />

<title>Untitled Document</title>



<link href="ucaestilos.css" rel="stylesheet" type="text/css" />

</head>



<body>

<table width="950" border="0" align="center">

  <tr>

    <td><p class="style10">CAT&Aacute;LOGO DE MATERIAS</p></td>

  </tr>

  <tr>

    <td><table width="100%" height="0" border="0" cellpadding="0" cellspacing="5">

      <tr>

        <td width="8%" valign="top">

        <form id="form2" name="form2" method="post" action="main.php?a=971">

            <input name="Submit" type="submit" class="boton2" value="Nueva materia">

        </form>

        </td>

        <td width="92%" valign="top">&nbsp;</td>

      </tr>

      <tr>

        <td colspan="3" align="center" valign="top"><hr width="100%" size="1" noshade="noshade" color="#0D3356" /></td>

      </tr>

    </table></td>

  </tr>

</table>

<table width="700" border="0" align="center" cellpadding="0" cellspacing="0">

  <tr>

    <td><p class="style4">Listado de materias:</p>

        <div>

          <?php
echo "<table align='center' cellpadding='2' class='tablaBordes'>";
echo "<tr class='tablaCabecera' align='center'>";


echo "<td>";
echo "Materia";
echo "</td>";

echo "<td>";
echo "Editar";
echo "</td>";

echo "<td>";
echo "Eliminar";
echo "</td>";


echo "</tr>";
include ("conexion.php");
$cons="SELECT * FROM materias ORDER BY materia" ;
$res=mysql_query($cons,$conex) or die ("No se realizo con exito la consulta de materias");
$numero_filas=mysql_num_rows($res);
$numero_campos= mysql_num_fields($res);
while ($fila=mysql_fetch_row($res)){				  

echo "<tr class='tablaBordes'>";

echo "<td class='style1'>";
echo $fila[1];
echo "</td>";



//Eliminar
echo "<td align='center'>";
echo "<a href='main.php?a=972&idMateria="; echo $fila[0]; echo "'> <img src='img/icon_edit.jpg' border='0' ALT='Editar materia'> </a>";
echo "</td>";

echo "<td align='center'>";
echo "<a href='deletemateria.php?idMateria="; echo $fila[0]; echo "'> <img src='img/icon_delete.jpg' border='0' ALT='Eliminar materia'> </a>";
echo "</td>";


echo "</tr>";

}

echo "</table>";

mysql_free_result($res);



?>

        </div>

      <p class="style4"></p>

      <p></p></td>

  </tr>

</table>

</body>

</html>

