#!/usr/bin/perl
# por_autor.cgi
# Octavio Martinez de la Vega
# Presenta autores y folios de las presentaciones libres y da las ligas a esos archivos.

use CGI qw(:standard);
use DBI;

print "Content-Type: text/html\n\n";
print '<meta http-equiv=Content-Type content="text/html; charset=macintosh">';
print "\n<head>\n","<title>Autores</title>\n","</head>\n","<body>\n";
print '<IMG SRC="GUIRNALDAREDBIO2010.gif" WIDTH=150 HEIGHT=150 ALIGN=RIGHT>',"\n";
print h2("REDBIO M&eacute;xico 2010<br>&Iacute;ndice Por Autores<hr>");

if (param()) { # Ya se tienen datos
$autor = param("autor");
$dbh = DBI->connect ("DBI:mysql:host=localhost;database=redbio","omartine", "password",
 {PrintError => 1, RaiseError => 1});
print h2("Autor: $autor");
print h3("Se presentan TODOS los autores que concuerdan con su criterio de selecci&oacute;n<br>(puede ver el resumen del trabajo haciendo \'click\' con el rat&oacute;n en la liga del folio del trabajo)<hr>");
$orden = "select autori, folio from autorind where autori like \'%$autor%\' order by autori;";
$sth = $dbh->prepare ($orden); $sth->execute ();
while ( @row = $sth->fetchrow_array ) {
           print "$row[0]<a href=$row[1].html> Folio: $row[1]</a><hr>\n";
         }
print "<b>Autores de trabajos corregidos:</b><hr><br>";
$orden = "select autori, folio from autorind_cor where autori like \'%$autor%\' order by autori;";
$sth = $dbh->prepare ($orden); $sth->execute ();
while ( @row = $sth->fetchrow_array ) {
           print "$row[0]<a href=$row[1].html> Folio: $row[1]</a><hr>\n";
         }

print "<a href=_indice.html>Regresar al Indice</a>";

} else {
 print start_form();
 print p("Puede introducir todo o parte del nombre del autor<br>",
"Autor: ", textfield("autor"), "<br>");

 print p(submit("ENVIAR"), reset("BORRAR"));
 print end_form(), hr();
 print "<a href=_indice.html>Regresar al Indice</a>";

}
print end_html;
