Click to See Complete Forum and Search --> : IP adress filter


zabitii
08-11-2003, 11:38 AM
Hi! I have a problem with IP adress filter!

Script -
<!-- ONE STEP TO INSTALL IP ADDRESS FILTER 2:

1. Copy the coding into the HEAD of your HTML document -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original: kdcgrohl -->
<!-- Web Site: http://www.kdcgrohl.com -->

<!-- Begin
// This JavaScript uses server side includes ("SSI") so this document's name must end in .shtml
function ban(){
var ip = '<!--#echo var="REMOTE_ADDR"-->';

//add as many ip's below as you wish.
if (ip == "x.x.x.x" || ip == "x.x.x.x") {

//if you wish to change the alert message, do so below.
alert("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nYour ip address \("+ip+"\) has been banned!");
history.go(-1);
window.location.replace("http://javascript.internet.com/")
}
}
ban();
// End -->
</script>


<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size: 1.10 KB -->

=-=-=-=-=-=

"This JavaScript uses server side includes ("SSI") so this document's name must end in .shtml" - i make a shtml file and posted this script, but he dont work!
//add as many ip's below as you wish.
if (ip == "x.x.x.x" || ip == "x.x.x.x") { - here i add my IP adress, but he dont work too!!!
Help plz! :(

(Sorry if i make some grammar mistakes - i dont known english well) :rolleyes:

AdamGundry
08-11-2003, 11:44 AM
In order for server-side includes (SSI) to work, they have to be enabled on your server. Contact your web host to find out if they are enabled, or if you can have access to another server-side language such as PHP. Client-side Javascript alone cannot detect the user's IP address.

Adam

zabitii
08-11-2003, 01:56 PM
Originally posted by AdamGundry
In order for server-side includes (SSI) to work, they have to be enabled on your server. Contact your web host to find out if they are enabled, or if you can have access to another server-side language such as PHP. Client-side Javascript alone cannot detect the user's IP address.

Adam


You mean use this script with PHP??? :confused:

AdamGundry
08-11-2003, 02:54 PM
You can do it with PHP or SSI. The method you demonstrated requires SSI enabled on the server. For a PHP version, change this line

var ip = '<!--#echo var="REMOTE_ADDR"-->'

to this

var ip = '<?php print $HTTP_SERVER_VARS['REMOTE_ADDR']; ?>';

Of course, this requires a .php extension and PHP enabled on your server. Like I said, you need to find out what is available from your web host.

Adam

nkaisare
08-11-2003, 03:16 PM
Its really a dumb script. You can use server side methods to block IPs.

If you are running Apache server, you may want to read the following:
http://httpd.apache.org/docs/howto/auth.html#access

zabitii
08-12-2003, 01:57 AM
Originally posted by AdamGundry
You can do it with PHP or SSI. The method you demonstrated requires SSI enabled on the server. For a PHP version, change this line

var ip = '<!--#echo var="REMOTE_ADDR"-->'

to this

var ip = '<?php print $HTTP_SERVER_VARS['REMOTE_ADDR']; ?>';

Of course, this requires a .php extension and PHP enabled on your server. Like I said, you need to find out what is available from your web host.

Adam


==========================

Thank you! I find out about SSI & PHP! :D

zabitii
08-12-2003, 01:58 AM
Originally posted by nkaisare
Its really a dumb script. You can use server side methods to block IPs.

If you are running Apache server, you may want to read the following:
http://httpd.apache.org/docs/howto/auth.html#access

======

But Apache is it like SSI, PHP and others?

nkaisare
08-12-2003, 07:26 AM
I meant using a client-side method like Javascript. If an IP is blocked using Javascript, the person can simply turn if off and visit your site. Server side method (including PHP) is more foolproof.

zabitii
08-12-2003, 11:57 AM
Thanx all for helping me!
My server is not working in PHP & SSI!
But thanx! :D ;)

pyro
08-12-2003, 12:06 PM
Originally posted by zabitii
My server is not working in PHP...Find a new server... :D :p

zabitii
08-12-2003, 12:42 PM
Originally posted by pyro
Find a new server... :D :p

Very Funny!!! :( :mad:

pyro
08-12-2003, 12:46 PM
Lol.. I was only sortof kidding. If your server doesn't support PHP or SSI, it may be time to find a new one.

PeOfEo
08-12-2003, 04:58 PM
What server side languages does your server support. PHP isnt the only one you can use.

zabitii
08-13-2003, 01:06 AM
Originally posted by PeOfEo
What server side languages does your server support. PHP isnt the only one you can use.

???????????????

PeOfEo
08-13-2003, 04:13 PM
PHP is a server side language meaning when a user requests a PHP page a bunch of data is processed in the server and the server returns html code. So therefore you are creating code with php that will recreate your page whenever a user visits it. The server can thus access data bases to populate the html files which is why it is possible for these forums to store your posts. But PHP is not the only language that can do this. There is also ASP JSP ASP.NET SHTML & CGI. PHP is by no means your only option. Do you know if your server will host any pages of those I mentioned above? If so then you can still do what you want to do instead of using PHP or SSI you would be using another technology.

zabitii
08-14-2003, 12:44 AM
Originally posted by PeOfEo
PHP is a server side language meaning when a user requests a PHP page a bunch of data is processed in the server and the server returns html code. So therefore you are creating code with php that will recreate your page whenever a user visits it. The server can thus access data bases to populate the html files which is why it is possible for these forums to store your posts. But PHP is not the only language that can do this. There is also ASP JSP ASP.NET SHTML & CGI. PHP is by no means your only option. Do you know if your server will host any pages of those I mentioned above? If so then you can still do what you want to do instead of using PHP or SSI you would be using another technology.


:D

Jonathan
08-14-2003, 01:56 AM
what does it mean when it says:

window.location.replace("")

zabitii
08-14-2003, 02:56 AM
Originally posted by Jonathan
what does it mean when it says:

window.location.replace("")


I dont known! :confused: :(

pyro
08-14-2003, 11:24 PM
It is replacing the current page in the browsers history with a new one. Similar to window.location.href, but with that, the old page is kept in the history.