24.10.2011, 08:36
I can think of 2 methods, be real careful with where to put ` and ' or it wont work:
Method 1, you have a users table and you put a field to '1' when a player is banned:
method 2, you have a seperate table with bans:
Hope that makes sense to you. If it's not you can always PM me.
Method 1, you have a users table and you put a field to '1' when a player is banned:
pawn Код:
//To ban a user
mysql_query("UPDATE `your_users_table` SET `your_banned_field` = 1 WHERE `your_ip_field` = 'the_players_ip'");
// To unban a user
mysql_query("UPDATE `your_user_table` SET `your_banned_field` = 0 WHERE `your_ip_field` = 'the_players_ip'");
//EXAMPLE
mysql_query("UPDATE `users` SET `banned` = 0 WHERE `ip` = '127.0.0.1'");
pawn Код:
//To ban a user
mysql_query("INSERT INTO `your_banned_users_table` (`your_ip_field`) VALUES('the_players_ip')");
// To unban a user
mysql_query("DELETE FROM `your_banned_users_table` WHERE `your_ip_field` = 'the_players_ip'");
//EXAMPLE
mysql_query("DELETE FROM `bans` WHERE `ip` = '127.0.0.1'");