when response is over Game messages: GLOBAL message\n **Global messages are game wide events like a newplayer joining or someone attacking another player or even worse someone launching the escape shuttle At present the game server sends you preformatted data eventually there will be two types of data modes, RAW and FORMAT. Raw will just send specific data which the client will be responsible for handling while FORMAT will be the current method */ //settings $url = "localhost"; $port = "10001"; //globals $user = $_POST["user"]; $pass = $_POST["pass"]; $cmd = $_POST["cmd"]; $newplayer = $_POST["newplayer"]; if($user && $pass) { $fp = fsockopen($url,$port,$errno,$errstr, 10); stream_set_timeout($fp, 1); if (!$fp) { echo "Could not connect to Doomsday server"; return; } fwrite($fp,"CLIENT SET SINGLE\n"); fgets($fp); stream_set_timeout($fp, 5); if($newplayer) { if ($user) { $command = sprintf("DATA %s newplayer\n",$user); fwrite($fp,$command); ?>
                \n")
                      break;
                   echo $buffer;
                }
                $command = sprintf("DATA %s password %s\n",$user,$pass);
                fwrite($fp,$command);
                $buffer = fgets($fp);
                echo $buffer;
                ?>
                

after welcome we don't want it if ($command){ fwrite($fp,$command); echo "

\n";
             while ($buffer) {
               $buffer = fgets($fp);
               $buffer = str_replace(sprintf("PLAYER %s",$user),"",$buffer);
               $buffer = wordwrap($buffer,255,"\n");
               if ($buffer == " \n") 
                   break;
               echo $buffer;
             
            }
             echo "
\n"; } $command = sprintf("DATA %s LOGOUT\n",$user); fwrite($fp,$command); fclose($fp); ?>
\n" . $buffer . "\n"; fclose($fp); showform(); } } else { showform(); showglobal($url,$port,$errno,$errstr); } ?>
\n
\n"; $fp = fsockopen($url,$port,$errno,$errstr, 10); stream_set_timeout($fp, 5); if (!$fp) { echo "Could not connect to Doomsday server\n
\n"; return; } fwrite($fp,"CLIENT GLOBAL\n"); echo "
\n";
      while($buffer = fgets($fp)) {

          $buffer = str_replace("SERVER","<Doomsday>",$buffer);
          $buffer = str_replace("\'","'",$buffer);
          $buffer = wordwrap($buffer,83,"\n");
          if ($buffer == "<Doomsday> \n") 
               break;
          echo $buffer;
      }
      echo "
\n"; fclose($fp); echo "
\n
\n"; } function showform() { ?>
Username: Password: