codice:
<?php $allow_guests = "true"; 
include('core.php'); 
$select = mysql_query("SELECT * FROM cms_news ORDER BY num DESC");
if(!empty($_GET['id']) && is_numeric($_GET['id'])){
$prendi = mysql_query("SELECT * FROM cms_news WHERE num = '".$_GET['id']."' ");
$art = mysql_fetch_assoc($prendi);
if(mysql_num_rows($prendi) == 0){ 
$newstitle = "News inesistente"; 
$pagename = $newstitle; 
$short = "Questa news non esiste!";
}else{
$pagename = $art['title'];
$short = $art['short_story'];
$story = $art['story'];
$newstitle = $art['title'];
$id = $art['num'];
}
}
if(empty($_GET['id'])){ 
$prendi = mysql_query("SELECT * FROM cms_news ORDER BY num DESC LIMIT 1 ");
$art = mysql_fetch_assoc($prendi);
$pagename = $art['title'];
$short = $art['short_story'];
$story = $art['story'];
$newstitle = $art['title'];
if(mysql_num_rows($prendi) == 0){
$newstitle = "News inesistente";
$pagename = $newstitle;
$short = "Questa news non esiste!";
}
$id = $art['num'];
}
include('skin/pages.php');
$str = str_replace('%name%', $name, $story);
if(isset($_POST['commento'])){
if(empty($_POST['commento'])){ $error = "Scrivi un messaggio!<br>"; }
elseif(strlen($_POST['commento']) < 10){ $error = "Messaggio troppo corto! (almeno 10 caratteri)<br>"; }
if(empty($error)){
mysql_query("INSERT INTO cms_comments (utente, messaggio, data, newsid) VALUES ('".$name."', '".$_POST['commento']."', '".$date_normal."', '".$id."'); ");
}
}
$prendi_comm = mysql_query("SELECT * FROM cms_comments WHERE newsid = '".$id."' ORDER BY id DESC");
if(isset($_POST['comment_id'])){
mysql_query("DELETE FROM cms_comments WHERE id =  '".$_POST['comment_id']."' ");
header("location: ".$path."articoli/".$id."");
}
?><script>function showOverflow(number){ $("#comment"+number).show(); }function closeOverflow(number){ $("#comment"+number).hide(); }function submitThis(comment){ $("#commento_"+comment).submit(); }</script>




<div id="page_content">
                <div class="box" style="float:left;width:25%;margin-bottom:100px">
<h2 class="boxtitle blue">News</h2>
<?php while($news = mysql_fetch_assoc($select)){ if($_GET['id'] !== $news['num']){ ?>
<p class="boxtext"><a href="/articoli/<?php echo $news['num']; ?>"><u><?php echo $news['title']; ?></u></a></p>
<?php }else{ ?>
<p class="boxtext"><b><?php echo $news['title']; ?></b></p>
<?php } } ?>
</div>
<div class="box" style="float:right;width:71%;padding-bottom:10px">
<h2 class="boxtitle blue"><?php echo $newstitle; ?></h2>
<p class="boxtext" style="font-size:11pt;font-weight:bold"><?php echo $short; ?></p>
<div class="boxtext news" style="font-size:15px;font-family:calibri"><?php echo $str; ?><br>-<?php echo $art['author']; ?></div></div>


<?php if(mysql_num_rows($prendi_comm) > 0){ ?><div class="box" style="float:right;width:71%;<?php if(!session_is_registered(username)){ ?>margin-bottom:100px;<?php } ?>padding-bottom:10px;padding-left:20px"><h2>Commenti (<?php echo mysql_num_rows($prendi_comm); ?>)</h2>
<?php while($comm = mysql_fetch_assoc($prendi_comm)) {
$prendi_us = mysql_query("SELECT * FROM users WHERE username = '".$comm['utente']."' ");
$user = mysql_fetch_assoc($prendi_us); 
if($comm['utente'] == $name || $myrow['rank'] > 5){ ?>
<form method="post" id="commento_<?php echo $comm['id']; ?>" style="padding-top:10px;text-align:right;padding-right:20px;border-top:1px dotted"><input type="hidden" name="comment_id" value="<?php echo $comm['id'] ?>">
<a onclick="showOverflow('<?php echo $comm['id']; ?>');" class="button">Elimina commento</a>




<div class="overflow" id="comment<?php echo $comm['id']; ?>" style="background: #fff;width: 300px;height: 150px;position: absolute;border-radius: 5px;box-shadow: 0 0 10px;padding:10px"><h3 class="boxtitle red">Elimina commento</h3>Sei sicuro di voler eliminare questo commento?<br><br>
<a onclick="submitThis('<?php echo $comm['id']; ?>')" class="button green" style="float:left"><b style="height:25px">Si, prosegui</b><i></i></a> <a onclick="closeOverflow('<?php echo $comm['id']; ?>');" class="button" style="float:right"><b style="height:25px">No, annulla</b><i></i></a></div>


</form><?php } ?>
<p class="boxtext" style="padding-left:65px;background:url('http://www.habbo.it/habbo-imaging/avatarimage?figure=<?php echo $user['look']; ?>') left no-repeat;padding-right:20px;"><a href="<?php echo $path; ?>home?user=<?php echo $comm['utente']; ?>"><u><?php echo $comm['utente']; ?></u></a>
<span style="float:right"><?php echo $comm['data']; ?></span><br><br>
<?php echo addslashes(htmlentities(utf8_decode($comm['messaggio']))); ?></p>
<?php } ?></div>


<?php } if(session_is_registered(username)){ ?>
<div class="box" style="float:right;width:71%;margin-bottom:100px;padding-bottom:10px;padding-left:20px">
<h2>Scrivi un commento</h2><font color="red"><?php echo $error; ?></font><form method="post">
<textarea class="textarea" name="commento" style="width:98%"></textarea><br><br>
<input type="submit" class="submit" value="Invia commento"></form></div>
     <?php } include('skin/footer.php'); ?>
Magari così è più leggibile