Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 08-03-2005, 06:09 PM   #1
Chop Chop
 
catacon's Avatar
 
Join Date: Jan 2005
Location: St. Louis, MO
Posts: 1,035
Send a message via AIM to catacon Send a message via Yahoo to catacon
Question User Banning

I'm not sure if this is allowed, so if it isn't please delete it.

I am starting a site up and thought that from time to time, a user might get out of hand and need to be banned (I'm a poet and I don't even know it), as they do here. I found this script:

PHP Code:
0
<?php
1
$banned_ip 
= array();
2
$banned_ip
[] = '111.111.111.111';
3
$banned_ip
[] = '111.111.111.112';
4
$banned_ip
[] = '111.111.111.113';
5
$banned_ip
[] = '111.111.111.114';
6

7
foreach($banned_ip as $banned) {
8
    $ip 
$_SERVER['REMOTE_ADDR'];
9
    
if($ip == $banned){
10
        
echo "You have been banned!";
11
        
exit();
12
    
}
13
}
14
// rest of PHP Script here!
15
?>
You have to enter the users IP address to ban them. How do I find out what their IP address is so I can ban them?

This is all legit, I just want to have a clean site. I am not trying to do any bad from this.

Thanks
catacon is offline   Reply With Quote
Old 08-04-2005, 02:54 AM   #2
Gremlin Overlord
 
Jaggannath's Avatar
 
Join Date: Apr 2003
Location: Australia
Posts: 2,382
Usually when they post you can find their ip address from what it leaves. I can't remember how I used to do it, but when I made a forum with a few friends it used to automatically add their ip address to the bottom of the message, so that even though people could change their names we could tell who was posting by the ip
Jaggannath is offline   Reply With Quote
Old 08-04-2005, 03:46 AM   #3
Member (7 bit)
 
Join Date: Jul 2005
Location: Birmingham, England
Posts: 101
Send a message via MSN to Auriga
Do you want hem banned from the entire site? Or just a discussion forum.

If it's a discussion forum then running something like phpBB or vBulletin has a feature to enable you to do that.
Auriga is offline   Reply With Quote
Old 08-04-2005, 07:22 AM   #4
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Entering their IP address does not work well. IP addresses change every time on dialup and periodically on broadband. Also wouldn't prevent them from using another connection. Most of the forums allow you to ban a user or a range of IP addresses. Occasionally you will ban a user and he will register under a different name. Then your options are to ban by IP addresses and/or turn off registration.
__________________

Want to Make $$$$ with your Computer? No Risk! Simply press shift-4 four times in a row
mairving is offline   Reply With Quote
Old 08-04-2005, 08:57 AM   #5
Chop Chop
 
catacon's Avatar
 
Join Date: Jan 2005
Location: St. Louis, MO
Posts: 1,035
Send a message via AIM to catacon Send a message via Yahoo to catacon
OK. Is there any way to have a column in the database called banned or something and then if they try to login, it will not let them due to that?
catacon is offline   Reply With Quote
Old 08-04-2005, 09:21 AM   #6
Staff
Premium Member
 
mairving's Avatar
 
Join Date: Jul 1999
Location: Arlington, TN
Posts: 5,538
Quote:
Originally Posted by catacon
OK. Is there any way to have a column in the database called banned or something and then if they try to login, it will not let them due to that?
Sure. You could make it a Enum field (0,1) and default it to 0. 1 would indicate a banned user.
mairving is offline   Reply With Quote
Old 08-04-2005, 03:19 PM   #7
Chop Chop
 
catacon's Avatar
 
Join Date: Jan 2005
Location: St. Louis, MO
Posts: 1,035
Send a message via AIM to catacon Send a message via Yahoo to catacon
Ok, thanks. That's easy!
catacon is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:54 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2