Fix for 3299241. Updated style for "disabled" topnav buttons.
[phpmyadmin/ammaryasirr.git] / scripts / signon.php
blobacb5f7d07ad6711643da1ed45f64c8d94ebbadcf
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 * @package phpMyAdmin
11 * @subpackage Example
14 /* Was data posted? */
15 if (isset($_POST['user'])) {
16 /* Need to have cookie visible from parent directory */
17 session_set_cookie_params(0, '/', '', 0);
18 /* Create signon session */
19 $session_name = 'SignonSession';
20 session_name($session_name);
21 session_start();
22 /* Store there credentials */
23 $_SESSION['PMA_single_signon_user'] = $_POST['user'];
24 $_SESSION['PMA_single_signon_password'] = $_POST['password'];
25 $_SESSION['PMA_single_signon_host'] = $_POST['host'];
26 $_SESSION['PMA_single_signon_port'] = $_POST['port'];
27 /* Update another field of server configuration */
28 $_SESSION['PMA_single_signon_cfgupdate'] = array('verbose' => 'Signon test');
29 $id = session_id();
30 /* Close that session */
31 session_write_close();
32 /* Redirect to phpMyAdmin (should use absolute URL here!) */
33 header('Location: ../index.php');
34 } else {
35 /* Show simple form */
36 header('Content-Type: text/html; charset=utf-8');
37 echo '<?xml version="1.0" encoding="utf-8"?>' . "\n";
39 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
40 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
41 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
42 <head>
43 <link rel="icon" href="../favicon.ico" type="image/x-icon" />
44 <link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
45 <title>phpMyAdmin single signon example</title>
46 </head>
47 <body>
48 <?php
49 if (isset($_SESSION['PMA_single_signon_error_message'])) {
50 echo '<p class="error">' . $_SESSION['PMA_single_signon_message'] . '</p>';
53 <form action="signon.php" method="post">
54 Username: <input type="text" name="user" /><br />
55 Password: <input type="password" name="password" /><br />
56 Host: (will use the one from config.inc.php by default) <input type="text" name="host" /><br />
57 Port: (will use the one from config.inc.php by default) <input type="text" name="port" /><br />
58 <input type="submit" />
59 </form>
60 </body>
61 </html>
62 <?php