$Log$
+ Revision 1.16 2003/11/14 17:09:04 ajc
+ * Added a basic read loop ... currently only fetches message numbers
+
Revision 1.15 2003/11/09 17:53:47 ajc
* Moved all of the session-management code from ctdlheader.php to
ctdlsession.php, leaving only a single function call. This will
Revision 1.1 2003/10/31 03:47:13 ajc
* Initial CVS import
-
}
+//
+// Fetch the list of messages in this room.
+// Returns: count, response, message array
+//
+function ctdl_msgs($mode, $count) {
+ global $clientsocket;
+
+ serv_puts("MSGS " . $mode . "|" . $count);
+ $response = serv_gets();
+
+ if (substr($response, 0, 1) != "1") {
+ return array(0, substr($response, 4), NULL);
+ }
+
+ $msgs = array();
+ $num_msgs = 0;
+
+ while (strcmp($buf = serv_gets(), "000")) {
+ $num_msgs = array_push($msgs, $buf);
+ }
+
+ return array($num_msgs, substr($response, 4), $msgs);
+}
+
?>
echo "You are now in: ", htmlspecialchars($_SESSION["room"]) , "<BR>\n";
?>
+<a href="readmsgs.php?mode=new&count=0">Read new messages</a><BR>
+<a href="readmsgs.php?mode=all&count=0">Read all messages</a><BR>
<a href="welcome.php">Page One</a><BR>
<a href="page3.php">Page Three</a><BR>
--- /dev/null
+<?PHP
+ include "ctdlheader.php";
+ bbs_page_header();
+
+ list($num_msgs, $response, $msgs) = ctdl_msgs($_REQUEST["mode"],
+ $_REQUEST["count"] );
+
+ echo "num_msgs: " . $num_msgs . "<BR>\n" ;
+ echo "response: " . htmlspecialchars($response) . "<BR>\n" ;
+
+ if ($num_msgs > 0) foreach ($msgs as $msgnum) {
+ echo $msgnum . ", " ;
+ }
+
+?>
+
+<BR>
+<a href="welcome.php">Page One</a><BR>
+<a href="page3.php">Page Three</a><BR>
+
+<?PHP
+ bbs_page_footer();
+?>