|
You last visited: Today at 19:19
Advertisement
[Helpfull]How to deny acces to website for banned ip`s.
Discussion on [Helpfull]How to deny acces to website for banned ip`s. within the Shaiya PServer Development forum part of the Shaiya Private Server category.
09/21/2011, 01:56
|
#1
|
elite*gold: 0
Join Date: Apr 2011
Posts: 370
Received Thanks: 350
|
[Helpfull]How to deny acces to website for banned ip`s.
As the title says.
If you no longer want banned people to view you`r website,forum,registration page and other things you can do it easy.
Go to My Computer/Local Disk C/wamp (depends on what you use)/www (public_html/httdocs).
Find a file called .htacces (if you don`t have one, create one), open it with notepad and insert:
<Limit GET>
order deny,allow
deny from 127.0.0.1 (make sure u change this ip, and use commas to separete each new ip that you add)
</Limit>
Save the file and you`re done.
This will prevent banned ip`s to view your website.
|
|
|
09/21/2011, 03:02
|
#2
|
elite*gold: 0
Join Date: Mar 2010
Posts: 2,334
Received Thanks: 1,777
|
Your also going to want to block proxy IP's, there are plenty of sites that give you long list of major proxy IP's, just do some copy and pasting.
|
|
|
09/21/2011, 05:16
|
#3
|
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
|
Wouldn't PHP be able to do this?
PHP Code:
<?php function returnIP(){ $ipParts = explode(".", $_SERVER['REMOTE_ADDR']); if ($ipParts[0] == "165" && $ipParts[1] == "21") { if (getenv("HTTP_CLIENT_IP")) { $ip = getenv("HTTP_CLIENT_IP"); } elseif (getenv("HTTP_X_FORWARDED_FOR")) { $ip = getenv("HTTP_X_FORWARDED_FOR"); } elseif (getenv("REMOTE_ADDR")) { $ip = getenv("REMOTE_ADDR"); } } else { return $_SERVER['REMOTE_ADDR']; } return $ip; }
$ch = mssql_query("SELECT * FROM PS_UserData.dbo.BannedIPs"); $ip = returnIP(); if(mssql_num_rows($ch)){ while ($ban = mssql_fetch_assoc($ch)){ if($ip == $ban['banIP']) { header("HTTP/1.1 401 Unauthorized"); header("Location: http://youareanidiot.org/"); exit; }}} ?>
|
|
|
09/21/2011, 05:20
|
#4
|
elite*gold: 0
Join Date: Apr 2011
Posts: 370
Received Thanks: 350
|
Yes it would work, but i wonder how many people have PHP knowledge?
I only posted the easyest way to restrict acces to the whole folder.
|
|
|
09/21/2011, 09:35
|
#5
|
elite*gold: 0
Join Date: Sep 2011
Posts: 102
Received Thanks: 87
|
not many people i would reckon
|
|
|
09/21/2011, 11:11
|
#6
|
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
|
Not many here care to learn what they use, you're right.
But, I was just pointing out that to add to what you said, no need to get offensive.
P.S. IIS doesn't use the .htaccess or w/e that is. Only Apache does.
|
|
|
09/21/2011, 22:00
|
#7
|
elite*gold: 0
Join Date: Oct 2009
Posts: 69
Received Thanks: 152
|
One more Deny script :)
This script you can attach at the top of all your scripts.
PHP Code:
<?php
//you must to replace server data with yours
$Jokerhost = '127.0.0.1';
$Jokerdbuser = 'Shaiya';
$Jokerdbpass = 'Shaiya123';
//you must to have first created table BannedIPs at your SQL database
$Jokerlink = mssql_connect($Jokerhost,$Jokerdbuser,$Jokerdbpass) or die("Cannot connect to MSSQL server");
$Jokerban = mssql_query("SELECT banIP FROM [PS_UserData].[dbo].[BannedIPs] ",$Jokerlink);
$i=3;
$ipDeny[0]="111.111.111";
$ipDeny[1]="222.222.222";
$ipDeny[2]="333.333.333";
while($banip=mssql_fetch_array($Jokerban))
{
if ( strlen($banip[0])>1)
{
$ipDeny[$i]= $banip[0];
$i++;
}
}
if (in_array ($_SERVER['REMOTE_ADDR'], $ipDeny))
{
header("location: http://your site/");
exit();
}
?>
|
|
|
09/21/2011, 23:24
|
#8
|
elite*gold: 0
Join Date: Apr 2011
Posts: 370
Received Thanks: 350
|
As you say:
Quote:
Originally Posted by bulgaria
This script you can attach at the top of all your scripts.
|
You have to do that, true.
The way i do it is like me 1st post. You only add the ip into the htacces file and it restrict acces to each file.
In this case: website/forum/registration/pvp ranks/ and such.
Its not only the banned ip`s from the game that matters, think at forum too.
|
|
|
09/22/2011, 06:36
|
#9
|
elite*gold: 0
Join Date: Oct 2009
Posts: 69
Received Thanks: 152
|
Can make any variation. The table BannedIPs can add columns to help distinguish the different IP-addresses. Then small changes in the script to select Moyen only those addresses that you care for your application.
|
|
|
 |
Similar Threads
|
Banned from Website
11/16/2009 - Off Topic - 3 Replies
Can anyone tell me the various methods there are for banning someone from a web site? It is a social forum and it was to have been a temporary one-week ban however its going on a month now and any mail I send to site support either gets lost or isn't answered.
So what ways are there of blocking someone? I tried deleting cookies and browser history. Can they put a token on my account? I can't believe they would contact my provider for a one-week ban so any ideas?
Thanks.
And btw I...
|
Some helpfull things
01/22/2009 - CO2 Guides & Templates - 0 Replies
I have used this one site for more than 3 years now, it has attripute calculator, damage calculator, item composotion calculator, pvp damage etc...
Well lots of usefull things and especially i like that attripute calculator when making reborns, you can see what u get in different levels.
emjay2 - Conquer Toys
Just some handy tool's. I didint make them but if u like them u can push thx :)
|
Deny Jail from GM
05/14/2008 - RF Online - 15 Replies
When we get caught and such, it would be awsome to deny jail from GM.
I guess when GM warp you to jail, server sends a warp code to you.
I guess WPE is the right tool here. I couldnt find any "area/map codes" in CE at least.
Anyone with privat server could check if its possible to jam/disturbe the warp code from GM's?
** just for the show **
|
All times are GMT +1. The time now is 19:22.
|
|