Código PHP:
<? require_once('Connections/fermdp14.php');
$datosporhoja = 33;
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $HTTP_SERVER_VARS['PHP_SELF'];
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$editFormAction .= "?" . $HTTP_SERVER_VARS['QUERY_STRING'];
}
if ((isset($HTTP_POST_VARS["MM_update"])) && ($HTTP_POST_VARS["MM_update"] == "form1")) {
$maxRows_Recordset1 = $datosporhoja;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_fermdp14, $fermdp14);
$Resultini = mysql_query("SELECT * FROM nota WHERE id > 100 ORDER BY id DESC LIMIT $startRow_Recordset1, $maxRows_Recordset1", $fermdp14) or die(mysql_error());
while($row=mysql_fetch_row($Resultini))
{
$valor="r".$row[0];
$clv=$$valor;
$result1 = mysql_query("UPDATE nota set Disponible='$clv' WHERE id='$row[0]'", $fermdp14) or die(mysql_error());
}
$updateGoTo = "admin.php";
if (isset($HTTP_SERVER_VARS['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $HTTP_SERVER_VARS['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$maxRows_Recordset1 = $datosporhoja;
$pageNum_Recordset1 = 0;
if (isset($HTTP_GET_VARS['pageNum_Recordset1'])) {
$pageNum_Recordset1 = $HTTP_GET_VARS['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
mysql_select_db($database_fermdp14, $fermdp14);
$query_Recordset1 = "SELECT * FROM nota WHERE id > 100 ORDER BY id DESC";
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $fermdp14) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($HTTP_GET_VARS['totalRows_Recordset1'])) {
$totalRows_Recordset1 = $HTTP_GET_VARS['totalRows_Recordset1'];
} else {
$all_Recordset1 = mysql_query($query_Recordset1);
$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1; ?>
<html>
<head>
<style type="text/css">
<!-- @import url("librerias/estilo.css"); .style3 { font-size: 9px; color: #000000; } -->
</style>
<title>Teleocho Informa - Administrar Archivo de Noticias</title>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<a name="up"></a>
<? include('encabezado2.php'); ?>
<form name="form1" method="POST" action="<? echo $editFormAction; ?>">
<table width="714" border="0" align="center" cellpadding="0" cellspacing="0"><tr>
<td width="193"><span class="letra_comun_mediana">Administrar Notas</span></td>
<td width="17" bgcolor="#00FF00"> </td>
<td width="77" class="letra_comun"> Disponible</td>
<td width="12"> </td>
<td width="17" bgcolor="#FF0000"> </td>
<td width="80" class="letra_comun"> Archivada</td>
<td width="17" bgcolor="#BFFFBF"> </td>
<td width="1"> </td>
<td width="17" bgcolor="#FFBFBF"> </td>
<td width="203" class="letra_comun"> Recién cambiadas<br>
<span class="style3"> (Click en "OK" o"Efectuar Cambios")</span></td>
<td width="14" align="right"><input type="submit" name="Submit" value="OK"></td>
</tr></table><br>
<table width="714" border="0" align="center"><tr class="letra_comun">
<td>Página <?php echo $pageNum_Recordset1 + 1; ?> de <?php echo $totalPages_Recordset1 + 1; ?></td>
<td><div align="right">
<? if ($pageNum_Recordset1 > 0) { ?>
<? if ($pageNum_Recordset1 > 0) { ?>
<a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Primera</a> <? } // Show if not first page ?>
<a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Anterior</a> <? } ?>
<? if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?><a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Siguiente</a> <? } ?>
<? if ($pageNum_Recordset1 < $totalPages_Recordset1) { ?><a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Ultima</a> <? } ?>
</div></td></tr></table>
<table width="756" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#000000">
<td class="letra_comun_mediana"><div align="center">N°</div></td>
<td class="letra_comun_mediana"><div align="center">Nota</div></td>
<td class="letra_comun_mediana"><div align="center">Soporte/Tiempos</td>
<td class="letra_comun_mediana"><div align="center">Estado</div></td>
<td class="letra_comun_mediana"> </td>
<? do { ?>
<tr class="letra_comun">
<td><div align="center"><? echo $row_Recordset1['id']; ?></div></td>
<td width="256"> <a href="detalle_nota.php?id=<? echo $row_Recordset1['id']; ?>" target="_blank"><? echo $row_Recordset1['Nombre_nota']; ?></a></td>
<td><strong> <? echo $row_Recordset1['Soporte']?></strong> In:<strong><? echo $row_Recordset1['Comienza'] ?> </strong> Dura:<span class="letra_comun_mediana"><strong><? echo $row_Recordset1['Dura'] ?></strong></span></td>
<? if(strcmp($row_Recordset1['Disponible'],'si')==0)
{
$valor=$row_Recordset1['id'];
echo"<td id=\"popor$valor\" bgcolor='#00FF00'>
<input type='radio' onclick = \"popor$valor.style.background = '#BFFFBF'\" name='r$valor' checked value='si'>Disp.<br>
<input type='radio' onclick = \"popor$valor.style.background = '#FFBFBF'\" name='r$valor'value='no'>Archivo
</td>";
}
else
{
$valor=$row_Recordset1['id'];
echo"<td id=\"popo$valor\" bgcolor='#DD0000'>
<input type='radio' onclick = \"popo$valor.style.background = '#BFFFBF'\" name='r$valor' value='si'>Disp.<br>
<input type='radio' onclick = \"popo$valor.style.background = '#FFBFBF'\" name='r$valor' checked value='no'>Archivo
</td>";
} ?>
<td bgcolor="#FFFFFF">
<div align="center"><a href="borrar.php?id=<? echo $row_Recordset1['id']; ?>&desde=admin.php"><img src="images/cesto.gif" alt="Borrar" border="0"></a></div></td>
</tr>
<? } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
</table>
<table width="714" border="0" align="center"><tr class="letra_comun">
<td>Total de Notas en el Sistema: <?php echo $totalRows_Recordset1; ?></td>
<td><div align="right">
<? if ($pageNum_Recordset1 > 0) { ?>
<? if ($pageNum_Recordset1 > 0) { ?>
<a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0, $queryString_Recordset1); ?>">Primera</a> <? } // Show if not first page ?>
<a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0, $pageNum_Recordset1 - 1), $queryString_Recordset1); ?>">Anterior</a> <? } ?>
<? if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?><a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>">Siguiente</a> <? } ?>
<? if ($pageNum_Recordset1 < $totalPages_Recordset1) { ?><a href="<? printf("%s?pageNum_Recordset1=%d%s", $currentPage, $totalPages_Recordset1, $queryString_Recordset1); ?>">Ultima</a> <? } ?>
</div></td></tr></table>
<input type="hidden" name="MM_update" value="form1">
<div align="center"><br /><input type="submit" name="Submit" value="Efectuar Cambios"> <input name="Button322" type="button" class="button" onClick="window.location='#up'" value="Volver Arriba" /><br><br></div>
</form>
<? mysql_free_result($Recordset1); ?>