]> git.joonet.de Git - adminer.git/commitdiff
Logout
authorjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 2 Jul 2007 15:52:29 +0000 (15:52 +0000)
committerjakubvrana <jakubvrana@7c3ca157-0c34-0410-bff1-cbf682f78f5c>
Mon, 2 Jul 2007 15:52:29 +0000 (15:52 +0000)
git-svn-id: https://adminer.svn.sourceforge.net/svnroot/adminer/trunk@11 7c3ca157-0c34-0410-bff1-cbf682f78f5c

auth.inc.php
design.inc.php
edit.inc.php
index.php

index 70069b942cda7f0429149113d703ccb417a664d8..66f1857d6fad3e732a4f16437cf773ff5809a314 100644 (file)
@@ -2,16 +2,21 @@
 if (isset($_POST["server"])) {
        $_SESSION["username"] = $_POST["username"];
        $_SESSION["password"] = $_POST["password"];
-       header("Location: " . ($_GET["server"] == $_POST["server"] ? $_SERVER["REQUEST_URI"] : preg_replace('~^[^?]*/([^?]*).*~', '\\1' . (strlen($_POST["server"]) ? '?server=' . urlencode($_POST["server"]) : '') . (SID ? (strlen($_POST["server"]) ? "&" : "?") . SID : ""), $_SERVER["REQUEST_URI"])));
+       header("Location: " . ((string) $_GET["server"] === $_POST["server"] ? preg_replace('~(\\?)logout=&|[?&]logout=~', '\\1', $_SERVER["REQUEST_URI"]) : preg_replace('~^[^?]*/([^?]*).*~', '\\1' . (strlen($_POST["server"]) ? '?server=' . urlencode($_POST["server"]) : '') . (SID ? (strlen($_POST["server"]) ? "&" : "?") . SID : ""), $_SERVER["REQUEST_URI"])));
        exit;
+} elseif (isset($_GET["logout"])) {
+       unset($_SESSION["username"]);
+       unset($_SESSION["password"]);
 }
 
-if (!@mysql_connect($_GET["server"], $_SESSION["username"], $_SESSION["password"])) {
+if (isset($_GET["logout"]) || !@mysql_connect($_GET["server"], $_SESSION["username"], $_SESSION["password"])) {
        page_header(lang('Login'), "auth");
        ?>
        <h1><?php echo lang('phpMinAdmin'); ?></h1>
        <?php
-       if (isset($_GET["server"])) {
+       if (isset($_GET["logout"])) {
+               echo "<p class='message'>" . lang('Logout successful.') . "</p>\n";
+       } elseif (isset($_GET["server"])) {
                echo "<p class='error'>" . lang('Invalid credentials.') . "</p>\n";
        }
        ?>
index 2ce9e0f61e96a9ed3d19652bf3963c6e1e5cafc1..c1ce957d0e408579d2dca3b1b3b271c53166210f 100644 (file)
@@ -32,11 +32,12 @@ H2 { font-size: 150%; margin-top: 0; }
 <p>
 <a href="<?php echo htmlspecialchars($SELF); ?>sql="><?php echo lang('SQL command'); ?></a>
 <a href="<?php echo htmlspecialchars($SELF); ?>dump="><?php echo lang('Dump'); ?></a>
+<a href="<?php echo htmlspecialchars($SELF); ?>logout="><?php echo lang('Logout'); ?></a>
 </p>
 <form action="" method="get">
 <p><select name="db" onchange="this.form.submit();"><option value="">(<?php echo lang('database'); ?>)</option>
 <?php
-               //! logout, create database
+               //! create database
                $result = mysql_query("SHOW DATABASES");
                while ($row = mysql_fetch_row($result)) {
                        echo "<option" . ($row[0] == $_GET["db"] ? " selected='selected'" : "") . ">" . htmlspecialchars($row[0]) . "</option>\n";
@@ -54,7 +55,7 @@ H2 { font-size: 150%; margin-top: 0; }
                        } else {
                                echo "<p>\n";
                                while ($row = mysql_fetch_row($result)) {
-                                       echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row[0]) . '">' . lang('select') . '</a> '; //! inline image through style
+                                       echo '<a href="' . htmlspecialchars($SELF) . 'select=' . urlencode($row[0]) . '">' . lang('select') . '</a> ';
                                        echo '<a href="' . htmlspecialchars($SELF) . 'table=' . urlencode($row[0]) . '">' . htmlspecialchars($row[0]) . "</a><br />\n"; //! views
                                }
                                echo "</p>\n";
index eb592cbf42f6f56f4be54ccd3458a85eabcacbd2..fdf83a1237addeb5bea4a27481f97eb4bb6e204f 100644 (file)
@@ -27,7 +27,7 @@ if ($_POST) {
                }
        }
        if (mysql_query($query)) {
-               $_SESSION["message"] = $message; //! warnings
+               $_SESSION["message"] = $message;
                header("Location: " . $SELF . "select=" . urlencode($_GET["edit"]) . (SID ? "&" . SID : ""));
                exit;
        }
index e5c64bff38770def17ae8b3913d812e628c8baae..7e29592eb21ccd193b9a7bdc8d79a9781c9c3aaf 100644 (file)
--- a/index.php
+++ b/index.php
@@ -23,6 +23,7 @@ if (isset($_GET["sql"])) {
        include "./view.inc.php";
 } else {
        page_header(htmlspecialchars($_GET["db"]));
+       //! alter and drop database
        $result = mysql_query("SELECT * FROM information_schema.ROUTINES WHERE ROUTINE_SCHEMA = '" . mysql_real_escape_string($_GET["db"]) . "'");
        if (mysql_num_rows($result)) {
                echo "<h2>" . lang('Routines') . "</h2>\n";
@@ -33,7 +34,7 @@ if (isset($_GET["sql"])) {
                        echo "<th>" . htmlspecialchars($row["ROUTINE_NAME"]) . "</th>"; //! parameters from SHOW CREATE {PROCEDURE|FUNCTION}
                        echo "<td>" . nl2br(htmlspecialchars($row["ROUTINE_DEFINITION"])) . "</td>";
                        echo "</tr>\n";
-                       //! drop
+                       //! call, drop, replace
                }
                echo "</table>\n";
        }