954,587 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Ban system

I'm trying to make a ban system for my website with the following features:


-Tell user reason for the ban
-Tell user date it'll expire
-Tell user date it was issued
-Tell user who they where banned by
-Auto perma if user has been banned a total of 3 times
-Auto expire bans

Note: I this is for a simple members system I already have up and running.

But to be honest I'm not that great at php and don't know where to start, I'm not sure how to get the bans to auto expire.

All help is greatly appreciated.

Thanks in advance.

-Tim

Tehim
Light Poster
25 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

How do you keep track of your members? Via mysql or another database? Or with plain text files? Or are they system users?

smantscheff
Nearly a Posting Virtuoso
1,233 posts since Oct 2010
Reputation Points: 300
Solved Threads: 254
 

each time user logs in check if he is banned and if yes check if ban time is expired. If yes then allow him to do thing other can do. if no redirect him to ban info page.Also when he logs in and ban time is passed, reset his ban status.
There you know what to put into database right?

evstevemd
Senior Poster
3,713 posts since Jun 2007
Reputation Points: 462
Solved Threads: 392
 

It's all in a database. And @evstevemd I don't know how to do that that's the problem.

Tehim
Light Poster
25 posts since Feb 2011
Reputation Points: 10
Solved Threads: 0
 

Put a column in your database for ban expiration. When you ban someone, put the expiration date in timestamp format. On every page, check if the banned time is higher than the current time.

// grab user data

if (time() < $ban) {
     die ('You are banned. Get Out!');
}
MagicMedia
Junior Poster
149 posts since Jul 2010
Reputation Points: 20
Solved Threads: 35
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: