Ska Posted May 22, 2010 Share Posted May 22, 2010 I am writing a simple private message system, but I am a bit stumped about this part. The message part is easy as pie. Users are based on their IDs, so say we have 5 users - 1 2 3 4 and 5. How would I set up a table for a banlist? The only way I could think of doing it (and there must be a simplier way) is having a table that is as wide as it is long full of true or false (yes/no). ... 1 . 2 . 3 . 4 . 5 1. F . T . F . F . T 2. F . F . F . F . F 3. T . T . F . F . T 4. F . F . F . F . F 5. F . F . T . F . F So 1 has blocked 2. 2 has blocked no one. 3 has blocked 1 2 and 5. 3 has no blocked anyone. 5 has blocked 3. But this could very easily become millions/trillions of entries. Is there another way to do this? Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/202580-allowing-users-to-block-each-other/ Share on other sites More sharing options...
Mchl Posted May 22, 2010 Share Posted May 22, 2010 How about table like this? table user_bans user_id, banned_user_id ---------------- 1,2 1,5 3,1 3,2 3,5 5,3 Quote Link to comment https://forums.phpfreaks.com/topic/202580-allowing-users-to-block-each-other/#findComment-1061961 Share on other sites More sharing options...
ignace Posted May 22, 2010 Share Posted May 22, 2010 How about table like this? table user_bans user_id, banned_user_id ---------------- 1,2 1,5 3,1 3,2 3,5 5,3 Continuing on this, I would extend it's functionality a little further and define the relationship status between 2 users (friends, lovers, haters, ..). Although you may not need the functionality now, it may well in the future. Quote Link to comment https://forums.phpfreaks.com/topic/202580-allowing-users-to-block-each-other/#findComment-1061980 Share on other sites More sharing options...
Ska Posted May 23, 2010 Author Share Posted May 23, 2010 Yeah, thanks for that I actually thought about that just before I fell asleep last night, having a ban table with; blockid, blockerid, blockedid, date, dateunblocked, active, reason This way, people can remove the ban (ie - active no) but it stays in the table so that mods can view the history. Don't know why my brain went into a spasm and couldn't think of this yesterday, too much coding, not enough sex. Thanks again Quote Link to comment https://forums.phpfreaks.com/topic/202580-allowing-users-to-block-each-other/#findComment-1062108 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.