stringCount(); } function randomString() { $index = rand(0,count($_SESSION['strings'])-1); return $_SESSION['strings'][$index]; } function stringCount() { return count($_SESSION['strings']); } } // Including this sets up the JPSPAN constant require_once 'JPSpan/JPSpan.php'; // Load the PostOffice server require_once JPSPAN . 'Server/PostOffice.php'; // Create the PostOffice server $S = & new JPSpan_Server_PostOffice(); // Register your class with it... $S->addHandler(new HelloWorld()); // This allows the JavaScript to be seen by // just adding ?client to the end of the // server's URL if (isset($_SERVER['QUERY_STRING']) && strcasecmp($_SERVER['QUERY_STRING'], 'client')==0) { // Compress the output Javascript (e.g. strip whitespace) // turn this off it has performance problems define('JPSPAN_INCLUDE_COMPRESS',false); // Display the Javascript client $S->displayClient(); } else { // This is where the real serving happens... // Include error handler // PHP errors, warnings and notices serialized to JS require_once JPSPAN . 'ErrorHandler.php'; // Start serving requests... $S->serve(); } ?>