TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   General (http://www.talkphp.com/general/)
-   -   Hide files being accessed directly? (http://www.talkphp.com/general/2345-hide-files-being-accessed-directly.html)

Nor 02-26-2008 10:39 PM

Hide files being accessed directly?
 
I want to hide js from being viewed directly..

TlcAndres 02-26-2008 10:50 PM

Putting this in your .htaccess file should do it

Quote:

IndexIgnore */*

Alan @ CIT 02-26-2008 10:59 PM

I do a similar things to protect my PHP library / includes folder. I have a .htaccess file in each folder I want protected with:

Code:

deny from all
In it. If a user tries directly access any file in that folder, they get a 403 Forbidden error.

Alan

TlcAndres 02-26-2008 11:00 PM

Sometimes I think 403 errors are just nasty to look at.

Alan @ CIT 02-26-2008 11:06 PM

That's why you use custom error handlers to display a nice friendly error to your visitors :-)

I'm a firm believer that a visitor should never be shown a PHP or HTTP error message directly. The message should be logged and a nice friendly error page should be shown to the user.

display_errors = Off ! :-D

Alan

wGEric 02-26-2008 11:53 PM

Quote:

Originally Posted by Nor (Post 11482)
I want to hide js from being viewed directly..

That's impossible since the JS is loaded in the page. Best way is to obfuscate the code. For example this javascript file from Google Maps. It would take a very long time to figure it out that code.

Sending the people to a 403 page when accessing the javascript will break your page IIRC. The browser sends the request for the javascript page not the server so when someone tries to load the page the request for the javascript will return a 403.

Village Idiot 02-26-2008 11:59 PM

Yeah, the browser makes a call to the javascript, not the server. Therefore a deny all statement would block all access whatsoever to the file.

Wildhoney 02-27-2008 12:07 AM

As Javascript doesn't require any line termination character -- not even a semi-colon or a line break, making it utterly confusing is fairly straightforward. Simply place the entire Javascript code on 1 line.

Nor 02-27-2008 04:08 PM

I'm using dean edwards packer but theres a unpacker -.-.. is there any other JS encrypters?

Village Idiot 02-27-2008 04:12 PM

No, JS is client side so you would have to make them install something on their browser. Its as simple as this, if the client's browser can run it, the client can view the source.


All times are GMT. The time now is 06:05 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0