Welcome to WebmasterWorld Guest from 54.167.5.15

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

How to add ip's to htaccess with deny from infront of it.?

     

john1000

7:26 pm on Oct 9, 2007 (gmt 0)

10+ Year Member



Hi,

sometimes it can be handy to add a large block of ip's to the htaccess file.
But if you add 30 ip's to the htaccess you have to add deny from all the time..

Now...i found the following script...

<script language="Javascript">
function xmlhttpPost(strURL) {
var xmlHttpReq = false;
var self = this;
// Mozilla/Safari
if (window.XMLHttpRequest) {
self.xmlHttpReq = new XMLHttpRequest();
}
// IE
else if (window.ActiveXObject) {
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
self.xmlHttpReq.open('POST', strURL, true);
self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.onreadystatechange = function() {
if (self.xmlHttpReq.readyState == 4) {
updatepage(self.xmlHttpReq.responseText);
}
}
self.xmlHttpReq.send(getquerystring());
}

function getquerystring() {
var form = document.forms['f1'];
var word = form.word.value;
qstr = 'w=' + escape(word); // NOTE: no '?' before querystring
return qstr;
}

function updatepage(str){
document.getElementById("result").innerHTML = str;
}
</script>
</head>
<body>
<form name="f1">
<textarea id="word" style="width: 410px; height: 191px"></textarea>

<input value="Go" type="button" onclick='JavaScript:xmlhttpPost("/cgi-bin/simple-ajax-example.cgi")'></p>
<div id="result"></div>
</form>

So my idea was to put in a bunch of ip's in the text area..
That goes ok...

Other part of the script is a tiny cgi part....

simple-ajax-example.cgi

And thats :

-----start--------------
#!/usr/bin/perl -w
use CGI;

$query = new CGI;
$secretword = $query->param('w');

print $query->header;
print "<pre>$secretword</pre><br>";

--------------end-----------------

When i put ip's in it shows like :

00.11.22.33/19
00.11.22.33/19
00.11.22.33/19

it shows afterwards like :

00.11.22.33/19
00.11.22.33/19
00.11.22.33/19

Thats fine,but i tried to change the code (probably cgi part) to show it like :

deny from 00.11.22.33/19
deny from 00.11.22.33/19
deny from 00.11.22.33/19

But i cant seem to get it right...
Anyone that can assist with that?

 

Featured Threads

Hot Threads This Week

Hot Threads This Month