Beispiel #1
0
function &RespawnSession($line = null, $file = null)
{
    global $FORUM;
    // Ensure session info was passed to the script.
    if (!isset($_COOKIE['sid']) && !$FORUM) {
        __printLoginRequiredErr();
    }
    // Attempt to respawn the session.
    $sid = new SId();
    if (!$sid->IsSessionValid()) {
        __printLoginRequiredErr();
    }
    //__printFatalErr("Failed to respawn user session.", $line, $file);
    return $sid;
}
Beispiel #2
0
<?php

// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
include_once "config.php";
include_once "{$INCLUDE_PATH}/system.php";
include_once "{$INCLUDE_PATH}/engine/sid.class.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
include_once "{$INCLUDE_PATH}/userstats.php";
global $URI_BASE, $URI_HOME, $LOGO;
$title = 'Index - News';
// Attempt to respawn a session.
$sid = new SId();
if ($sid->IsSessionValid()) {
    draw_page('login_forward.php');
} else {
    draw_page('index.php');
}
<?php

include_once "config.php";
include_once "{$INCLUDE_PATH}/system.php";
include_once "{$INCLUDE_PATH}/error.php";
include_once "{$INCLUDE_PATH}/engine/sid.php";
include_once "{$INCLUDE_PATH}/engine/validation.php";
include_once "{$INCLUDE_PATH}/engine/campaign.class.php";
include_once "{$INCLUDE_PATH}/engine/character.class.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
include_once "{$INCLUDE_PATH}/engine/serialization.php";
// Try to respawn a session to keep the menu nav in context.
$sid = new SId();
if ($REQUIRE_LOGIN && !$sid->IsSessionValid()) {
    draw_page('login_required.php');
    exit;
}
// Validate permission for the requested character.
$id = (int) $_POST['id'];
if (!$id) {
    $id = (int) $_GET['id'];
}
$campaign = new Campaign($id);
if ($sid->GetUserName() != $campaign->owner) {
    draw_page('view_campaign_error.php');
    exit;
}
$title = $campaign->cname;
draw_page('campaign_summary.php');
Beispiel #4
0
<?php

// search.php
// Performs a search based on character name.
include_once "config.php";
include_once "{$INCLUDE_PATH}/engine/db.php";
include_once "{$INCLUDE_PATH}/engine/sid.class.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
include_once "{$INCLUDE_PATH}/error.php";
include_once "{$INCLUDE_PATH}/system.php";
// Try to respawn a session to keep the menu nav in context.
$sid = new SId();
global $rpgDB;
if ($REQUIRE_LOGIN && !$sid->IsSessionValid()) {
    draw_page('login_required.php');
    exit;
}
if ($_GET['cname'] || $_GET['type'] == 'all') {
    // Search name entered, do search.
    $recordsPerPage = 15;
    $name = $_GET['cname'];
    $type = $_GET['type'];
    $sort = $_GET['sort'];
    $page = $_GET['page'];
    $sql = sprintf("SELECT c.id, c.cname, DATE_FORMAT(c.lastedited, '%%d %%M %%Y @ %%H:%%i') as lastedited, c.owner, st.name as tname, ca.name as caname " . "FROM %s st, %s c LEFT JOIN %s ca on ca.id = c.campaign " . "WHERE c.public = 'y' AND c.template_id = st.id ", $TABLE_TEMPLATES, $TABLE_CHARS, $TABLE_CAMPAIGNS);
    if ($type == 'begins') {
        $sql .= "AND UPPER(c.cname) LIKE UPPER('" . $name . "%') ";
    } else {
        if ($type == 'contains') {
            $sql .= "AND UPPER(c.cname) LIKE UPPER('%" . $name . "%') ";
        } else {
Beispiel #5
0
<?php

// logout.php
// Clears the session cookie and session data in the database.
include_once "config.php";
include_once "{$INCLUDE_PATH}/engine/sid.class.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
// Clear the session cookie.
$sid = new SId();
$sid->ClearSession();
$sid = null;
$title = 'Logged Out';
// Show the logged out page.
draw_page('logout.php');
Beispiel #6
0
// access). General strategy:
//    - Check if user is logged in and has permission to access the sheet,
//      if so, then show the sheet in edit mode.
//    - If no, check to see if the character is public.
//    - if so, show the public version, otherwise show an error.
include_once "config.php";
include_once "{$INCLUDE_PATH}/system.php";
include_once "{$INCLUDE_PATH}/error.php";
include_once "{$INCLUDE_PATH}/engine/sid.class.php";
include_once "{$INCLUDE_PATH}/engine/db.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
include_once "{$INCLUDE_PATH}/engine/character.class.php";
$title = 'RPG Web Profiler Error';
$error_page = 'view_error.php';
// Attempt to respawn a session.
$sid = new SId();
if ($REQUIRE_LOGIN && !$sid->IsSessionValid()) {
    draw_page('login_required.php');
    exit;
}
// Validate input.
$char = new Character((int) $_GET['id']);
if (!$char->IsValid()) {
    draw_page($error_page);
    exit;
}
if ($sid->IsSessionValid()) {
    // User is logged in, check to see if they have permission to access
    // character.
    if ($sid->HasAccessTo($char->id)) {
        draw_sheet_editable($char);
Beispiel #7
0
// cview.php
include_once "config.php";
include_once "{$INCLUDE_PATH}/engine/sid.php";
include_once "{$INCLUDE_PATH}/engine/db.php";
include_once "{$INCLUDE_PATH}/error.php";
include_once "{$INCLUDE_PATH}/engine/templates.php";
// Check to see if we need to log the user in (check this before the
// session cookie, because a new login should always override an
// existing session).
// The session object that will be used through the script.
$sid = null;
if (isset($_POST['user']) || isset($_POST['pwd'])) {
    // Login info was passed to the script.
    // Attempt to generate a new session.
    $sid = new SId(false);
    if (!$sid->SpawnSession()) {
        // Login has failed, show an error.
        $title = 'RPG Web Profiler Error';
        draw_page('login_error.php');
        exit;
    }
}
// At this point, either the user has successfully logged in, or is
// returning to the page from another page.
// Respawn the session if necessary and draw the character options (the
// session may already exist from checking _POST info).
if ($sid == null) {
    $sid = RespawnSession(__LINE__, __FILE__);
}
if (!$sid || !$sid->IsSessionValid()) {