2011-02-09 21:15:34 +01:00
< ? 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
2015-09-08 09:23:25 -07:00
* @ link https :// www . adminer . org / plugins / #use
2017-02-27 13:43:33 +01:00
* @ author Jakub Vrana , https :// www . vrana . cz /
2018-01-14 11:03:54 +01:00
* @ license https :// www . apache . org / licenses / LICENSE - 2.0 Apache License , Version 2.0
* @ license https :// www . gnu . org / licenses / gpl - 2.0 . html GNU General Public License , version 2 ( one or other )
2011-02-09 21:15:34 +01:00
*/
class AdminerLoginTable {
2025-03-11 07:21:13 +01:00
protected $database ;
2025-02-21 13:53:18 +01:00
2025-03-28 09:13:36 +01:00
/** Set database of login table */
2025-03-28 08:23:20 +01:00
function __construct ( string $database ) {
2011-02-09 21:15:34 +01:00
$this -> database = $database ;
}
2025-02-21 13:53:18 +01:00
2011-02-09 21:15:34 +01:00
function login ( $login , $password ) {
2025-03-08 06:13:18 +01:00
return ( bool ) Adminer\get_val ( " SELECT COUNT(*) FROM " . Adminer\idf_escape ( $this -> database ) . " .login WHERE login = " . Adminer\q ( $login ) . " AND password_sha1 = " . Adminer\q ( sha1 ( $password )));
2011-02-09 21:15:34 +01:00
}
}