Пример #1
0
$user_id = $_SESSION['user_id'];
$alpha = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l');
$project_id = $activeProject['project_id'];
if (empty($activeProject)) {
    //redirects if there's no active project for the user (if they've not created one)
    header("Location: new_project.php");
    exit;
}
if ($project_id == 0) {
    //redirects if there's no active project for the user (if they've not created one)
    echo "<script>parent.jQuery.colorbox.close(); parent.location.reload();</script>";
    exit;
}
$character_id = @$_GET['character'];
$character_data = get_character_data($project_id, $character_id);
$characters = get_project_characters($project_id);
$factions = get_project_factions($project_id);
$projects = get_project_list();
if (empty($character_data)) {
    if (empty($factions)) {
        echo "Invalid character id!<script>parent.jQuery.colorbox.close(); parent.location.reload();</script>";
        exit;
    }
    unset($character_id);
    foreach ($factions as $faction) {
        if (!$faction['deleted']) {
            foreach ($characters[$faction['faction_num']] as $character) {
                if (!$character['deleted']) {
                    $character_id = $character['character_id'];
                    header("Location: character_card.php?character=" . $character_id);
                    exit;
Пример #2
0
include 'core/init.php';
include 'includes/check_connect.php';
protect_page();
$project_id = $activeProject['project_id'];
if ($project_id == 0) {
    //redirects if there's no active project for the user (if they've not created one)
    header("Location: new_project.php");
    exit;
}
if (isset($_POST['restore_character'])) {
    $character_id = (int) $_POST['restore_character'];
    mysql_query("UPDATE `characters` SET `deleted` = 0 WHERE `character_id` = " . $character_id);
}
$factions = get_project_factions($project_id);
$character_data = get_project_characters($project_id);
$deleted_characters = array();
$deleted_factions = array();
foreach ($character_data as $faction_num => $faction) {
    if (isset($factions[$faction_num]) && $factions[$faction_num]['deleted']) {
        $deleted_factions[$faction_num] = $faction;
        unset($character_data[$faction_num]);
        continue;
    }
    foreach ($faction as $key => $character) {
        if ($character['deleted']) {
            $deleted_characters[$faction_num][$key] = $character;
            unset($character_data[$faction_num][$key]);
        }
    }
}