File: /home/asjudine/www/descargar_archivos_novedades.php
<?php
//require_once("mainfile.php");
require_once("Conectarse.php");
//include ("config.php");
global $dbi;
///////////////CONSULTA PARA EL PRIMER ARCHIVO//////////////////////////////////
if ($_GET["valid"]== "1"){
$result = mysql_query('SELECT * FROM novedades_diarias WHERE id= "'.$_GET["id"].'" and sucursal= "'.$_GET["sucursal"].'" ');
if (!$result) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($result)!=0))
{
$row = mysql_fetch_row($result);
$cedula = $row[0];
$nombre = $row[34];
$contenido = $row[35];
$tipo = $row[36];
header("Content-type: $tipo");
header("Content-Disposition: attachment; filename=$nombre");
print $contenido;
}
}
///////////////CONSULTA PARA EL SEGUNDO ARCHIVO//////////////////////////////////
if ($_GET["valid"]== "2"){
$resulta = mysql_query('SELECT * FROM novedades_diarias WHERE id= "'.$_GET["id"].'" and sucursal= "'.$_GET["sucursal"].'"');
if (!$resulta) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($resulta)!=0))
{
$row2 = mysql_fetch_row($resulta);
$cedula2 = $row2[0];
$nombre2 = $row2[37];
$contenido2 = $row2[38];
$tipo2 = $row2[39];
header("Content-type: $tipo2");
header("Content-Disposition: attachment; filename=$nombre2");
print $contenido2;
}
}
///////////////CONSULTA PARA EL TERCER ARCHIVO//////////////////////////////////
if ($_GET["valid"]== "3"){
$resultad = mysql_query('SELECT * FROM novedades_diarias WHERE id= "'.$_GET["id"].'" and sucursal= "'.$_GET["sucursal"].'" ');
if (!$resultad) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($resultad)!=0))
{
$row3 = mysql_fetch_row($resultad);
$cedula3 = $row3[0];
$nombre3 = $row3[40];
$contenido3 = $row3[41];
$tipo3= $row3[42];
header("Content-type: $tipo3");
header("Content-Disposition: attachment; filename=$nombre3");
print $contenido3;
}
}
?>