Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 35 lines (30 sloc) 0.99 kb
26b4753 Jakub Vrána 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
091a4d0 Jakub Vrána Link to documentation
authored
13 * @link http://www.adminer.org/plugins/#use
26b4753 Jakub Vrána Update plugins
authored
14 * @author Jakub Vrana, http://www.vrana.cz/
15 * @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
16 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU General Public License, version 2 (one or other)
17 */
18 class AdminerLoginTable {
7578342 Jakub Vrána Comment
authored
19 /** @access protected */
26b4753 Jakub Vrána Update plugins
authored
20 var $database;
21
11863ab Jakub Vrána Comment
authored
22 /** Set database of login table
23 * @param string
24 */
26b4753 Jakub Vrána Update plugins
authored
25 function AdminerLoginTable($database) {
26 $this->database = $database;
27 }
28
29 function login($login, $password) {
30 $connection = connection();
fa32682 Jakub Vrána Use shortcut
authored
31 return (bool) $connection->result("SELECT COUNT(*) FROM " . idf_escape($this->database) . ".login WHERE login = " . q($login) . " AND password_sha1 = " . q(sha1($password)));
26b4753 Jakub Vrána Update plugins
authored
32 }
33
34 }
Something went wrong with that request. Please try again.