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/public_html/modificar_relacion_pagos.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();


if(isset($_POST["guardar"]))
		{
		if($unidt!=0)
		{
		//$sqlnom3 = "select codigo, unidad from descuentos where id = '$unidt'";
		//$control3 = mysql_query($sqlnom3, $dbi) or die(mysql_error());
		
		$control3 = mysql_query('SELECT codigo, unidad FROM descuentos WHERE id = "' . $_POST[unidt] . '"  ');
			if (!$control3) {
				die('Invalid query: ' . mysql_error());
			} 	 
		list($codcd, $unidts) = mysql_fetch_row($control3);
		}else{
		$codcd=$ds;
		$unidt=$ud;
		}
		
		//modifica datos 
	  //	$mssql = "update relacion_pagos set valor= '$val', cuota='$cuo', mes_inicio='$mi', ano_inicio='$ai', cod_descuento='$codcd', unidad_descuento='$unidt', fecha_registro='$fr' where id = '$id'";
      //	mysql_query($mssql, $dbi) or die(mysql_error());
		
		$mssql = mysql_query("UPDATE  relacion_pagos  set valor = '" . $_POST[val] . "', cuota = '" . $_POST[cuo] . "', mes_inicio = '" . $_POST[mi] . "', ano_inicio = '" . $_POST[ai] . "', cod_descuento  = '" ."$codcd". "', unidad_descuento = '" ."$unidt". "', fecha_registro = '" . $_POST[fr] . "' WHERE id = '" . $HTTP_GET_VARS["id"]  . "' ");
		
		if (!$mssql) {
				die('Invalid query primer UPDATE: ' . mysql_error());
			}
		echo "<script>alert('Los datos fueron modificados correctamente');</script>";
	  	}
	  
	  //	$sqlnom4 = "select id, codigo,valor, cuota, mes_inicio, ano_inicio, cod_descuento,  unidad_descuento, fecha_registro from relacion_pagos where id = '$id'";
		//$control4 = mysql_query($sqlnom4, $dbi) or die(mysql_error());
		
							$control4 = mysql_query('SELECT * FROM relacion_pagos WHERE id = "' . $HTTP_GET_VARS["id"]  . '"  ');
			if (!$control4) {
				die('Invalid query: ' . mysql_error());
			} 	 
		list($idr, $codigo, $valor, $cuota, $mes_inicio, $ano_inicio, $cod_descuento, $unidad_descuento, $fecha_registro) = mysql_fetch_row($control4);
		
//$query_sql2 = "SELECT * FROM descuentos order by codigo";
//$sql2 = mysql_query($query_sql2, $dbi) or die(mysql_error());

$sql2 = mysql_query('SELECT * FROM descuentos order by codigo ');
			if (!$sql2) {
				die('Invalid query: ' . mysql_error());
			} 
$row_sql2 = mysql_fetch_assoc($sql2);
$totalRows_sql2 = mysql_num_rows($sql2); 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin t&iacute;tulo</title>
<style type="text/css">
<!--
.est_cont1 {	font-family: "Times New Roman", Times, serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #4068F4;
	background-color: #E6FFF1;
	margin: 1px;
	padding: 1px;
	height: auto;
	width: auto;
	border: thin double #33CC66;
}
.est_cont2 {
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #000000;
	background-color: #F0F5CF;
	height: 18px;
	width: auto;
	border: thin solid #FABF85;
}
.Estilo1 {	color: #FF6600;
	font-weight: bold;
}
.Estilo3 {color: #2492FF;
	font-weight: bold;
}
.Estilo50 {color: #CC3333;
	font-family: "Arial Narrow";
	font-weight: bold;
}
.est_cont21 {font-family: Geneva, Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-style: normal;
	font-weight: normal;
	color: #2B39EC;
	background-color: #F0F5CF;
	height: 18px;
	width: auto;
	border: thin solid #FABF85;
}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="">
  <div align="center">
    <p><span class="Estilo1">RELACION DE PAGOS</span></p>
    <table width="350" border="1" class="est_cont1">
      <tr>
        <th width="62" height="19" scope="col"><div align="right"><strong>Valor :</strong></div></th>
        <th width="73" scope="col"><div align="left">
            <input name="val" type="text" class="est_cont2" id="val" value="<?php echo $valor ?>" size="13" maxlength="13"/>
        </div></th>
        <th width="99" scope="col"><div align="right"><strong>Cuota :</strong></div></th>
        <th width="86" scope="col"><div align="left">
            <input name="cuo" type="text" class="est_cont2" id="cuo" value="<?php echo $cuota ?>" size="13" maxlength="13"/>
        </div></th>
      </tr>
      <tr>
        <td><div align="right"><strong>Mes Inicio :</strong></div></td>
        <td><div align="left">
            <input name="mi" type="text" class="est_cont2" id="mi" value="<?php echo $mes_inicio ?>" size="13" maxlength="13"/>
        </div></td>
        <td><div align="right"><strong>Año Inicio :</strong></div></td>
        <td><div align="left">
            <input name="ai" type="text" class="est_cont2" id="ai" value="<?php echo $ano_inicio ?>" size="13" maxlength="13"/>
        </div></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td><div align="right"><strong>Fecha Registro :</strong></div></td>
        <td><div align="left">
            <input name="fr" type="text" class="est_cont2" id="fr" value="<?php echo $fecha_registro ?>" size="13" maxlength="13"  />
        </div></td>
      </tr>
      <tr>
        <td><div align="right"><strong>Descuento :</strong></div></td>
        <td><div align="left">
          <input name="ds" type="text" class="est_cont2" id="ds" value="<?php echo $cod_descuento?>" size="13" maxlength="13" readonly="" />
        </div></td>
        <td><div align="right"><strong>Unidad :</strong></div></td>
        <td><input name="ud" type="text" class="est_cont2" id="ud" value="<?php echo $unidad_descuento?>" size="13" maxlength="13" readonly="" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
        <td colspan="3"><select name="unidt" class="est_cont21" id="unidt">
          <option value="0">--SELECIONE UNIDAD Y CODIGO--</option>
          <?php
     do {  
?>
          <option value="<?php echo $row_sql2['id'];?>"><?php echo $row_sql2['unidad'].'-'.$row_sql2['codigo']?></option>
          <?php
} while ($row_sql2 = mysql_fetch_assoc($sql2));
  $rows2 = mysql_num_rows($sql2);
  if($rows2 > 0) {
      mysql_data_seek($sql2, 0);
       $row_sql2 = mysql_fetch_assoc($sql2);
  }
?>
        </select></td>
      </tr>
      </table>
    <p>
      <input name="guardar" type="submit" class="Estilo3" id="guardar" value="Guardar" />
    </p>
    <p>
      <input name="menu2" type="button" class="Estilo50" id="menu2" onclick="window.location.href='modificar_estado_contable_creditos.php'" value="IR AL MENU" />
</p>
  </div>
</form>
</body>
</html>