1) // not on 1st page so display links to 1st and previous pages { $prev_page=$current_page-1; echo "[ First ]"; echo "[ < ]"; } else { echo "[ First ]"; echo "[ < ]"; } /* page-numbered links code segment */ $start=$current_page-4; // 1st page link to display if($start < 1) { $start=1; } $end=$current_page+4; // last page link to display if($end > $total_num_pages) { $end=$total_num_pages; } for($pg=$start; $pg <= $end; $pg++) { if($pg == $current_page) // do not create hyperlink for current page { echo "[ $pg ] "; } else // create hyperlink to page $pg { echo "[ $pg ] "; } } /* END of page-numbered links code segment */ if($current_page < $total_num_pages) // not on last page so display links to last and next pages { $next_page=$current_page+1; echo "[ > ]"; echo "[ Last ]"; } else { echo "[ > ]"; echo "[ Last ]"; } }// end page_num_links() /////////////////////////////////////////////////////////////////////////////// // Function: void display_openbook(array $post) // Purpose: displays guestbook entry in $post; OpenBook style // Parameters: // $post - array containing details of guestbook entry // Returns: nothing // Global references: // $_SESSION // $_GET // Remarks: modify the HTML to suit your taste /////////////////////////////////////////////////////////////////////////////// function display_openbook($post) { global $_SESSION; global $_GET; if(empty($_GET['page'])) { $_GET['page']=1; } ?>
Name Email Date posted
".$post['useremail'].""; else echo "withheld"; ?>

Reply:
", wordwrap(stripslashes(nl2br($post['reply'])),50,"\n",1); ?>
Edit Entry / Reply
Author Message



"; ?> "; ?>
Posted:



Reply:
", wordwrap(stripslashes(nl2br($post['reply'])),50,"\n",1); ?>
Edit Entry / Reply
0 && $_GET['page'] <= $total_num_pages) // incorrect page requested; default to 1st page { $current_page=$_GET['page']; } else { $current_page=1; } } else // if no page value was passed, show the 1st page by default { $current_page=1; } // retrieve guestbook entries from db // Note: if you want to show the time use date_format(postdate,'%D %b %Y %r') instead $query="SELECT entryid,username,useremail,homepage,subject,message,date_format(postdate,'%D %b %Y') AS date,reply " ."FROM $posts_table " ."WHERE approved=1 " ."ORDER BY entryid DESC " ."LIMIT ".($current_page - 1) * $OB_entries_per_page.",".$OB_entries_per_page; $result=mysql_query($query); ?>

Mosquito Association Guestbook

Welcome to your guestbook ", $_SESSION['admin_name'], "!\n"; echo "
[Logout]
\n"; } ?>
[Sign my guestbook]
Total number of entries: .


\n"; } else // display each entry stored in db { $draw_hr=false; // to indicate whether to draw
// display guestbook entries while($post=mysql_fetch_array($result)) { if($draw_hr) echo "
\n"; // draw horizontal line separator $display_function="display_".$OB_display_type; $display_function($post); // dynamically call function to display guestbook entries $draw_hr=true; } } ?>
Total number of entries: .
[Our guestbook is no longer accepting new posts]

\n"; echo "This page was generated in $exec_time seconds."; echo "\n"; */ pagefooter(); ?>