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

Recommended Answers

All 4 Replies

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

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?

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

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!');
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.