File: /home/asjudine/public_html/php/actualizar_libranza.php
<?PHP //extract($_POST,EXTR_SKIP); ?>
<?php
require_once("../mainfile.php");
include ("../config.php");
global $dbi;
require_once("../Conectarse.php");
$control= mysql_query("SELECT cedula, con_nombres, libranza_credito, con_pagaduria, nombre_libranza_credito, contenido11, tipo11, url_libranza_credito, estado FROM legalizaciones WHERE cedula = '".$_GET[cedula]."' AND id = '".$_GET[id]."' ");
if (!$control)
{
die('Invalid query 0: ' . mysql_error());
}
list($cedula, $con_nombres, $libranza_credito, $con_pagaduria, $nombre_libranza_credito, $contenido11, $tipo11, $url_libranza_credito, $estado) = mysql_fetch_row($control);
if ($_POST[guardar])
{
$MOVIDO = 0;
$archivo = $_FILES["archivito"]["tmp_name"];
$tamanio = $_FILES["archivito"]["size"];
$tipo = $_FILES["archivito"]["type"];
$nombre = $_FILES["archivito"]["name"];
$ruta11 = "../legalizaciones/".$cedula."";
$ruta11 = $ruta11 ."/".$nombre;
if ( $archivo != "none" )
{
$fp = fopen($archivo, "rb");
$contenido = fread($fp, $tamanio);
$contenido = addslashes($contenido);
fclose($fp);
$mssql3 = mysql_query("UPDATE legalizaciones set nombre_libranza_credito = '".$nombre."',contenido11 = '".$contenido."',tipo11= '".$tipo."' , url_libranza_credito= '".$ruta11."' WHERE cedula = '".$_GET["cedula"]."' AND id = '".$_GET[id]."' " );
if (!$mssql3) {
die('Invalid query cartera_serviasjudinet MODIFICAR: ' . mysql_error());
}
if(!file_exists("legalizaciones/".$_GET["cedula"]))
{
mkdir("legalizaciones/".$_GET["cedula"],0777,true);
if(file_exists("legalizaciones/".$_GET["cedula"]))
{
if(move_uploaded_file($archivo, $ruta11))
{
$MOVIDO = 1;
}else{
$MOVIDO = 2;
}
}
}
else
{
if(move_uploaded_file($archivo, $ruta11))
{
$MOVIDO = 4;
}else{
$MOVIDO = 3;
}
}
echo "<script>alert('MOVIDO== ".$MOVIDO ."');</script>";
if($MOVIDO ==1)
{
echo "<script>alert('Registro guardado correctamente');</script>";
echo "<script languaje='javascript' type='text/javascript'>window.close();</script>";
}
else if($MOVIDO ==0)
{
echo "<script>alert('Ocurrio un error, no se pudo actualizar');</script>";
}
else if($MOVIDO ==2)
{
echo "<script>alert('NO MUEVE');</script>";
}
}
}
?>
<html>
<head>
<title>Ingresar Informacion</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script languaje="JavaScript">
function Mostrar_Fecha()
{
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
{
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym<10)
{
daym="0"+daym;
var dayarray=new Array("Domingo","Lunes","Martes","Miercoles","Jueves","Viernes","Sabado");
var montharray=new Array("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
document.write("<b><font face='Arial, Helvetica, sans-serif'>"+dayarray[day]+" "+daym+" de "+montharray[month]+" de "+year+"</font></b>");
}
}
}
</script>
<style type="text/css">
.Estilo1 {
font-family: Arial, Helvetica, sans-serif;
color: #00C;
}
.Estilo2 {
color: #FF0000;
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
}
body {
background-image: url(../ELEMENTOS/beig.jpg );
}
.Estilo3 {color: #006633}
.Estilo4 {color: #FFFFFF}
.Estilo5 {
font-size: 12px;
font-style: italic;
color: #09F;
font-weight: bold;
}
.Estilo7 {
color: #FF0000;
font-weight: bold;
}
.Estilo8 {color: #FFFFFF; font-weight: bold; }
</style>
</head>
<body topmargin="0">
<form name="formulario" method="post" action="" enctype="multipart/form-data" >
<br>
<center>
<img src="../ELEMENTOS\CABEZOTE SERVIASJUDINET.jpg" WIDTH=57% height="91" >
</center>
<br><br>
<center>
<h1><span style="width:100%"><font color="#2E7068">ACTUALIZAR LIBRANZA</font></span></h1>
</center>
<table width="691" border="8" align="center" cellpadding="2" cellspacing="2">
<tr bgcolor="#006633">
<td colspan="4" bgcolor="#2E7068">
<div align="center" class="Estilo3">
<span class="Estilo4 Estilo2">
<span class="Estilo8">INGRESAR LIBRANZA</span>
</span>
</div>
</td>
</tr>
<tr bgcolor="#006633">
<td height="30" colspan="4" bgcolor="#FFFFFF">
<div align="center">
<script languaje="JavaScript">Mostrar_Fecha()</script>
</div>
</td>
</tr>
<tr bgcolor="#ECE9D8">
<td bgcolor="#EFEFEF" align="right"><b>Nombre:</b></td>
<td bgcolor="#EFEFEF">
<input name="nombre" type="text" class="Estilo21" value="<?php echo $con_nombres ?>" size="50" maxlength="30" readonly="">
</td>
</tr>
<tr bgcolor="#ECE9D8">
<td bgcolor="#EFEFEF" align="right"><b>Cedula:</b></td>
<td bgcolor="#EFEFEF">
<input name="cedula" type="text" class="Estilo21" value="<?php echo $cedula ?>" size="50" maxlength="30" readonly="">
</td>
</tr>
<tr bgcolor="#ECE9D8">
<td bgcolor="#EFEFEF" align="right"><b>Numero Libranza:</b></td>
<td bgcolor="#EFEFEF">
<input name="N_libranza" type="text" class="Estilo21" value="<?php echo $libranza_credito ?>" size="50" maxlength="30" readonly="">
</td>
</tr>
<tr bgcolor="#ECE9D8">
<td bgcolor="#EFEFEF" align="right"><b>Entidad:</b></td>
<td bgcolor="#EFEFEF">
<input name="Entidad" type="text" class="Estilo21" value="<?php echo $con_pagaduria ?>" size="50" maxlength="30" readonly="">
</td>
</tr>
<tr>
<td align="right" bgcolor="#EFEFEF"><b>Adjuntar Archivo Libranza:</b></td>
<td colspan="3" bgcolor="#EFEFEF">
<input name="archivito" type="file" class="Estilo1" size="40" maxlength="40">
</td>
</tr>
<tr bgcolor="#FFFFCC">
<td height="30" colspan="4" bgcolor="#EFEFEF">
<div align="center">
<input name="guardar" type="submit" class="Estilo1" id="guardar" value="ENVIAR">
</div>
</td>
</tr>
</table>
</form>
</body>
</html>