#!/usr/bin/perl
$| = 1; # Para que Perl no utilize su buffer
use DBI; # Usar el DataBase Interface
use CGI qw/:standard/; # Usar el GCI.pm module
use strict 'vars';
use vars '$dbh'; # Database handler
use vars '$sth'; # Statement handlers
###############################################################################
my $script_url = url(-absolute=>1); # direccion absoluta del script
my $path = "/home/admin/public_html/notariasanchezmanrique/consulta";
my $clave = param('clave');
my $clave_geren = "588312"; # clave gerencial - acceso a todo
###############################################################################
print header(-expires=>'-10m');
print start_html(-title=>"Notaria Sanchez Manrique - Consultas",
-style=>{'src'=>"/consultas/style.css"},
-background=>"/images/fondo.jpg", -BGCOLOR=>'FFFFFF' );
print "\n\n";
### debug #####################################################################
#my ($key_form);
#foreach $key_form (param()) { print("$key_form\=",param($key_form),"
\n"); }
###############################################################################
$dbh = DBI->connect("DBI:mysql:accesnot_sanchezm", "accesnot_sanman", "SanMan1100");
if (!defined $dbh) {
print "No se puede conectar a la base de datos...\n";
exit;
}
&print_file ("$path/_header.html");
if (!$clave) { print "
Clave no definida
\n"; } else { &show_data; } &print_file ("$path/_bottom.html"); print end_html; exit; ############################################################################### sub show_data { # Busca registros y los imprime en una tabla my (@data, $where, $limit, $total_rows, $start_row, $end_row); my ($pg, $pg_fin, $count, $str, $link, @align, $param_items); my ($cliente); my ($criterio2) = param('criterio2'); # primero buscamos si existe en la tabla de clientes $sth = $dbh->prepare("SELECT CLIENTE from clientes WHERE CLAVE='$clave'"); $sth->execute; $cliente = $sth->fetchrow; $sth->finish; if ($cliente) { print "No hay registros encontrados.
\n"; } else { # registros encontrados... $pg_fin = int($total_rows/$limit); if (($total_rows/$limit) != int($total_rows/$limit)) { $pg_fin++; } if ($pg > $pg_fin) { $pg = $pg_fin; } $start_row = ($pg-1)*$limit; $end_row = ($start_row+$limit); if ($end_row > $total_rows) { $end_row = $total_rows; } print "\n"; # Mostramos << si hay paginas anteriores if ($pg > 1) { print "<<\n"; } else { print "<< \n"; } if (((int(($pg-1)/10)*10)+1) > 1) { print "..."; } # Lista de 10 paginas agrupados 1..11 10..21 etc. for ($count=((int(($pg-1)/10)*10)+1); $count<=((int(($pg-1)/10)*10)+11); $count++) { if ($count <= $pg_fin) { if ($count != $pg) { print "$count\n"; } else { print "$count\n" } } } if (((int(($pg-1)/10)*10)+11) < $pg_fin) { print "..."; } # Mostramos >> si hay mas paginas. if ($pg < $pg_fin) { print ">>\n"; } else { print ">>\n"; } print " | \n"; } print "Regstros ", ($start_row+1), "-", $end_row, " de ", "$total_rows |
", "$str | \n"; $count++; } print "\n|||||
", "$data[3] | \n", "$data[5] | \n", "$data[6] | \n", "$data[8] | \n", "$data[9] | \n", "|
BUSCADOR | |||||
Mostrar Todo |