Files
CyberPanel/plogical/phpmyadminsignin.php

60 lines
2.0 KiB
PHP
Raw Normal View History

2020-08-09 12:45:18 +05:00
<?php
define("PMA_SIGNON_INDEX", 1);
try {
define('PMA_SIGNON_SESSIONNAME', 'SignonSession');
define('PMA_DISABLE_SSL_PEER_VALIDATION', TRUE);
2020-08-09 12:45:18 +05:00
if (isset($_POST['token'])) {
2020-08-09 12:45:18 +05:00
### Get credentials using the token
2020-08-09 12:45:18 +05:00
$token = $_POST['token'];
$username = $_POST['username'];
2020-08-09 12:45:18 +05:00
//$url = "/dataBases/fetchDetailsPHPMYAdmin?token=" . $token . '&username=' . $username;
$url = "/dataBases/fetchDetailsPHPMYAdmin";
2020-08-09 12:45:18 +05:00
// header('Location: ' . $url);
2020-08-09 12:45:18 +05:00
// Redirect with POST data
2020-08-09 12:45:18 +05:00
echo '<form id="redirectForm" action="' . $url . '" method="post">';
echo '<input type="hidden" value="' . $token . '" name="token">';
echo '<input type="hidden" value="' . $username . '" name="username">';
echo '</form>';
echo '<script>document.getElementById("redirectForm").submit();</script>';
2020-08-09 12:45:18 +05:00
} else if (isset($_POST['logout'])) {
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 86400, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
session_destroy();
header('Location: /base/');
return;
} else if (isset($_POST['password'])) {
2020-08-09 12:45:18 +05:00
session_name(PMA_SIGNON_SESSIONNAME);
@session_start();
2020-08-09 12:45:18 +05:00
$username = $_POST['username'];
$password = $_POST['password'];
2020-08-09 12:45:18 +05:00
$_SESSION['PMA_single_signon_user'] = $username;
$_SESSION['PMA_single_signon_password'] = $password;
$_SESSION['PMA_single_signon_host'] = 'localhost';
2020-08-09 12:45:18 +05:00
@session_write_close();
2020-08-09 12:45:18 +05:00
header('Location: /phpmyadmin/index.php?server=' . PMA_SIGNON_INDEX);
}
} catch (Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
$params = session_get_cookie_params();
setcookie(session_name(), '', time() - 86400, $params["path"], $params["domain"], $params["secure"], $params["httponly"]);
session_destroy();
header('Location: /dataBases/phpMyAdmin');
return;
}