

CREATE TABLE `AuthAttempts` (
  `attemptId` int(11) NOT NULL AUTO_INCREMENT,
  `attemptIp` varchar(39) NOT NULL,
  `attemptExpireDate` datetime NOT NULL,
  PRIMARY KEY (`attemptId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `AuthConfig` (
  `configSetting` varchar(100) NOT NULL,
  `configValue` varchar(100) DEFAULT NULL,
  UNIQUE KEY `vSetting` (`configSetting`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `AuthConfig` (`configSetting`, `configValue`) VALUES
('attack_mitigation_time',  '+30 minutes'),
('attempts_before_ban', '30'),
('attempts_before_verify',  '5'),
('bcrypt_cost', '10'),
('cookie_domain', NULL),
('cookie_forget', '+30 minutes'),
('cookie_http', '0'),
('cookie_name', 'PlexMxTvAuthID'),
('cookie_path', '/'),
('cookie_remember', '+1 month'),
('cookie_secure', '0'),
('emailmessage_suppress_activation',  '0'),
('emailmessage_suppress_reset', '0'),
('mail_charset','UTF-8'),
('password_min_score',  '3'),
('site_activation_page',  'activate'),
('site_email',  'no-reply@phpauth.cuonic.com'),
('site_key',  'fghuior.)/!/jdUkd8s2!7HVHG7777ghg'),
('site_name', 'PHPAuth'),
('site_password_reset_page',  'reset'),
('site_timezone', 'Europe/Paris'),
('site_url',  'https://github.com/PHPAuth/PHPAuth'),
('smtp',  '0'),
('smtp_auth', '1'),
('smtp_host', 'smtp.example.com'),
('smtp_password', 'password'),
('smtp_port', '25'),
('smtp_security', NULL),
('smtp_username', 'email@example.com'),
('table_attempts',  'AuthAttempts'),
('table_requests',  'AuthRequests'),
('table_sessions',  'AuthSessions'),
('table_users', 'AuthUsers'),
('verify_email_max_length', '100'),
('verify_email_min_length', '5'),
('verify_email_use_banlist',  '0'),
('verify_password_min_length',  '3'),
('request_key_expiration', '+10 minutes');

CREATE TABLE `AuthRequests` (
  `requestId` int(11) NOT NULL AUTO_INCREMENT,
  `requestUserId` int(11) NOT NULL,
  `requestRkey` varchar(20) NOT NULL,
  `requestExpireDate` datetime NOT NULL,
  `requestType` varchar(20) NOT NULL,
  PRIMARY KEY (`requestId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `AuthSessions` (
  `sessionId` int(11) NOT NULL AUTO_INCREMENT,
  `sessionUserId` int(11) NOT NULL,
  `sessionHash` varchar(40) NOT NULL,
  `sessionExpireDate` datetime NOT NULL,
  `sessionIp` varchar(39) NOT NULL,
  `sessionAgent` varchar(200) NOT NULL,
  `sessionCookie_crc` varchar(40) NOT NULL,
  PRIMARY KEY (`sessionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `AuthRoles` (
  `roleId` int(11) NOT NULL AUTO_INCREMENT,
  `roleDescription` varchar(100) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`roleId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `AuthUsers` (
  `userId` int(11) NOT NULL AUTO_INCREMENT,
  `user` varchar(60) DEFAULT NULL,
  `userName` varchar(100) DEFAULT NULL,
  `userEmail` varchar(100) DEFAULT NULL,
  `userPassword` varchar(100) DEFAULT NULL,
  `userIsActive` tinyint(1) NOT NULL DEFAULT '0',
  `userCreteTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `userRoleId` int(11),
  PRIMARY KEY (`userId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `AuthPermissions` (
  `permisionId` int(11) NOT NULL AUTO_INCREMENT,
  `permissionDescription` varchar(100) DEFAULT NULL,
  `isActive` tinyint(1) NOT NULL DEFAULT '0',
   PRIMARY KEY (`permisionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;


CREATE TABLE `AuthRelRolPermission` (
   `roleId` int(11) NOT NULL,
   `permissionId` int(11) NOT NULL,
    PRIMARY KEY (`roleId`,`permissionId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;




-- 2015-11-06 14:09:37
