File: /home/asjudine/public_html/red_cargar_recarga.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"]))
{
$fecha_act=date ( "Y-n-j" );
$control5 = mysql_query('SELECT codigo, unidad FROM descuentos WHERE id = "' . $_POST[unidt] . '" ');
if (!$control5) {
die('Invalid query: ' . mysql_error());
}
list($codcd, $unidt) = mysql_fetch_row($control5);
$guardar = mysql_query("INSERT INTO red_estado_contable (cedula, nombre, numero_sim, valor, fecha, minutos, unidad, codigo) VALUES ('" . $_POST["ced"] . "', '" . $_POST["ape"] . "', '" . $_POST["sim"] . "', '" . $_POST["valcuo"] . "', '" ."$fecha_act". "', '" . $_POST["minu"] . "', '" ."$unidt". "', '" ."$codcd". "')");
if (!$guardar) {
die('Invalid query 1 guardar: ' . mysql_error());
}
echo "<script>alert('Recarga Realizada Satisfatoriamente');</script>";
}
$control = mysql_query('SELECT cedula, codigo, nombre, grado, banco, cuenta, numero_sim , minutos, fecha_pago , fecha_activacion, fecha_vencimiento FROM red_comunicaciones WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '" and numero_sim = "' . $HTTP_GET_VARS["sim"] . '"');
if (!$control) {
die('Invalid query 1: ' . mysql_error());
}
$num=mysql_num_rows($control);
list($cedula, $codi, $apes, $grad, $ban , $cue, $sim, $minutos, $fechapa, $fechaact, $fechaven) = mysql_fetch_row($control);
$sql2 = mysql_query('SELECT * FROM descuentos WHERE estado = "1" order by unidad');
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>Cargar Recargas</title>
<style type="text/css">
<!--
.recaudo {font-family: "Courier New", Courier, monospace;
font-size: 12px;
font-style: normal;
font-weight: bold;
font-variant: normal;
color: #000000;
background-color: #B6CBDC;
margin: 4px;
padding: 8px;
width: auto;
border: medium outset #339966;
}
.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: 15px;
width: auto;
border: thin solid #FABF85;
}
.est_cont3 {
font-family: "Courier New", Courier, monospace;
font-size: 12px;
font-style: normal;
font-weight: normal;
color: #EA261C;
background-color: #DEDDE8;
height: auto;
width: auto;
border: thin outset #FC9F67;
}
.est_cont5 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-style: normal;
font-weight: normal;
background-color: #D6ECFE;
margin: 2px;
padding: 2px;
height: auto;
width: auto;
border: thin groove #E9AAF0;
color: #C72350;
}
.Estilo50 {color: #CC3333;
font-family: "Arial Narrow";
font-weight: bold;
}
.Estilo55 {font-weight: bold; font-family: "Arial Narrow";}
.Estilo56 {color: #003366; }
.Estilo57 {color: #000099}
.Estilo58 {color: #000000}
.Estilo59 {color: #FF0000}
.Estilo60 {color: #000099; font-weight: bold; }
.Estilo62 {color: #003366; font-weight: bold; }
-->
</style>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<div align="center">
<div align="center" class="Estilo50">RED DE COMUNICACIONES RECARGAS MANUALES </div>
<br />
<p>
<br />
</p>
<div align="left"></div>
<div align="left"></div>
<div align="right"></div>
<table width="688" border="2" cellpadding="1" cellspacing="1" class="est_cont5">
<tr>
<th width="97" height="23" bgcolor="#CCFFCC"><span class="Estilo57">Cedula :</span></th>
<th width="93" bgcolor="#CCFFCC"><div align="left" class="Estilo56">
<input name="ced" type="text" class="Estilo55" id="ced" value="<?php echo $cedula ?>" size="18" maxlength="18" readonly="" />
</div></th>
<th width="135" bgcolor="#CCFFCC"><span class="Estilo57"> Nombres :</span></th>
<th colspan="3" bgcolor="#CCFFCC"><div align="left">
<input name="ape" type="text" class="Estilo55" id="ape" value="<?php echo $apes ?>" size="60" maxlength="60" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#CCFFCC"><span class="Estilo57">Banco :</span></th>
<th bgcolor="#CCFFCC"><div align="left" class="Estilo56">
<input name="ban" type="text" class="Estilo55" id="ban" value="<?php echo $ban ?>" size="18" maxlength="18" readonly="" />
</div></th>
<th bgcolor="#CCFFCC"><span class="Estilo57">No Cuenta :</span></th>
<th width="68" bgcolor="#CCFFCC"><div align="left" class="Estilo57">
<input name="nocuen" type="text" class="Estilo55" id="nocuen" value="<?php echo $cue ?>" size="13" maxlength="13" readonly="" />
</div></th>
<th width="160" bgcolor="#CCFFCC"><span class="Estilo57">Fecha Pago :</span></th>
<th width="100" bgcolor="#CCFFCC" class="Estilo55"><div align="left" class="Estilo58">
<input name="fechapa" type="text" class="Estilo55" id="fechapa" value="<?php echo $fechapa ?>" size="10" maxlength="10" readonly="" />
</div></th>
</tr>
<tr>
<th bgcolor="#CCFFCC"><span class="Estilo57">Numero Sim:</span></th>
<th bgcolor="#CCFFCC"><div align="left" class="Estilo56">
<input name="sim" type="text" class="Estilo55" id="sim" value="<?php echo $sim ?>" size="18" maxlength="18" readonly="" />
</div></th>
<th bgcolor="#CCFFCC"><span class="Estilo57">Minutos :</span></th>
<th bgcolor="#CCFFCC"><div align="left" class="Estilo57">
<input name="minutos" type="text" class="Estilo55" id="minutos" value="<?php echo $minutos ?>" size="5" maxlength="5" readonly="" />
</div></th>
<th bgcolor="#CCFFCC"><span class="Estilo57">Fecha Vencimiento :</span></th>
<th bgcolor="#CCFFCC" class="Estilo55"><div align="left" class="Estilo58">
<input name="fechaven" type="text" class="Estilo55" id="fechaven" value="<?php echo $fechaven ?>" size="10" maxlength="10" readonly="" />
</div></th>
</tr>
</table>
<p><span class="Estilo62">INGRESAR RECARGA</span></p>
<table width="424" border="1" class="est_cont1">
<tr>
<th width="84" height="19" bgcolor="#CCFFFF" scope="col"><div align="right" class="Estilo57 Estilo52"><strong>Valor :</strong></div></th>
<th width="79" bgcolor="#CCFFFF" scope="col"><div align="left">
<input name="valcuo" type="text" class="Estilo55" id="valcuo" value="" size="13" maxlength="13"/>
</div></th>
<th width="119" bgcolor="#CCFFFF" scope="col"><div align="right" class="Estilo57 Estilo52"><strong>Minutos :</strong></div></th>
<th width="112" bgcolor="#CCFFFF" scope="col"><div align="left">
<input name="minu" type="text" class="Estilo55" id="minu" value="" size="13" maxlength="13"/>
</div></th>
</tr>
<tr>
<td colspan="4" align="center" bgcolor="#CCFFFF"><select name="unidt" class="Estilo55" 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="Estilo60" id="guardar" value="Guardar" />
</p>
</div>
</form>
</body>
</html>
<?php
$control = mysql_query('SELECT * FROM red_estado_contable WHERE cedula = "' . $HTTP_GET_VARS["ced2"] . '" and numero_sim = "' . $HTTP_GET_VARS["sim"] . '" ORDER BY fecha ASC ');
if (!$control) {
die('Invalid query: ' . mysql_error());
}
if ((mysql_num_rows($control)!=0))
{
echo'<table width="700" border="0" cellspacing="2" cellpadding="2" align = "center">
<tr align="center">
<td colspan="6"><font face="Georgia, Times New Roman, Times, serif" color="#000066"><b>RECARGAS
EFECTUADOS</b></font></td>
</tr>
<tr align="center" bgcolor="#DDDDDD">
<td width="70" align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#993300">Valor</font></td>
<td bgcolor="#DDDDDD" width="70" ><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#993300">Fecha</font></td>
<td width="70" align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#993300" align="center">Minutos</font></td>
<td width="300" align="center"><font face="Geneva, Arial, Helvetica, san-serif" size="2" color="#993300" align="center">Entidad</font></td>
</tr>';
while(list($id, $cedula, $nombre, $sim, $valor, $fecha, $minutos, $unidesc, $codesc) = mysql_fetch_row($control))
{
$control5 = mysql_query('SELECT * FROM descuentos WHERE codigo = "' ."$codesc". '" and unidad = "' ."$unidesc". '" ');
if (!$control5) {
die('Invalid query: ' . mysql_error());
}
list($idr, $codigo, $unidad, $concepto) = mysql_fetch_row($control5);
printf ("<tr align='center' bgcolor='#f4f4f4'>
<td width='100'><font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\">$valor</a></td>
<td width='100'> <font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$fecha</a></td>
<td width='100'><font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$minutos</a></td>
<td width='300'><font face='Geneva, Arial, Helvetica, san-serif' size='2' color=#993300'><a window.location.href=\"cartera_modificar_estado.php?id=$id\" top=50,left=100,toolbar=no,scrollbars=no,width=790,height=521,status=yes>$concepto</a></td>
</tr>");
}
echo "</table>";
}
echo "</form>";
?>