File: /home/asjudine/public_html/guardar_respuestareque_admin.php
<?php
require_once("mainfile.php");
include ("config.php");
global $dbi;
/*
function Conectarse()
{
if (!($link=@mysql_connect("localhost","asjudine","as2006")))
{
echo "Error conectando con el servidor.";
exit();
}
$dbname = "asjudinet";
if (!@mysql_select_db($dbname,$link))
{
echo "Error seleccionando la base de datos.";
exit();
}
return $link;
}
Conectarse();
*/
require_once("Conectarse.php");
echo "<form name='form' action='' method='post'>";
require_once("mainfile.php");
include ("config.php");
global $dbi;
$res = mysql_query('SELECT * FROM archivosrequerimientos ');
if (!$res) {
die('Invalid query: ' . mysql_error());
}
$dia = date("d");
$mes = date("m");
$ano = date("Y");
$fecha = $ano."-".$mes."-".$dia;
$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);
$mssql3 = mysql_query("UPDATE archivosrequerimientos set nombre2 = '".$nombre."',contenido2 = '".$contenido."',tipo2= '".$tipo."' WHERE registro = '". $_POST["radica"] ."' " );
if (!$mssql3) {
die('Invalid query cartera_serviasjudinet MODIFICAR: ' . mysql_error());
}
echo "<script>history.back()</script>";
if($res)
{
$resd = mysql_query('SELECT * FROM archivosrequerimientos 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;
}
}
else
{
print "Ingrese el archivo por favor";
}
?>