|
-
Dec 4th, 2008, 05:18 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] ipban
i need a code to ipban people from my site, does anyone know how?
-
Dec 5th, 2008, 10:51 AM
#2
Re: ipban
$ip = $_SERVER['REMOTE_ADDR'];
And then depending on how you render your page, if the IP matches an IP in your banlist, deny them access.
-
Dec 5th, 2008, 11:47 AM
#3
Thread Starter
Fanatic Member
Re: ipban
look, can you explain the code, how do i use it and...?
-
Dec 5th, 2008, 02:30 PM
#4
Re: ipban
I coulda swore this was in the PHP section..
The function I gave you is PHP. Google "PHP Tutorials" if you want an into into it.
You can do it with other server-side scripting language as well. If you plan to use HTML or JavaScript to stop someone from a certain IP from visiting your site -- you cannot.
-
Dec 5th, 2008, 02:34 PM
#5
Thread Starter
Fanatic Member
Re: ipban
oh, thank you.
found a code...
Code:
<?php
$ban_ip = 'iphere';
$visitor_ip = $_SERVER['REMOTE_ADDR'];
if($visitor_ip == $ban_ip)
{
die("You are banned from this site!");
}
$visitor_ip = $_SERVER['REMOTE_ADDR'];
$ip_list = explode(",", $ban_ip);
foreach($ip_list as $ip)
{
if($visitor_ip == $ip)
{
die("You are banned from this site!");
}
}
?>
Last edited by Justa Lol; Dec 5th, 2008 at 04:37 PM.
-
Dec 5th, 2008, 04:36 PM
#6
Thread Starter
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|