Reply
block ips from viewing java script?
Old 12-19-2007, 10:54 PM block ips from viewing java script?
kewlchat's Avatar
Average Talker

Latest Blog Post:
Man Throws 4 Kids Off Bridge
Posts: 15
Name: kewlchat
hi all im still kind of new here. but ive been around the net ages but i have a question that i cant seem to find the answer even after much searching online.

Ok i want to block a list of ips from viewing java script on my webpages but with out useing htaccess

If anyone knows how please reply it will be greatly apreciate thanks
kewlchat is offline
Reply With Quote
View Public Profile Visit kewlchat's homepage!
 
When You Register, These Ads Go Away!
     
Old 12-20-2007, 01:42 AM Re: block ips from viewing java script?
Extreme Talker

Posts: 214
Location: United States
I can't think of a way to completely block IPs from viewing a file without using htaccess.

If you are using a server-side language (such as PHP) to generate your documents, you could stop your documents from requesting scripts. It's not perfect, but it may be what you are looking for. You could do something such as the following wherever you generate your header code:
PHP Code:
$bad_ip_list = array("127.0.0.1""1.2.3.4");
if (!
in_array($_SERVER['REMOTE_ADDR'], $bad_ip_list)
  echo 
'<script type="text/javascript" src="myscript.js"></script>'
All other methods that I can think of would require htaccess. Also, no matter which method you try to use to block an IP, if the user behind that IP really wants that Javascript file, they can still use a proxy and get it.

Just out of curiosity, why do you need to block IPs from viewing Javascript?
frost is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to block ips from viewing java script?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.11590 seconds with 13 queries