<?php
/*********************/
/*                   */
/*  Version : 5.1.0  */
/*  Author  : RM     */
/*  Comment : 071223 */
/*                   */
/*********************/

echo "<link href=\"estilo.css\" \t\trel=\"stylesheet\" type=\"text/css\">\r\n";
$id = $_GET['id'];
include( "config.php" );
$qNoticia = mssql_query( "SELECT * FROM SITE_NOTICIA ORDER BY Numero DESC" );
if ( !$id )
{
    echo "<table width=\"470\" border=\"0\" cellpadding=\"2\" cellspacing=\"2\" style=\"word-break:break-all\" align=\"center\" class=\"noticiatable\">\r\n\t\t\t\t<tr><td height=\"5\" colspan=\"2\" class=\"noticiatitulo\">NOTICIAS</td></tr>\r\n\t";
    while ( $Noticia = mssql_fetch_array( $qNoticia ) )
    {
        echo "\t\t\t\t<tr>\r\n\t\t\t\t\t<td height=\"19\" class=\"noticiatd\" width=\"85%\"><a href=\"?pagina=noticia&id=";
        echo $Noticia['Numero'];
        echo "\" class=\"noticia\">&nbsp;";
        echo $Noticia['Titulo'];
        echo "</a></td>\r\n\t\t\t\t\t<td align=\"right\" class=\"noticiatd\">";
        echo $Noticia['Data'];
        echo "</td>\r\n\t\t\t\t</tr> ";
    }
    echo "\t\t\t\t </table>  ";
}
if ( $id )
{
    $qNoticia2 = @mssql_query( "SELECT * FROM SITE_NOTICIA WHERE Numero='".$id."'" );
    while ( $Noticia2 = @mssql_fetch_array( $qNoticia2 ) )
    {
        $x = 0;
        for ( ; $x < 33; ++$x )
        {
            $a = $x * 255;
            $b = $a + 255;
            $sql = @mssql_query( "SELECT SUBSTRING(Conteudo, ".$a.", ".$b.") FROM SITE_NOTICIA WHERE Numero='".$id."'" );
            $result = @mssql_fetch_row( $sql );
            $noticia .= $result[0];
        }
        $conteudo = html_entity_decode( $noticia );
        echo "<table width=\"470\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" style=\"word-break:break-all\" align=\"center\">\r\n\t\t\t\t<tr><td height=\"5\" colspan=\"2\"><br>\r\n\t\t\t\t<table border=0 cellpadding=2 cellspacing=2 width=\"100%\" class=\"noticiatable\">\r\n\t\t\t\t<tr>\r\n\t\t\t\t\t<td width=\"70%\" class=\"noticiatd\"><b>";
        echo $Noticia2['titulo'];
        echo "</b></td>\r\n\t\t\t\t\t<td align=\"right\" class=\"noticiatd\">Postado por ";
        echo $Noticia2['Autor'];
        echo "\t\t\t\t</tr>\r\n\t\t\t\t<tr><td colspan=\"2\" class=\"noticiatd\"><br>";
        echo $conteudo;
        echo "<br></td></tr>\r\n\t\t\t\t<tr><td colspan=\"2\" class=\"noticiatd\" align=\"right\">em ";
        echo $Noticia2['Data'];
        echo " as ";
        echo $Noticia2['Hora'];
        echo "</td></tr>\r\n\t\t\t\t</table></td></tr>\r\n\t\t\t\t\t";
    }
    echo "\t\t\t\t</table>\r\n";
}
?>
