Código PHP:
<?
include("../inc/inc_config.php");
if($ok){
switch($accion){
case "ingresar":
mysql_query("INSERT INTO notas (titulo, copete, texto, fecha, autor) VALUES ('$titulo', '$copete', '$texto', '$fecha', '$autor');");
header("Location: notas.php?mensaje=La%20nota%20ha%20sido%20ingresada%20con%20exito.");
break;
case "editar":
mysql_query("UPDATE notas SET titulo='$titulo', copete='$copete', texto='$texto', fecha='$fecha', autor='$autor' WHERE id = $id;");
header("Location: notas.php?mensaje=La%20nota%20ha%20sido%20editada%20con%20exito.");
break;
case "eliminar":
mysql_query("DELETE FROM notas WHERE id = $id");
header("Location: notas.php?mensaje=La%20nota%20ha%20sido%20eliminada%20con%20exito.");
break;
}
}
if($accion=="editar"){
$query=mysql_query("SELECT * FROM notas WHERE id = $id");
$reg=mysql_fetch_array($query);
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
</head>
<body>
<table width="103%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="7" align="center" valign="middle" bgcolor="#8A8A8A"> </td>
<td width="770" align="center" valign="top">
<img src="images/n.gif" width="10" height="10">
<table width="1000" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center"><img src="arriba.gif" width="750" height="70"></div></td>
</tr>
</table>
<img src="images/n.gif" width="10" height="10"><br>
<table width="1000" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td width="212" rowspan="2" align="center" valign="top"><img src="images/n.gif" width="10" height="10"><br>
<? include("inc_menu.php"); ?>
<img src="images/n.gif" width="10" height="10"><br></td>
<td rowspan="2" align="center" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#979797"><img src="images/n.gif" width="10" height="10"></td>
</tr>
<tr>
<td height="18" valign="top" bgcolor="#FEFEFE"><img src="images/pt5.jpg" width="11" height="11" align="absmiddle"></td>
</tr>
<tr>
<td align="center" bgcolor="#FFFFFF"><span class="style1">ADMINISTRACIÓN DE CONTENIDOS</span><br>
<span class="style3">a c c e s o r e s t r i n g i d o </span><br>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="../img/linea_punteada.jpg">
<tr>
<td><img src="images/n.gif" width="10" height="10"></td>
</tr>
</table>
<br>
<span class="style5"><strong>Administrador › Noticias ›</strong></span><strong> <? echo($accion); ?> </strong><br>
<br>
<?
if($mensaje){
?><br>
<table width="97%" border="0" cellspacing="0" cellpadding="10">
<tr>
<td align="center" bgcolor="#0A5045"><span class="style10"><? echo($mensaje); ?></span></td>
</tr>
</table>
�<br>
<?
}
?>
<table width="97%" border="0" cellspacing="1" cellpadding="6">
<form method="post" name="form1" enctype="multipart/form-data" action="?">
<tr>
<td colspan="2" align="center" bgcolor="#0A5045"><span class="style9">Nota</span></td>
</tr>
<tr>
<td width="31%" align="right" bgcolor="#BAEF03">Titulo</td>
<td width="69%" bgcolor="#EEEEEE"><input name="titulo" type="text" class="campo_admin" id="titulo" value="<? echo($reg[titulo]); ?>"></td>
</tr>
<tr>
<td align="right" bgcolor="#BAEF03">Texto<br>
</td>
<td bgcolor="#EEEEEE"><textarea name="copete" rows="11" class="campo_admin" id="copete"><? echo($reg[copete]); ?></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'copete' );
</script>
</td>
</tr>
<tr>
<td align="right" bgcolor="#BAEF03">Fecha</td>
<td bgcolor="#EEEEEE">
<?
if(!$reg[fecha]){
$reg[fecha]=date("d-m-Y");
}
?>
<input name="fecha" type="text" class="campo_admin" id="fecha" value="<? echo($reg[fecha]); ?>"></td>
</tr>
<tr>
<td colspan="2" align="center" bgcolor="#EEEEEE"><input name="accion" type="hidden" id="accion" value="<? echo($accion); ?>">
<input name="id" type="hidden" id="id" value="<? echo($id); ?>">
<input name="ok" type="hidden" id="ok" value="1"> <input name="Submit" type="submit" class="botonete" value=" Continuar › "></td>
</tr>
</form>
</table>
<a href="javascript:history.go(-1);" class="link_verde style5"><strong><br>
</strong></a>
<table width="97%" border="0" cellspacing="1" cellpadding="6">
<tr>
<td align="center" bgcolor="#0A5045"><span class="style9">Fotografías</span></td>
</tr>
<tr>
<td align="center" bgcolor="#F9F9F9"><?
if($accion=="editar"){
$query=mysql_query("SELECT * FROM fotos WHERE seccion = 'notas' AND nota_id = $id ORDER BY id;");
$cantidad_fotos=mysql_num_rows($query);
while($foto=mysql_fetch_array($query)){
?>
<div style="width:130px; height:190px; float:left; border: 0px solid #FF0000">
<table width="130" height="170" border="0" bordercolor="#EEEEEE">
<tr>
<td width="180" align="center" valign="bottom"><a href="http://www.forosdelweb.com/f18/popup/?foto=../fotos/<? echo($foto[archivo]); ?>" onClick="flvFPW1(this.href,'popup','width=420,height=420',1,2,2);return document.MM_returnValue"><img src="http://www.forosdelweb.com/f18/fotos/<? echo($foto[archivo_t1]); ?>" alt="PREVISUALIZAR" width="122" height="122" hspace="2" border="0"></a></td>
</tr>
<tr>
<td height="36" align="center" valign="top" class="lntop"><i><? echo($foto[referencia]); ?></i><br>
<br>
<a href="fotos_e.php?accion=eliminar&id=<? echo($foto[id]) ?>&seccion=notas¬a_id=<? echo($id); ?>" class="botonete"> Eliminar </a></td>
</tr>
</table>
</div>
<?
}
}
?>
</td>
</tr>
<tr>
<td align="center" bgcolor="#F9F9F9"><?
switch($accion){
case "editar":
?>
<a href="fotos_e.php?seccion=notas¬a_id=<? echo($reg[id]); ?>" class="botonete">Ingresar nueva fotografía ></a>
<?
break;
case "ingresar":
?>
Antes de ingresar fotografías, debe crear la noticia, y luego editarla.<?
break;
}
?> </td>
</tr>
</table>
<a href="notas.php" class="link_verde style5"><strong><br>
‹ Volver</strong></a> <span class="style6"> |</span><br>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="4"> </td>
</tr>
</table></td>
<td width="27" align="center" valign="middle" bgcolor="#8A8A8A"> </td>
</tr>
</table>
</body>
</html>