<?php

/* Need to have cookie visible from parent directory */
session_set_cookie_params(0, '/', '', true, true);
/* Create signon session */
$session_name = 'SignonSession';
session_name($session_name);
// Uncomment and change the following line to match your $cfg['SessionSavePath']
// session_save_path('');
@session_start();

/* Was data posted? */
if (isset($_POST['pma_username']) && isset($_POST['pma_password'])) { 

    // Get Credentials from $_POST Data

    /* Store there credentials */
    $_SESSION['PMA_single_signon_user'] = $_POST['pma_username'];
    $_SESSION['PMA_single_signon_password'] = $_POST['pma_password'];
    /* Update another field of server configuration */
    //$_SESSION['PMA_single_signon_cfgupdate'] = array('verbose' => 'Signon test');
    $id = session_id();
    /* Close that session */
    @session_write_close();

    setcookie($session_name, $id , 0, "/");

    /* Redirect to phpMyAdmin (should use absolute URL here!) */
    header('Location: ./index.php');

     // echo 'DONE';
} else {
    header('Location: ../index.php');
}