Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



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
Trades: 0
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
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
kewlchat is offline
Reply With Quote
View Public Profile Visit kewlchat's homepage!
 
 
Register now for full access!
Old 12-20-2007, 01:42 AM Re: block ips from viewing java script?
Extreme Talker

Posts: 238
Location: United States
Trades: 0
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 Search this Thread
Search this Thread:

Advanced Search

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

BB 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.10314 seconds with 12 queries