PDA

View Full Version : Javascript Security


andybeeeeee
09-20-2005, 11:28 AM
Hi there

i'm using a javascript for a password protected part of my site as its the easiest way of doing it imo. the only trouble i'm having is that people can view the source of my page and find the address for my javascript. they can then go into the script and get the username and password, thus negating the point of having a password protect part!

i've tried changing the chmod properties of the java script, but if i make it so that the world cant read it, it doesnt actually function at all. i've also tried putting it in the private part of my website, but that has the same affect as the above.

can anyone help me by telling me how i can make it so that people cant get into my javascript, but still have it so that it functions...

if thats not possible i need another way of password protecting pages on my site...

thanks, andy

RysChwith
09-20-2005, 01:29 PM
There is no way to securely protect a page with JavaScript. You need to either use a server-side script, such as PHP or ASP, or an .htaccess file. I'm pretty sure someone whipped up a tutorial on .htaccess, if you do a search of the forums.

Rys

andybeeeeee
09-20-2005, 06:47 PM
i tried it using .htaccess, but it didnt seem to work. maybe i was doing it wrong so i'll try again

maskd
09-21-2005, 03:52 AM
There are scripts available however that "encrypt" your code, making it harder for novices who "think their leet" from finding out the password and conflicting as much damage as possible. Most of the people with the really good skills probably wouldn't be bothered.

andybeeeeee
09-21-2005, 10:43 AM
can you point me in the direction of an encryption script? this could be what i need. the things i'm trying to protect arent that private, i just dont want it so easy for anyone to gain access