示例#1
0
    echo "Error: more than one editing sessions for char" . $charId;
    die;
}
$sessionId = 0;
if ($num == 0) {
    // Not found => first, create an editing session for this character, start the session and invite himself
    $query = "SELECT char_name FROM characters WHERE char_id = {$charId}";
    $result = mysqli_query($link, $query) or die("Can't execute the query: " . $query);
    $num = mysqli_num_rows($result);
    $characterName = "";
    if ($num > 0) {
        $row = mysqli_fetch_assoc($result);
        $characterName = $row['char_name'];
    }
    global $SessionId, $SessionToolsResult;
    planEditSession($charId, $domainId, "st_edit", $characterName, "");
    if ($SessionToolsResult === false) {
        die;
    }
    startSession($charId, $domainId, $SessionId);
    if ($SessionToolsResult === false) {
        die;
    }
    $sessionId = $SessionId;
} else {
    $row = mysqli_fetch_assoc($result);
    $sessionId = $row['session_id'];
    $state = $row['state'];
    echo "Found your session: {$sessionId} ({$state})<br>";
    if ($state == "ss_planned") {
        // First, start the session
<?php

include_once '../tools/validate_cookie.php';
include_once 'ring_session_manager_itf.php';
include_once '../tools/domain_info.php';
include_once '../login/config.php';
include_once 'session_tools.php';
///////////////////////////
// Main code
///////////////////////////
$domainId = -1;
if (!validateCookie($userId, $domainId, $charId)) {
    echo "<h1>Invalid cookie, please relog<H1>";
    die;
}
planEditSession($charId, $domainId, $_POST["session_type"], $_POST["title"], $_POST["description"]);
echo "Finish<br>";
echo '<a href="web_start.php">Return to start menu</a>';