bug [mysqli] non-global $cfg referenced where $GLOBAL['cfg'] expected
[phpmyadmin/tyronm.git] / scripts / signon.php
blobb538cb56fa872eb7a4a21b0366771e0d27bad0ec
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Single signon for phpMyAdmin
6 * This is just example how to use single signon with phpMyAdmin, it is
7 * not intended to be perfect code and look, only shows how you can
8 * integrate this functionality in your application.
10 * @version $Id$
11 * @package phpMyAdmin
12 * @subpackage Example
15 /* Was data posted? */
16 if (isset($_POST['user'])) {
17 /* Need to have cookie visible from parent directory */
18 session_set_cookie_params(0, '/', '', 0);
19 /* Create signon session */
20 $session_name = 'SignonSession';
21 session_name($session_name);
22 session_start();
23 /* Store there credentials */
24 $_SESSION['PMA_single_signon_user'] = $_POST['user'];
25 $_SESSION['PMA_single_signon_password'] = $_POST['password'];
26 $_SESSION['PMA_single_signon_host'] = $_POST['host'];
27 $_SESSION['PMA_single_signon_port'] = $_POST['port'];
28 $id = session_id();
29 /* Close that session */
30 session_write_close();
31 /* Redirect to phpMyAdmin (should use absolute URL here!) */
32 header('Location: ../index.php');
33 } else {
34 /* Show simple form */
35 header('Content-Type: text/html; charset=utf-8');
36 echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
38 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
39 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
40 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
41 <head>
42 <link rel="icon" href="../favicon.ico" type="image/x-icon" />
43 <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
44 <title>phpMyAdmin single signon example</title>
45 </head>
46 <body>
47 <form action="signon.php" method="post">
48 Username: <input type="text" name="user" /><br />
49 Password: <input type="password" name="password" /><br />
50 Host: (will use the one from config.inc.php by default) <input type="text" name="host" /><br />
51 Port: (will use the one from config.inc.php by default) <input type="text" name="port" /><br />
52 <input type="submit" />
53 </form>
54 </body>
55 </html>
56 <?php