Example #1
0
            }
        }
        $delay = 0;
        if (isset($_POST["secure"]) and $_POST["secure"] == "yes") {
            $p = $p->ice_secure(true);
        }
        if (isset($_POST["timeout"]) and $_POST["timeout"] == "yes") {
            $p = $p->ice_timeout(2000);
        }
        if (isset($_POST["delay"]) and $_POST["delay"] == "yes") {
            $delay = 2500;
        }
        if ($p->ice_isTwoway()) {
            $hello = Demo_HelloPrxHelper::checkedCast($p);
        } else {
            $hello = Demo_HelloPrxHelper::uncheckedCast($p);
        }
        if (isset($_POST["sayHello"])) {
            $hello->sayHello($delay);
        } elseif (isset($_POST["shutdown"])) {
            $hello->shutdown();
        }
        echo "OK\n";
    } catch (Ice_LocalException $ex) {
        echo "<pre>\n";
        print_r($ex);
        echo "</pre>\n";
    }
    echo "</B></P>\n";
    echo "<HR>\n";
}
Example #2
0
session_start();
try {
    //
    // Attempt to retrieve the communicator that was registered in login.php
    // for the session ID.
    //
    $ICE = Ice_find(session_id());
    if (!isset($_SESSION['authenticated']) || $ICE == null) {
        echo "<P><HR><B>\n";
        echo "No active session found. Visit the <a href=\"login.php\">login</a> page to proceed.\n";
        echo "</B><HR></P>\n";
        exit;
    }
    if (isset($_POST["submitted"])) {
        if (isset($_POST["sayHello"])) {
            $hello = Demo_HelloPrxHelper::uncheckedCast($ICE->stringToProxy("hello:tcp -p 10000"));
            $hello->sayHello(0);
            echo "<P><HR><I>Success.</I><HR></P>\n";
        } elseif (isset($_POST["logout"])) {
            try {
                $router = Glacier2_RouterPrxHelper::uncheckedCast($ICE->getDefaultRouter());
                $router->destroySession();
            } catch (Glacier2_SessionNotExistException $ex) {
                //
                // This exception is expected if the session has expired.
                //
            } catch (Exception $ex) {
                // Ignore.
            }
            unset($_SESSION['authenticated']);
            Ice_unregister(session_id());