Beispiel #1
0
}
/*
 * Find server and update, or insert new server
 */
$query_find_server = $db->prepare("\nSELECT\n    id,\n    status,\n    password\nFROM\n    server\nWHERE\n    game_mode_id = ?\nAND\n    name = ?\n");
$query_find_server->execute(array($game_mode->id, $_REQUEST['name']));
$session_id = openssl_random_pseudo_bytes(20);
if ($server = $query_find_server->fetch()) {
    if (!password_verify($_REQUEST['password'], $server->password)) {
        exitWithMessage('Invalid password');
    }
    if ('disabled' === $server->status) {
        exitWithMessage('Account disabled');
    }
    if ('old version' === $server->status) {
        // this shouldn't happen, the game wouldn't be found above unless the version matches
        exitWithMessage('Update required');
    }
    $query_update_server = $db->prepare("\nUPDATE\n    server\nSET\n    session = ?,\n    host = ?,\n    port = ?,\n    country_id = ?,\n    latitude = ?,\n    longitude = ?,\n    max_players = ?,\n    status = 'reconnecting',\n    updated = NOW()\nWHERE\n    id = ?\n");
    $query_update_server->execute(array($session_id, $hostname, $_REQUEST['port'], $country_id, $latitude, $longitude, $max_players, $server->id));
    $server_id = (int) $server->id;
} else {
    $query_insert_server = $db->prepare("\nINSERT INTO\n    server\n(\n    game_mode_id,\n    name,\n    host,\n    port,\n    country_id,\n    latitude,\n    longitude,\n    max_players,\n    password,\n    session\n)\nVALUES\n(\n    ?,\n    ?,\n    ?,\n    ?,\n    ?,\n    ?,\n    ?,\n    ?,\n    ?,\n    ?\n)\n");
    $query_insert_server->execute(array($game_mode->id, $_REQUEST['name'], $hostname, $_REQUEST['port'], $country_id, $latitude, $longitude, $max_players, password_hash($_REQUEST['password'], PASSWORD_DEFAULT), $session_id));
    $server_id = (int) $db->lastInsertId();
}
$result['pong_ip'] = $gsl_config['pong_ip'];
$result['pong_port'] = $gsl_config['pong_port'];
$result['session'] = current(unpack('H*', $session_id));
exitWithMessage('OK');
    if (defined('MailFrom') and validateEmail(MailFrom)) {
        $mailFrom = MailFrom;
    } elseif (!empty($message['from_email']) and validateEmail($message['from_email'])) {
        $mailFrom = $message['from_email'];
    }
    if (empty($mailFrom)) {
        exitWithMessage('Empty or invalid email sender');
    }
    // Remove html (if needed)
    if (defined('RemoveHTML') and RemoveHTML) {
        $message['subject'] = secureClear($message['subject']);
        $message['html'] = str_replace(array('<strong>', '</strong>', '<b>', '</b>'), '##', $message['html']);
        $message['html'] = secureClear($message['html']);
    }
    // Check subject
    if (empty($message['subject'])) {
        exitWithMessage('Empty subject');
    }
    // Check mail body
    if (empty($message['html'])) {
        exitWithMessage('Empty or invalid mail body');
    }
    // Prepare sendmail headers
    $headers = "MIME-Version: 1.0\r\n" . "Content-Type: text/" . ((defined('RemoveHTML') and RemoveHTML) ? "plain" : "html") . "; charset=\"utf-8\"\r\n";
    $headers .= "From: " . $mailFrom . "\r\n" . "Reply-To: " . $mailFrom . "\r\n" . "Return-Path: " . $mailFrom . "\r\n";
    // And sending mail
    if (!mail($mailTo, '=?UTF-8?B?' . base64_encode($message['subject']) . '?=', $message['html'], $headers)) {
        exitWithMessage('Sendmail server error :(');
    }
    exitWithMessage('Your message was sent successfully', 1);
}
    $msg = !$Proj->longitudinal ? "Not a longitudinal project" : "You do not have permission to access this page.";
    include APP_PATH_DOCROOT . 'ProjectGeneral/header.php';
    print RCView::div(array('style' => 'max-width:750px;margin-bottom:10px;'), RCView::div(array('style' => 'color: #800000;font-size: 16px;font-weight: bold;float:left;'), "Longitudinal Reports") . RCView::div(array('class' => 'clear'), ''));
    displayMsg($msg, "errorMsg", "center", "red", "exclamation_frame.png", 600);
    include APP_PATH_DOCROOT . 'ProjectGeneral/footer.php';
    exit;
}
// Make sure the user's rights have not expired for the project
if ($user_rights['expiration'] != "" && $user_rights['expiration'] < TODAY) {
    exitWithMessage('Your user account has expired for this project.');
    exit;
}
// Check configuration of report store project
$check = LongitudinalReports::checkReportStoreProjectConfig();
if ($check !== true) {
    exitWithMessage('There is a problem with the configuration of the report store project:<br>' . $check);
    exit;
}
// Place all HTML here
$html = "";
## CREATE NEW REPORT
if (isset($_GET['addedit'])) {
    // Hidden dialog for help with filters and AND/OR logic
    $html .= LongitudinalReports::renderFilterHelpDialog();
    // Hidden dialog for error popup when field name entered is not valid
    $html .= RCView::div(array('id' => 'VarEnteredNoExist_dialog', 'class' => 'simpleDialog'), $lang['report_builder_72']);
    // Add the actual "create report" table's HTML at the very bottom since we're doing a direct print. So output the buffer and disable buffering.
    ob_end_flush();
} elseif (!isset($_GET['report_id'])) {
    $html .= RCView::p(array('style' => 'max-width:810px;margin:5px 0 15px;'), $lang['report_builder_117']) . RCView::div(array('id' => 'report_list_parent_div'), LongitudinalReports::renderReportList());
} elseif (isset($_GET['report_id']) && (is_numeric($_GET['report_id']) || in_array($_GET['report_id'], array('ALL', 'SELECTED')))) {