'; $pages = (int)($count / $per_page); if ($pages == 0) $pages=1; else if ($count % $per_page > 0) ++$pages; $cur_page = (int)$_GET['page']; if (!isset($cur_page)) $cur_page = 1; if ($cur_page < 1) $cur_page = 1; else if ($cur_page > $pages) $cur_page = (int)$pages; else echo $pages .' pages - '; echo 'Pagina: '.$cur_page.'

'."\n"; echo ''; // Time to create the power of Pagination with style echo ''; // Lets organize them shall we $req = 'SELECT ID, name, datetime, comment, id2 FROM comments where id2='.$_GET['id'].' ORDER BY ID desc limit ' .(($cur_page-1)*$per_page) . ", $per_page "; $result = mysql_query ($req,$db); while($row = mysql_fetch_assoc($result)) { mysql_real_escape_string($name = stripslashes(htmlentities($row['name']))); mysql_real_escape_string($comment = stripslashes(htmlentities($row['comment']))); $datetime = date("M-jS-o", $row['datetime']); echo '
'."\n"; echo '

'."\n"; echo ' '; // Url detection for future version if ($url && preg_match("/(www\.)", "/(http:\.)", $url)) { echo ''.$name.''; } else { echo "$name"; } // time to get the time working echo ' Enviado: '.$datetime.'

'."\n"; echo '
'."\n\n"; // How about the comment? echo '
'."\n"; echo '

'.(nl2br($comment)).'

'."\n"; echo '
'."\n\n"; echo '
'."\n\n"; } ?>
Comentarios

'; echo ' Please enter your name!'; echo '
'; } if (!empty($_GET['errorm'])) { echo '
'; echo ' Please enter a message!'; echo '
'; } // lets submit the form if(isset($_POST['submit'])) { $comment = trim($_POST['comment']); $name = trim($_POST['name']); if ($name =="") { header("Location: ?errorn=1#err"); } elseif ($comment =="") { header("Location: ?errorm=1#err"); } else { header("Location: $domain#comments"); $ip = $_SERVER["REMOTE_ADDR"]; $datetime = time(); $name = SafeAddSlashes($name); $comment = SafeAddSlashes($comment); $sql="INSERT INTO comments (name, comment, ip, datetime, id2) VALUES ('$name', '$comment', '$ip', '$datetime', '$identi')"; $result = mysql_query($sql, $db); exit; } } ?>