<?php setcookie("login", $_COOKIE["login"] , time()+3600, "/", "deim.etse.urv.es", 1 ); ?>
<?php setcookie("sessio", $_COOKIE["sessio"] , time()+3600, "/", "deim.etse.urv.es", 1 ); ?>
<html>
  <head>
    <link rel="stylesheet" href="../estils/hoja.css" type="text/css">
    <title>Cercar tesi</title>
  </head>

  <body leftmargin="0" topmargin="0" bgcolor="#8F0000">
    <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
      <tr>
        <!-- Menú dret -->
        <td align="left" valign="top" width="100" bgcolor="#4F0000">
          <?php include("../menu.inc") ?>
        </td>

        <!-- Capçalera -->
        <td align="left" valign="top" width="100%" class="centered">
        <h2>Departament d'Enginyeria Informàtica i Matemàtiques</h2>
        <img src="images/separador.gif">
        <br><br>
        <div align="left"><blockquote>

        <!-- Començament del cos -->
        <?php 
          require("../private/connect.inc");
          require("../private/ident.inc");
          require("../private/func.inc");
          ident();
          autoritzar($_COOKIE["login"], "tesis_total");
          $link=Conectar();
        ?>
        <h2>Administració Tesis: Cercar</h2>
        <table border=0 width="190"><tr>
        <td align="center"><a href="cercar.php?lang=cat"><img src="images/catala.jpg" border=\"0\"></a></td>
        <td align="center"><a href="cercar.php?lang=en"><img src="images/english.jpg" border=\"0\"></a></td>
        <td align="center"><a href="cercar.php?lang=es"><img src="images/castellano.jpg" border=\"0\"></a></td>
        </tr></table>
        <br>
        <?php
              $lang = $_REQUEST["lang"];
              echo "Cercar a les taules de l'idioma: ";
              if ($lang == "es") {
                echo "Castellano";
              } else if ($lang == "en") {
                echo "English";
              } else {
                echo "Català";
              }
        ?>
        <br><br>
        <form action="cercardb.php" method="post">
          <b>Per titol:</b><br>
          <input name="titol" size="75" maxlength="100" type="text">
          <input type="hidden" name="type" value="titol">
          <input type="image" src="images/cercar.jpg"><br>
          <input type="hidden" name="lang" value="<?php echo $lang; ?>">
        </form>
        <form action="cercardb.php" method="post">
          <b>Per paraules clau:</b><br>
          <input name="keywords" size="75" maxlength="100" type="text">
          <input type="hidden" name="type" value="keywords">
          <input type="image" src="images/cercar.jpg"><br>
          <input type="hidden" name="lang" value="<?php echo $lang; ?>">
        </form>
        <form action="cercardb.php" method="post">
          <b>Per assignatures relacionades:<b><br>
          <input name="assignatures_rel" size="75" maxlength="100" type="text">
          <input type="hidden" name="type" value="assignatures_rel">
          <input type="image" src="images/cercar.jpg"><br>
          <input type="hidden" name="lang" value="<?php echo $lang; ?>">
        </form>
        <form action="cercardb.php" method="post">
          <b>Per director:</b><br>
          <select name="id">
          <?php
            $result=mysql_query("SELECT nom FROM personal ORDER BY nom");
            // Si nomes pot modificar les seves tesis, al afegir una tesis ell ha de ser 1
            // dels directors
              while($row = mysql_fetch_array($result)){
                echo "<option>" . $row["nom"] . "</option>";
              }
            mysql_free_result($result);
          ?>
          </select>
          <input type="hidden" name="type" value="id">
          <input type="image" src="images/cercar.jpg"><br>
          <input type="hidden" name="lang" value="<?php echo $lang; ?>">
        </form>
        <form action="cercardb.php" method="post">
          <b>Per categoria:</b><br>
          <select name="categoria">
          <?php
            $result=mysql_query("SELECT titol FROM categories");
            while($row = mysql_fetch_array($result)){
              echo "<option>" . $row["titol"] . "</option>";
            }
            mysql_free_result($result);
          ?>
          </select>
          <input type="hidden" name="type" value="categoria">
          <input type="image" src="images/cercar.jpg"><br>
          <input type="hidden" name="lang" value="<?php echo $lang; ?>">
        </form>
        <br><br>
        <a href="../login.php"><input type="image" src="images/tornar.jpg" border="0"></a>
        </blockquote></div>
        </td>
      </tr>
    </table>
  </body>
</html>

