homepage Welcome to WebmasterWorld Guest from 54.227.5.234
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

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




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

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?

 

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About
© Webmaster World 1996-2014 all rights reserved