]> code.citadel.org Git - citadel.git/blobdiff - ctdlphp/ctdlsession.php
* Minor code cleanups
[citadel.git] / ctdlphp / ctdlsession.php
index 6669eac75af8d4007841273844f834b4c1216050..a890e842149692bebc7d170fa755cdd9bdb9ee88 100644 (file)
@@ -1,7 +1,6 @@
 <?PHP
 
-//
-// ctdlsession.php
+// $Id$
 //
 // This gets called from within the header functions.  It establishes or
 // connects to a PHP session, and then connects to Citadel if necessary.
@@ -42,24 +41,25 @@ function establish_citadel_session() {
 
                // Ok, now try again.
                $clientsocket = fsockopen($sockname, 0, $errno, $errstr, 5);
+
+               // Try to log the user back in.
+               if ($clientsocket) {
+
+                       ctdl_iden();    // Identify client
+
+                       if ($_SESSION["username"]) {
+                               login_existing_user(
+                                       $_SESSION["username"],
+                                       $_SESSION["password"]
+                               );
+                       }
+               }
        }
 
        if ($clientsocket) {
-               /*
-               echo "Connected.  Performing echo tests.<BR>\n";
-               flush();
-               $cmd = "ECHO test echo string upon connection\n";
-               fwrite($clientsocket, $cmd);
-               $response = fgets($clientsocket, 4096);
-               echo "Response is: ", $response, "<BR>\n";
-               flush();
-
-               $cmd = "ECHO second test for echo\n";
-               fwrite($clientsocket, $cmd);
-               $response = fgets($clientsocket, 4096);
-               echo "Response is: ", $response, "<BR>\n";
-               flush();
-               */
+               if (!$_SESSION["serv_humannode"]) {
+                       ctdl_get_serv_info();
+               }
        }
        else {
                echo "ERROR: no Citadel socket!<BR>\n";