]> code.citadel.org Git - citadel.git/blobdiff - ctdlphp/sessionproxy.php
* Got login/logout working. Still need to redirect unloggedin sessions to
[citadel.git] / ctdlphp / sessionproxy.php
index ee4703eb63b8052054d3d3f694e9dc568674ff5c..8d544270b7552a89cd2e3725e551a26567493729 100755 (executable)
@@ -78,6 +78,9 @@ if ($ret < 0) {
        exit(4);
 }
 
+// Set the permissions so someone else doesn't jump into our connection.
+chmod($sockname, 0600);
+
 // We need to get a connection to the Citadel server going now.
 
 $ctdlsock = fsockopen("uncensored.citadel.org", 504, $errno, $errstr, 30);
@@ -124,7 +127,13 @@ do {
 
                        if (substr($talkback, 0, 1) == "1") do {
                                $buf = fgets($ctdlsock, 4096);
-                               socket_write($msgsock, $buf, strlen($buf));
+                               if (!$buf) {
+                                       $buf = "000\n" ;
+                               }
+                               else {
+                                       socket_write($msgsock, $buf,
+                                               strlen($buf));
+                               }
                        } while ($buf != "000\n");
 
                }