master
Gnieark 5 years ago
parent f0c36e7b57
commit 7563709c76

@ -7,7 +7,7 @@ class User_Manager
private static $table_groups = 'groups';
const CREATE_TABLE_USERS_QUERY = "
const QUERY_CREATE_TABLE_USERS = "
CREATE TABLE %table_users% (
`id` int(11) NOT NULL AUTO_INCREMENT,
`login` varchar(16) NOT NULL,
@ -27,7 +27,7 @@ class User_Manager
VALUES (0,'','SYSTEM','none',0, NOW(),0);
";
const CREATE_TABLE_GROUPS = "
const QUERY_CREATE_TABLE_GROUPS = "
CREATE TABLE %table_groups% (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` text NOT NULL,
@ -40,6 +40,18 @@ class User_Manager
);
";
const QUERY_CREATE_REL_USERS_GROUPS = "
CREATE TABLE `%table_users%_%table_groups%_rel` (
`user_id` int(11) NOT NULL,
`group_id` int(11) NOT NULL,
PRIMARY KEY (`user_id`,`group_id`),
KEY `users_id` (`user_id`),
KEY `group_id` (`group_id`),
CONSTRAINT `%table_users%_%table_groups%_rel_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `%table_users%` (`id`),
CONSTRAINT `%table_users%_%table_groups%_rel_ibfk_2` FOREIGN KEY (`group_id`) REFERENCES `%table_groups%` (`id`)
);
";
public function authentificate($db,$login, $password){

Loading…
Cancel
Save