Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 33 lines (28 sloc) 0.954 kb
26b4753 @vrana Update plugins
authored
1 <?php
2 /* Requires this table:
3 CREATE TABLE login (
4 id int NOT NULL AUTO_INCREMENT, -- optional
5 login varchar(30) NOT NULL, -- any length
6 password_sha1 char(40) NOT NULL,
7 UNIQUE (login),
8 PRIMARY KEY (id)
9 );
10 */
11
12 /** Authenticate a user from the login table
13 * @author Jakub Vrana, http://www.vrana.cz/
14 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
15 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
16 */
17 class AdminerLoginTable {
18 var $database;
19
11863ab @vrana Comment
authored
20 /** Set database of login table
21 * @param string
22 */
26b4753 @vrana Update plugins
authored
23 function AdminerLoginTable($database) {
24 $this->database = $database;
25 }
26
27 function login($login, $password) {
28 $connection = connection();
5d7a974 @vrana Typo
authored
29 return (bool) $connection->result("SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . $connection->quote($login) . " AND password_sha1 = " . $connection->quote(sha1($password)));
26b4753 @vrana Update plugins
authored
30 }
31
32 }
Something went wrong with that request. Please try again.