Unban IP command
#5

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:
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'");
method 2, you have a seperate table with bans:
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'");
Hope that makes sense to you. If it's not you can always PM me.
Reply


Messages In This Thread
Unban IP command - by Luis- - 23.10.2011, 22:34
Re: Unban IP command - by AeroBlast - 24.10.2011, 05:48
Re: Unban IP command - by [MWR]Blood - 24.10.2011, 07:18
Re: Unban IP command - by 0x80808000 - 24.10.2011, 08:03
Re: Unban IP command - by Sinner - 24.10.2011, 08:36
Re: Unban IP command - by GAMER_PS2 - 24.10.2011, 08:58

Forum Jump:


Users browsing this thread: 2 Guest(s)