MOON
Server: Apache/2.2.34 (Unix) mod_ssl/2.2.34 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 FrontPage/5.0.2.2635
System: Linux server.asjudinet.com 2.6.32-042stab141.3 #1 SMP Fri Nov 15 22:45:34 MSK 2019 i686
User: asjudine (504)
PHP: 5.2.17
Disabled: NONE
Upload Files
File: /home/asjudine/www/apostventas/descargar_archivos_novedades.php
<?php
require_once("../Conectarse.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; 

  	}
}
?>