$_SESSION["username"] = $user;
$_SESSION["password"] = $pass;
+ become_logged_in(substr($resp, 4));
return array(TRUE, "Login successful. Have fun.");
}
$_SESSION["username"] = $user;
$_SESSION["password"] = $pass;
+ become_logged_in(substr($resp, 4));
return array(TRUE, "Login successful. Have fun.");
}
+//
+// Code common to both existing-user and new-user logins
+//
+function become_logged_in($server_parms) {
+ $_SESSION["logged_in"] = 1;
+}
+
+
//
// Learn all sorts of interesting things about the Citadel server to
}
-
+//
+// Temporary function to verify communication with the Citadel server.
+//
function test_for_echo() {
-
global $clientsocket, $session;
$command = "ECHO Video vertigo ... test for echo.";
-
serv_puts($command);
$response = serv_gets();
echo $response, "<BR>";
flush();
}
+
+//
+// Display a system banner.
+// (This is probably temporary because it outputs more or less finalized
+// markup. For now it's just usable.)
+//
function ctdl_mesg($msgname) {
global $clientsocket;
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);
+
+}
+
+
+
?>