开发者

Single signon for phpMyAdmin

I can't get it to work. I installed phpMyAdmin and I can login without problems. But I can't get single signon working. phpMyAdmin is located at http://mydomain.com/sql/. My signon script is in http://mydomain.com/sql/scripts/signon.php. This is the content of the phpMyAdmin config:

<?php
/*
 * Generated configuration file
 * Generated by: phpMyAdmin 3.3.10 setup script by Piotr Przybylski <piotrprz@gmail.com>
 * Date: Fri, 08 Apr 2011 00:43:27 +0200
 */

/* Servers configuration */
$i = 0;

/* Server: localhost [1] */
$i++;
$cfg['Servers'][$i]['verbose'] = '';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] 开发者_运维技巧= 'mysql';
$cfg['Servers'][$i]['auth_type']     = 'signon';
$cfg['Servers'][$i]['SignonSession'] = 'PHPSESSID';
$cfg['Servers'][$i]['SignonURL']     = 'http://mydomain.com/sql/scripts/signon.php';
$cfg['Servers'][$i]['LogoutURL']     = 'http://mydomain.com/sql/scripts/logout.php';
/* End of servers configuration */

$cfg['blowfish_secret'] = '<my secret ;)>';
$cfg['DefaultLang'] = 'nl-utf-8';
$cfg['ServerDefault'] = 1;
$cfg['UploadDir'] = '';
$cfg['SaveDir'] = '';
?>

And this is my signon script:

session_start();

$_SESSION['PMA_single_signon_user'] = 'root';
$_SESSION['PMA_single_signon_password'] = '<my root password :)>';
    if (!isset($_SESSION['PMA_single_signon_token'])) {
        $_SESSION['PMA_single_signon_token'] = md5(uniqid(rand(), true));
    }
$id = session_id();

header('Location: http://mydomain.com/sql/index.php?server=1');

What am I doing wrong :(? I get the normal login screen of PMA when I execute the signon script.


You are not using same signon session name. Use

session_name('PHPSESSID');

before session_start.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜