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/callcenter/guardar_archivos_requerimiento_callcenter.php
<?php

global $dbi;

//Agrego esto
$identificacion = $_POST["identificacion"];
$radicado = $_POST["numradica"];


require_once("../Conectarse.php");

//$query_Recordset1 = "SELECT * FROM archivos";
//$Recordset1 = mysql_query($query_Recordset1, $dbi) or die(mysql_error());

$res = mysql_query('SELECT * FROM archivosrequerimientos_callcenter  ');
if (!$res) {
    die('Invalid query: ' . mysql_error());
}

$dia = date("d");
$mes = date("m"); 
$ano = date("Y");
$fecha = $ano."-".$mes."-".$dia;

ini_set('date.timezone','America/Bogota'); 
$hora = date("g:i A");

 
$archivo = $_FILES["archivito"]["tmp_name"]; 
$tamanio = $_FILES["archivito"]["size"];
$tipo    = $_FILES["archivito"]["type"];
$nombre  = $_FILES["archivito"]["name"];
 
if ( $archivo != "none" )
{
    $fp = fopen($archivo, "rb");
    $contenido = fread($fp, $tamanio);
    $contenido = addslashes($contenido);
    fclose($fp); 
	
	
	///////////////////////
	
	$consult = mysql_query('SELECT max(id) FROM requerimientos_callcenter ');

    if (!$consult) {
	   die('Invalid query: ' . mysql_error());
    }  
    
	list($edp) = mysql_fetch_row($consult);
	
	$edp=$edp+1;
	///////////////////////
	

    //--------------------  Aca es para traer el consecutivo que sigue
	$datosconsecutivo = mysql_query('SELECT Id FROM archivosrequerimientos_callcenter  ORDER BY Id DESC LIMIT 1');
	if (!$datosconsecutivo) {
		die('Invalid query: ' . mysql_error());
	}  
	if($datosconsecutivo){list($elId) = mysql_fetch_row($datosconsecutivo);    }
	$conscorreointerno = $elId+1;

    // $res = mysql_query("INSERT INTO archivos (id, nombre, fecha, hora, contenido, tipo, Identificacion, registro, registro_interno) VALUES ('', '" . $_POST["nombre"] . "', '" . $_POST["fecha"] . "', '" . $_POST["hora_envio"] . "', '" . $_POST["contenido"] . "', '" . $_POST["tipo"] . "', '" . $_POST["identificacion"] . "', '" . $_POST["contador"] . "', '')");
 
    $res = mysql_query("INSERT INTO archivosrequerimientos_callcenter   (id, correointerno, nombre, fecha, hora, contenido, tipo, Identificacion, registro, registro_interno) VALUES ('', '$conscorreointerno', '$nombre', '$fecha', '" . $hora . "', '$contenido', '$tipo', '" . $_POST["identificacion"] . "', '".$edp."', '$conscorreointerno')");

    //echo "<script>history.back()</script>";
    

	
	if($res)
	{
    // $query_Recordset1 = "SELECT * FROM archivos where Identificacion = $identificacion";
     //$Recordset1 = mysql_query($query_Recordset1, $dbi) or die(mysql_error());
	   
        $resd = mysql_query('SELECT * FROM archivosrequerimientos_callcenter  WHERE identificacion = "' . $_POST[identificacion] . '" ');
        if (!$resd) {
            die('Invalid query: ' . mysql_error());
        }

       printf("<style type='text/css'><!--.Estilo5 {font-family: Arial, Helvetica, sans-serif; font-size: 14px; color: #000066; }--></style>");

       printf("<table width='700' border='1' align='center' cellpadding='1' cellspacing='1'>
       <tr bgcolor='#FFFFCC'>
       <th colspan='4' scope='col'><span class='Estilo5'>LISTADO DE ARCHIVOS ENVIADOS </span></th>
       </tr>
       <tr bgcolor='#FFFFCC'><th scope='col'><span class='Estilo5'>ID</span></th>
       <th scope='col'><span class='Estilo5'>NOMBRE</span></th>
       <th scope='col'><span class='Estilo5'>FECHA ENVIO</span></th>				   
       <th scope='col'><span class='Estilo5'>TIPO DE ARCHIVO</span></th>				   				   
       </tr>");

       while($Filas = mysql_fetch_row($resd))
       {
           printf("<tr><td><div align='center'><a href='descargar_archivos.phpId=$Filas[id]' class='Estilo5 Estilo6'>Descargar</a></div></td>
           <td><div align='center'><span class='Estilo7'>".$Filas["nombre"]."</span></div></td>
           <td><div align='center'><span class='Estilo7'>".$Filas["fecha"]."</span></div></td>
           <td><div align='center'><span class='Estilo7'>".$Filas["tipo"]."</span></div></td></tr>");
       }
	                   
        echo "</table>"; 
        mysql_free_result($resd);  
	
    }
    else
	{
       echo "NO se ha podido guardar el archivo en la base de datos.";
	}   

    if (!(mysql_errno()==0))
    {
        echo "<tr><td colspan=2 align=center><big>HAY UN PROBLEMA CON LA SINTAXIS DEL QUERY</big></td></tr>";
        echo "<tr><td colspan=2 align=center><a href=guardar_archivos.php>ATRAS</a></td></tr></table>";
        exit;
    }
    
    
    echo "<script>alert('Requerimiento Enviado ');</script>";
    echo "<script languaje='javascript'>window.close();</script>";
}
else
{
    print "Ingrese el archivo por favor";
}
?>