Skip to content
Browse files

Update plugins

  • Loading branch information...
1 parent cd6d2fc commit 26b475312d9b35d3761484a6841addf5e67348b2 @vrana committed Feb 9, 2011
Showing with 36 additions and 1 deletion.
  1. +7 −1 adminer/plugin.php
  2. 0 plugins/email-html.php
  3. +29 −0 plugins/login-table.php
View
8 adminer/plugin.php
@@ -7,7 +7,13 @@ function adminer_object() {
foreach (glob("../plugins/*.php") as $filename) {
include_once $filename;
}
-
+
+ /* It is possible to combine customization and plugins:
+ class AdminerCustomization extends AdminerPlugin {
+ }
+ return new AdminerCustomization($plugins);
+ */
+
return new AdminerPlugin(array(
// specify enabled plugins here
new AdminerDumpXml,
View
0 plugins/email-html.php
No changes.
View
29 plugins/login-table.php
@@ -0,0 +1,29 @@
+<?php
+/* Requires this table:
+CREATE TABLE login (
+ id int NOT NULL AUTO_INCREMENT, -- optional
+ login varchar(30) NOT NULL, -- any length
+ password_sha1 char(40) NOT NULL,
+ UNIQUE (login),
+ PRIMARY KEY (id)
+);
+*/
+
+/** Authenticate a user from the login table
+* @author Jakub Vrana, http://www.vrana.cz/
+* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
+* @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
+*/
+class AdminerLoginTable {
+ var $database;
+
+ function AdminerLoginTable($database) {
+ $this->database = $database;
+ }
+
+ function login($login, $password) {
+ $connection = connection();
+ return (bool) $connection->result($q = "SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . $connection->quote($login) . " AND password_sha1 = " . $connection->quote(sha1($password)));
+ }
+
+}

0 comments on commit 26b4753

Please sign in to comment.
Something went wrong with that request. Please try again.