* ctdlprotocol.php: worked out a tentative data API using this function.
$Log$
+ Revision 1.10 2003/11/02 05:35:11 ajc
+ * who.php: added
+ * ctdlprotocol.php: worked out a tentative data API using this function.
+
Revision 1.9 2003/11/02 04:26:11 ajc
* Cleaned up the pages in preparation for handing it off to the extremely
talented developers and webmasters who will soon be working on it.
Revision 1.1 2003/10/31 03:47:13 ajc
* Initial CVS import
-
if (substr($response, 0, 1) == "1") {
echo "<DIV ALIGN=CENTER>\n";
- do {
- $buf = serv_gets();
- if (strcasecmp($buf, "000")) {
- echo "<TT>", $buf, "</TT><BR>\n" ;
- }
- } while (strcasecmp($buf, "000"));
+ while (strcmp($buf = serv_gets(), "000")) {
+ echo "<TT>", $buf, "</TT><BR>\n" ;
+ }
echo "</DIV>\n";
}
else {
}
+//
+// Fetch the list of users currently logged in.
+//
+function ctdl_rwho() {
+ global $clientsocket;
+
+ serv_puts("RWHO");
+ $response = serv_gets();
+
+ if (substr($response, 0, 1) != "1") {
+ return array(0, NULL);
+ }
+
+ $all_lines = array();
+ $num_lines = 0;
+
+ while (strcmp($buf = serv_gets(), "000")) {
+
+ $thisline = array();
+
+ $tok = strtok($buf, "|");
+ if ($tok) $thisline["session"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["user"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["room"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["host"] = $tok;
+
+ $tok = strtok("|");
+ if ($tok) $thisline["client"] = $tok;
+
+ // IGnore the rest of the fields for now.
+
+ $num_lines = array_push($all_lines, $thisline);
+ }
+
+ return array($num_lines, $all_lines);
+
+}
+
+
+
?>
echo "<a href=\"logout.php\">Log out</A><BR>\n" ;
}
else {
- echo "<A HREF=\"welcome.php\">Logged in. Click to continue.</a><BR>";
+ echo "<A HREF=\"welcome.php\">Logged in. ";
+ echo "Click to continue if your browser does not refresh.</a><BR>";
echo "<meta http-equiv=\"refresh\" content=\"0;url=welcome.php\">\n";
}
<table border="0" cellspacing="5" cellpadding="5" BGCOLOR="#EEEEEE">
<tr><td>User name:</td>
- <td><input type="text" name="name" maxlength="25"></td></tr>
+ <td><input type="text" name="user" maxlength="25"></td></tr>
<tr><td>Password:</td>
<td><input type="password" name="pass" maxlength="20"></td></tr>
<?PHP
bbs_page_footer();
?>
-
<a href="welcome.php">Page One</a><BR>
<a href="page3.php">Page Three</a><BR>
+<a href="who.php">Who is online?</a><BR>
<?PHP
bbs_page_footer();
ipsum dolor sit amet, consectetuer adipiscing elit.</p>
<a href="page2.php">Page Two</a><BR>
+<a href="who.php">Who is online?</a><BR>
<a href="page3.php">Page Three</a><BR>
<?PHP
--- /dev/null
+<?PHP
+ include "ctdlheader.php";
+ bbs_page_header();
+
+
+ echo "<TABLE border=1>";
+ echo "<TR>";
+ echo "<TD><B>User</B></TD>";
+ echo "<TD><B>Room</B></TD>";
+ echo "<TD><B>Host</B></TD>";
+ echo "</TR>";
+
+ list($num_users, $wholist) = ctdl_rwho();
+
+ if ($num_users > 0) foreach ($wholist as $x) {
+ echo "<TR>";
+ echo "<TD>", htmlspecialchars($x["user"]), "</TD>";
+ echo "<TD>", htmlspecialchars($x["room"]), "</TD>";
+ echo "<TD>", htmlspecialchars($x["host"]), "</TD>";
+ echo "</TR>\n";
+ }
+
+ echo "</TABLE>\n";
+
+?>
+
+<a href="welcome.php">Page One</a><BR>
+<a href="page3.php">Page Three</a><BR>
+
+<?PHP
+ bbs_page_footer();
+?>