// Rewritten by Iain (17 September 2006): iain@outpost10f.com // Variables... $itemsPerPage = 10; // Change if wanted... $SELF = 'chatsaves.php'; // Page Header, and includes, and DB connect. include 'notwerk_setup.php'; $pageTitle = "Chatsaves"; html_begin($pageTitle, $pageTitle); include("/home/sites/site8/web/config_local.php"); include("/home/sites/site8/web/ADOdb/adodb.inc.php"); include("/home/sites/site8/web/global_funcs.php"); connectdb(); // Get Parameters... $pageID = $_REQUEST['pageID']; $pageID || $pageID = 1; // Default to Page 1. // Main SQL Query... $sqlSkip = $itemsPerPage * ($pageID-1); // This should stop SQL injection, by using parameter passed through in numeric context... $sqlResult = $db->Execute("SELECT * FROM ent_humor WHERE catagory='Chatsaves' ORDER BY title ASC LIMIT $sqlSkip,$itemsPerPage"); // SQL Query for Number of Pages... $sqlResultItemNr = $db->Execute("SELECT COUNT(*) FROM ent_humor WHERE catagory='Chatsaves'"); $nrItems = $sqlResultItemNr->fields['COUNT(*)']; $nrPages = ($nrItems / $itemsPerPage) + 1; // Display Page Bar... echo "
Page: "; for ($pageNr=1; $pageNr<=$nrPages; $pageNr++) { echo ($pageNr == $pageID) ? "[$pageNr] " : "[$pageNr] "; } // Display Items... while(!$sqlResult->EOF) { $sqlRow = $sqlResult->fields; echo "
" . parseContent($sqlRow['content']) . "
\n\n"; $sqlResult->MoveNext(); } // Page Footer. html_end() ?>