$Log$
+ Revision 1.12 2003/11/04 19:17:16 ajc
+ * Added an initial version of the goto command
+
Revision 1.11 2003/11/03 05:32:57 ajc
* Minor code cleanups
* ctdl_mesg() now returns ready-to-output HTML to the caller, instead of
Revision 1.1 2003/10/31 03:47:13 ajc
* Initial CVS import
-
//
function become_logged_in($server_parms) {
$_SESSION["logged_in"] = 1;
+ ctdl_goto("_BASEROOM_");
}
}
+//
+// Goto a room.
+//
+function ctdl_goto($to_where) {
+
+ serv_puts("GOTO " . $to_where);
+ $response = serv_gets();
+
+ if (substr($response, 0, 1) == "2") {
+ $_SESSION["room"] = strtok(substr($response, 4), "|");
+ return array(TRUE, substr($response, 0, 3));
+ }
+
+ else {
+ return array(FALSE, substr($response, 0, 3));
+ }
+
+}
+
+
?>
// Ok, now try again.
$clientsocket = fsockopen($sockname, 0, $errno, $errstr, 5);
- // Try to log the user back in.
+ // Try to log the user back in and go back to the correct room.
if ($clientsocket) {
ctdl_iden(); // Identify client
$_SESSION["password"]
);
}
+
+ if ($_SESSION["room"]) {
+ ctdl_goto($_SESSION["room"]);
+ }
+ else {
+ ctdl_goto("_BASEROOM_");
+ }
}
}
<h1>You're online!</h1>
<h2><?PHP echo "Welcome to ", $_SESSION["serv_humannode"]; ?></h2>
+<h3><?PHP echo "You're in: ", $_SESSION["room"]; ?></h3>
<P>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum
ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae;