Changeset 17 for trunk/lib/Auth_SQL.inc.php
- Timestamp:
- Nov 14, 2005 4:22:37 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Auth_SQL.inc.php
r16 r17 175 175 } 176 176 177 // Login table. 178 if ($recreate_db) { 179 DB::query("DROP TABLE IF EXISTS " . $this->getParam('db_login_table')); 180 App::logMsg(sprintf('Dropping and recreating table %s.', $this->getParam('db_login_table')), LOG_DEBUG, __FILE__, __LINE__); 181 } 182 DB::query("CREATE TABLE IF NOT EXISTS " . $this->getParam('db_login_table') . " ( 183 " . $this->getParam('db_primary_key') . " smallint(11) NOT NULL default '0', 184 login_datetime datetime NOT NULL default '0000-00-00 00:00:00', 185 remote_ip_binary char(32) NOT NULL default '', 186 KEY " . $this->getParam('db_primary_key') . " (" . $this->getParam('db_primary_key') . "), 187 KEY login_datetime (login_datetime), 188 KEY remote_ip_binary (remote_ip_binary) 189 )"); 190 191 if (!DB::columnExists($this->getParam('db_login_table'), array( 192 $this->getParam('db_primary_key'), 193 'login_datetime', 194 'remote_ip_binary', 195 ), false, false)) { 196 App::logMsg(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_login_table')), LOG_ALERT, __FILE__, __LINE__); 197 trigger_error(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_login_table')), E_USER_ERROR); 177 // Login table is used for abuse_detection features. 178 if ($this->getParam('abuse_detection')) { 179 if ($recreate_db) { 180 DB::query("DROP TABLE IF EXISTS " . $this->getParam('db_login_table')); 181 App::logMsg(sprintf('Dropping and recreating table %s.', $this->getParam('db_login_table')), LOG_DEBUG, __FILE__, __LINE__); 182 } 183 DB::query("CREATE TABLE IF NOT EXISTS " . $this->getParam('db_login_table') . " ( 184 " . $this->getParam('db_primary_key') . " smallint(11) NOT NULL default '0', 185 login_datetime datetime NOT NULL default '0000-00-00 00:00:00', 186 remote_ip_binary char(32) NOT NULL default '', 187 KEY " . $this->getParam('db_primary_key') . " (" . $this->getParam('db_primary_key') . "), 188 KEY login_datetime (login_datetime), 189 KEY remote_ip_binary (remote_ip_binary) 190 )"); 191 192 if (!DB::columnExists($this->getParam('db_login_table'), array( 193 $this->getParam('db_primary_key'), 194 'login_datetime', 195 'remote_ip_binary', 196 ), false, false)) { 197 App::logMsg(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_login_table')), LOG_ALERT, __FILE__, __LINE__); 198 trigger_error(sprintf('Database table %s has invalid columns. Please update this table manually.', $this->getParam('db_login_table')), E_USER_ERROR); 199 } 198 200 } 199 201 }
Note: See TracChangeset
for help on using the changeset viewer.