Hello There, Guest! Login or Register


Kick/ban log and bans in database
#18
I've revised the table structures for the ban and log tables which I already made once and pasted in this topic.

Code:
DROP TABLE IF EXISTS bans;
CREATE TABLE IF NOT EXISTS bans (
  ban_id int(4) NOT NULL AUTO_INCREMENT,
  log_id int(4) NOT NULL,
  ip_address int(4) NOT NULL,
  PRIMARY KEY (ban_id),
  KEY ip_address (ip_address),
  KEY log_id (log_id)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Code:
DROP TABLE IF EXISTS logs;
CREATE TABLE IF NOT EXISTS logs (
  log_id int(4) NOT NULL AUTO_INCREMENT,
  log_date datetime NOT NULL,
  log_type enum('warn','kick','ban','unban','note','banip') NOT NULL,
  user_id int(4) DEFAULT NULL,
  nickname varchar(24) COLLATE utf8_unicode_ci NOT NULL,
  subject_user_id int(4) DEFAULT NULL,
  subject_nickname varchar(24) COLLATE utf8_unicode_ci NOT NULL,
  description varchar(128) COLLATE utf8_unicode_ci NOT NULL,
  PRIMARY KEY (log_id)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

Are we going to support rangebans too? And if so, how? I did include a possibility for this in the bans table (ip_address_end). The idea is that the beginning of the range is stored in ip_address and the end in ip_address_end. There's ban_type to see if it's a normal ban or a rangeban (might be unneeded since you can check if ip_address_end is null). If we're going to do this, should we include namebans (and/or accountbans) too? Rangebans and nickbans are possible future improvements, as well as automatic expiration time for bans.

In the logs table, I included both the nickname and user_id for both the person doing the action (kick, ban, note, etc) as well as the person the log is for (subject_nickname and subject_user_id). This way we can link the logs easily to the user, as well as see what the nicknames were at the time (since we don't have a nickname history currently). The imported logs will not have the user ids linked since the user id cannot be accurately determined.

I think the rest is pretty self-explanatory. What do you think?


Messages In This Thread
Kick/ban log and bans in database - by MrBondt - 07-25-2011, 06:12 PM
Re: Kick/ban log and bans in database - by Kase - 02-06-2012, 08:37 AM
Re: Kick/ban log and bans in database - by MrBondt - 01-15-2013, 10:17 PM
Re: Kick/ban log and bans in database - by Jay - 01-15-2013, 11:21 PM