require("addons/open_db.php");
if ( ( !empty( $db_asunto ) && !empty( $db_noticia ) ) || isset( $del ) )
{
session_name( "INFDJwebsite" );
$v1="user_id";
$v2="user_auth";
$v3="user_level";
session_register($v1,$v2,$v3);
session_start();
if ( isset( $del ) && $user_auth && $user_level == -2 )
$res = mysql_query( "DELETE FROM news WHERE id=$del", $conexion ) OR die("No puedo eliminar la noticia");
if ( isset( $add ) && $user_auth && $user_level <= -1 )
$res = mysql_query( "INSERT INTO news (fecha, uid, asunto, noticia) VALUES (CURDATE(), '$user_id', '".addslashes($db_asunto)."','".addslashes($db_noticia)."')", $conexion ) OR die("No puedo insertar la noticia");
if ( isset( $mod ) && $user_auth && $user_level == -2 )
$res = mysql_query( "UPDATE news SET uid='$user_id', asunto='".addslashes($db_asunto)."', noticia='".addslashes($db_noticia)."' WHERE id=$mod", $conexion ) OR die("No puedo modificar la noticia");
}
if ( !isset( $go ) )
$go = 1;
$go--;
$res = mysql_query( "SELECT fecha, asunto, noticia, id FROM news ORDER BY fecha+id DESC LIMIT $go, 1", $conexion ) OR die("No puedo realizar la consulta
$sql_upd
".mysql_error($conexion));
$numrows = mysql_num_rows( $res );
if ( $numrows > 0 )
$datos = mysql_fetch_array($res);
?>
';
// $numrows = mysql_num_rows( $res );
if ( $numrows > 0 )
{
// $datos = mysql_fetch_array($res);
echo "$datos[0]
";
echo "".stripslashes($datos[1])."";
echo "
".nl2br(stripslashes($datos[2]))."
";
} else {
echo "No hay noticias en el sistema";
}
mysql_free_result($res);
mysql_close($conexion);
echo "