<?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="750" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td>
        <form action="svusuario.php" method="post" name="form1">
          <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td>
                <p class="style4">Nuevo Usuario:</p>
                <hr align="left" width="600" size="1" color="#999999" />
                <div align="center">
                  <?php if (isset($_GET['error']))
                    $error = $_GET['error']; {

                    if (isset($error)) {
                      $error = $_GET['error'];

                      if ($error == 1) {
                        echo "<p class='style3'>Los campos de contrase�a no coinciden</p>";
                      }
                      if ($error == 2) {
                        echo "<p class='style3'>�El nombre de usuario ya existe!</p>";
                      }
                    } else {
                    }
                  }
                  ?>
                </div>
                <table width="431" border="0" align="center" cellspacing="5">
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Nombre del Usuario:</p>
                    </td>
                    <td width="234"><input name="nombre" type="text" class="cuadrotexto" id="nombre" size="30" maxlength="30" /></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">ID Usuario:</p>
                    </td>
                    <td width="234"><input name="id" type="text" class="cuadrotexto" id="id" size="15" maxlength="15" /></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Contrase&ntilde;a:</p>
                    </td>
                    <td width="234"><input name="contra1" type="password" class="cuadrotexto" id="contra1" size="15" maxlength="15" /></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">*Verificar contrase&ntilde;a:</p>
                    </td>
                    <td width="234"><input name="contra2" type="password" class="cuadrotexto" id="contra2" size="15" maxlength="15" /></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Tipo de usuario:</p>
                    </td>
                    <td width="234"><select name="tipo" class="cuadrotexto" id="tipo">
                        <option value="administrador" selected="selected">Administrador</option>
                        <option value="farmacia">Farmacia</option>
                        <option value="caja">Caja</option>
                        <option value="coordinador">Coordinador</option>
                      </select>
                    </td>
                  </tr>
                  <tr>
                    <td class="style4">Correo:</td>
                    <td><input name="correo" type="text" class="cuadrotexto" id="correo" size="30" maxlength="40" /></td>
                  </tr>
                  <tr>
                    <td width="178" class="style1">
                      <p class="style4">Cl&iacute;nica:</p>
                    </td>
                    <td width="234">
                      <?php

                      include("conexion.php");
                      $cons = "SELECT * FROM clinicas";
                      $res = mysql_query($cons, $conex) or die("No se pudo consultar las clinicas");
                      echo "<select name='clinica' class='cuadrotexto'>";
                      while ($campo = mysql_fetch_assoc($res)) {
                        echo "<option value=" . $campo['idClinica'] . " >" . $campo['clinica'] . "</option>";
                      }
                      echo "</select>";

                      ?>
                    </td>
                  </tr>
                </table>
                <p class="style4"></p>
                <table width="500" border="0" align="center" cellspacing="10">
                  <tr>
                    <td width="193">
                      <div align="right">
                        <input name="Reset" type="reset" class="boton2" value="Limpiar" />
                      </div>
                    </td>
                    <td width="273"><input name="Submit2" type="submit" class="boton2" value="Guardar" /></td>
                  </tr>
                </table>
                <p></p>
              </td>
            </tr>
          </table>
        </form>
      </td>
    </tr>
  </table>

</body>

</html>