Hola ;) che estos son los 2 archivos para lograr que se envie la noticia:
noticias_ingresar.php
Código PHP:
<?
session_start();
if(!isset($SESSION)){
header("location:index.php");
} else {
include("config.php");
include("../header.php");
include("../meta.php");
?>
<table width="700" align="center">
<tr>
<td width="1%" valign="top">
<?php include("../menu.php"); ?>
</td>
<td width="99%" valign="top">
<?
echo '<h1 class="titulo">Panel de Administración</h1>
<form method="post" action="proc.php?que=noticias_ingresar">
<table border="0" cellpadding="2" cellspacing="1" align="center">
<tr>
<td>Titulo:</td>
<td width="85%"><input type="text" name="titulo" width="450"></td>
</tr>
<tr>
<td valign="top" width="14%">Noticia Corta:</td>
<td width="85%"><textarea name="noticiacorta" cols="9" rows="9"></textarea></td>
</tr>
<tr>
<td valign="top" width="14%">Noticia Larga:</td>
<td width="85%"><textarea name="noticialarga" cols="9" rows="9"></textarea></td>
</tr>
<tr>
<td>Imagen:</td>
<td width="85%">
<select name="imagen">';
$directorio = opendir("../imagenes_publicaciones/");
while ($imagen = readdir($directorio))
{
if ($imagen != '.' && $imagen != '..' && strpos($imagen, '.php') === false)
{
echo '<option value="' , $imagen , '">' , $imagen , '</option>';
}
}
closedir($directorio);
echo '
</select><a href="admin_imagenes_publicaciones_ver.php" target="_blank">VER IMAGENES</a>
</td></tr>
<tr>
<td> </td>
<td><input type="submit" name="enviar" value="Enviar"></td>
</tr>
</table>
</form>';
?>
</td>
</tr>
</table>
<?php
include("../derechos.php");
echo("</body></html>");
}
?>
proc.php
Código PHP:
<?
session_start();
if(!isset($SESSION)){
header("location:index.php");
} else {
include("../config.php");
include("../header.php");
include("../meta.php");
?>
<table width="700" align="center">
<tr>
<td width="1%" valign="top">
<?php include("../menu.php"); ?>
</td>
<td width="99%" valign="top">
<?
echo"<H1 class=titulo>Panel de Administración</H1>";
$dia = date ("d");
$mes = date ("m");
$ano = date ("Y");
$mostrar = $dia . "/" . $mes . "/" . $ano;
$hora = date ("g");
$minutos = date ("i");
$tipo = date ("a");
$mostrar2 = $hora . ":" . $minutos . " " . $tipo;
switch($que){
// INGRESAR
case 'noticias_ingresar':
$fecha = $mostrar;
$horario = $mostrar2;
$categoria = "Información";
$titulo = quitar($_POST[titulo]);
$noticiacorta = quitar($_POST[noticiacorta]);
$noticialarga = quitar($_POST[noticialarga]);
$imagen = quitar($_POST[imagen]);
if(!$titulo || !$noticiacorta || !$noticialarga || !$categoria || !$imagen){
echo"Faltó completar un campo obligatorio <br>
<a href=\"noticias_ingresar.php\">Volver atras</a>";
} else {
$sql = "INSERT INTO noticias(categoria, fecha, horario, titulo, noticiacorta, noticialarga, imagen, activo) values('$categoria', '$fecha', '$horario', '$titulo', '$noticiacorta', '$noticialarga', '$imagen', '1')";
$res = mysql_query($sql) or die("Error: ".mysql_error());
echo"Noticia Ingresada con éxito <br>
<a href=\"index.php\">Volver al index</a>";
}
break;
// MODIFICAR
$titulo = quitar($_POST[titulo]);
$noticiacorta = quitar($_POST[noticiacorta]);
$noticialarga = quitar($_POST[noticialarga]);
$imagen = quitar($_POST[imagen]);
if(!$titulo || !$noticiacorta || !$noticialarga || !$imagen){
echo"Faltó completar un campo obligatorio <br>
<a href=\"informacion_modificar.php\">Volver atras</a>";
} else {
$sql = "UPDATE noticias set titulo='$titulo', noticiacorta='$noticiacorta', noticialarga='$noticialarga', imagen='$imagen' WHERE id='$_POST[id]'";
$res = mysql_query($sql) or die("Error: ".mysql_error());
echo"Noticia Editada con éxito <br>
<a href=\"index.php\">Volver al panel de administración</a>";
}
break;
// ELIMINAR
case 'noticias_eliminar':
$res = mysql_query("delete from informacion where id='$_POST[borrar]'") or die("Error: ".mysql_error());
echo"Noticia Borrada con éxito <br>
<a href=\"index.php\">Volver al panel de administración</a>";
break;
}
?>
</td>
</tr>
</table>
<?php
include("../derechos.php");
echo("</body></html>");
}
?>