Example #1
0
  <p><?php 
    echo $msg;
    ?>
</p>
</body>
</html>
<?php 
    exit;
}
$token = dp_get_token_from_params();
if (!$token) {
    show_error('Authentication token missing');
}
$vhost = dp_derive_gen_vhost();
$app = 'phpmyadmin';
if (!dp_has_valid_token($vhost, $app, $token)) {
    show_error('Invalid token');
}
/* Need to have cookie visible from parent directory */
session_set_cookie_params(0, dirname($_SERVER['REQUEST_URI']) . '/', '', 0);
session_name('DPSignonSession');
session_start();
$user_info = posix_getpwuid(posix_geteuid());
$mysql_ini = sprintf("%s/.my.cnf", $user_info["dir"]);
if (!file_exists($mysql_ini)) {
    show_error('missing ~/.my.cnf on the target vhost');
}
$mysql_info = parse_ini_file($mysql_ini);
$_SESSION['PMA_single_signon_user'] = $mysql_info['user'];
$_SESSION['PMA_single_signon_password'] = $mysql_info['password'];
$_SESSION['PMA_single_signon_host'] = $mysql_info['host'];
Example #2
0
<?php

$curr_path = dirname(__FILE__);
require_once $curr_path . "/../../../../lib/php/webapp_token_access.inc.php";
$extplorer_dir = sprintf("%s/../extplorer/current", $curr_path);
$app_name = "extplorer";
session_name($app_name);
$vhost = dp_derive_gen_vhost();
$is_logged_in = dp_is_already_logged_to_app($app_name);
if (!$is_logged_in && !($token = dp_get_app_token_from_url())) {
    echo "Access denied. Unable to verify app token.\n";
    exit(1);
} else {
    if (!$is_logged_in && dp_has_valid_token($vhost, $app_name, $token)) {
        dp_start_app_session($vhost, $app_name, $token);
        header('Location: ' . str_replace("/{$token}", "", $_SERVER['SCRIPT_URI']) . '/index.php');
        exit;
    } else {
        if ($is_logged_in && dp_get_app_token_from_url()) {
            $file = 'index.php';
        }
    }
}
$file = isset($file) ? $file : basename($_SERVER['PATH_INFO']);
if ($file == '') {
    header('Location: ' . str_replace("/{$token}", "", $_SERVER['SCRIPT_URI']) . '/index.php');
    exit;
}
if ($file == 'index.php') {
    if (isset($_GET['action']) && $_GET['action'] == 'logout') {
        setcookie('we_logout');
Example #3
0
<?php

$curr_path = dirname(__FILE__);
require_once $curr_path . "/../../../../lib/php/webapp_token_access.inc.php";
$app_name = "phpmyadmin";
session_name("devpanel_{$app_name}");
$vhost = dp_derive_gen_vhost();
$is_logged_in = dp_is_already_logged_to_app($app_name);
if (!$is_logged_in) {
    if (($token = dp_get_app_token_from_url()) && dp_has_valid_token($vhost, $app_name, $token)) {
        dp_start_app_session($vhost, $app_name, $token);
        header('Location: ' . str_replace("/{$token}", "/", $_SERVER['SCRIPT_URI']) . '/index.php');
        exit(0);
    } else {
        echo "Access denied. Unable to verify app token.\n";
        exit(1);
    }
}
if (isset($_SERVER["PATH_INFO"])) {
    if ($_SERVER["PATH_INFO"] == "/" . $_SESSION["token"]) {
        $file = "index.php";
    } else {
        $file = $_SERVER["PATH_INFO"];
    }
} else {
    header('Location: ' . str_replace("/{$token}", "/", $_SERVER['SCRIPT_URI']) . '/index.php');
    exit;
}
$file_path = sprintf("%s/../%s/current/%s", dirname(__FILE__), $app_name, $file);
$_SERVER["PATH_INFO"] = $_SERVER["SCRIPT_NAME"];
$_SERVER["SCRIPT_NAME"] = $file;