File: /home/asjudine/public_html/descargar_archivos_libranzas.php
<?php
require_once("Conectarse.php");
include ("config.php");
global $dbi;
if ($_GET["libranza"]>="0" and $_GET["libranza"]<="5000")
{
$result = mysql_query('SELECT * FROM libranzas_5000 WHERE cedula= "'.$_GET["cedula"].'" and clase_contrato= "'.$_GET["tipo"].'" and numero_libranza="'.$_GET["libranza"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
$row = mysql_fetch_row($result);
$cedula = $row[0];
$nombre = $row[6];
$contenido = $row[7];
$tipo = $row[8];
header("Content-type: $tipo");
header("Content-Disposition: attachment; filename=$nombre");
print $contenido;
}
}
///// PARTE 2
if ($_GET["libranza"]>"5000" and $_GET["libranza"]<="10000")
{
$result = mysql_query('SELECT * FROM libranzas_10000 WHERE cedula= "'.$_GET["cedula"].'" and clase_contrato= "'.$_GET["tipo"].'" and numero_libranza="'.$_GET["libranza"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
$row = mysql_fetch_row($result);
$cedula = $row[0];
$nombre = $row[6];
$contenido = $row[7];
$tipo = $row[8];
header("Content-type: $tipo");
header("Content-Disposition: attachment; filename=$nombre");
print $contenido;
}
}
///// PARTE 3
if ($_GET["libranza"]>"10000" and $_GET["libranza"]<="15000")
{
$result = mysql_query('SELECT * FROM libranzas_15000 WHERE cedula= "'.$_GET["cedula"].'" and clase_contrato= "'.$_GET["tipo"].'" and numero_libranza="'.$_GET["libranza"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
$row = mysql_fetch_row($result);
$cedula = $row[0];
$nombre = $row[6];
$contenido = $row[7];
$tipo = $row[8];
header("Content-type: $tipo");
header("Content-Disposition: attachment; filename=$nombre");
print $contenido;
}
}
///// PARTE 4
if ($_GET["libranza"]>"15000" and $_GET["libranza"]<="20000")
{
$result = mysql_query('SELECT * FROM libranzas_20000 WHERE cedula= "'.$_GET["cedula"].'" and clase_contrato= "'.$_GET["tipo"].'" and numero_libranza="'.$_GET["libranza"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
$row = mysql_fetch_row($result);
$cedula = $row[0];
$nombre = $row[6];
$contenido = $row[7];
$tipo = $row[8];
header("Content-type: $tipo");
header("Content-Disposition: attachment; filename=$nombre");
print $contenido;
}
}
/// PARTE 5
if ($_GET["libranza"]>="20000" and $_GET["libranza"]<="30000")
{
$result = mysql_query('SELECT * FROM libranzas_30000 WHERE cedula= "'.$_GET["cedula"].'" and clase_contrato= "'.$_GET["tipo"].'" and numero_libranza="'.$_GET["libranza"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
$row = mysql_fetch_row($result);
$cedula = $row[0];
$nombre = $row[6];
$contenido = $row[7];
$tipo = $row[8];
header("Content-type: $tipo");
header("Content-Disposition: attachment; filename=$nombre");
print $contenido;
}
}
?>