View Full Version : Protect web content

Feb 21st, 2007, 09:22 AM
Hi All,

I am a web developer and I am lately becoming fairly security conscious.

So two questions for you and any help appreciated.

1)I have my hesitations about my web code being revealed to everyone through the "view page source" feature of web browsers. Apparently the source review may reveal quite a few hints that affect security. Is there a way to prevent people from seeing this?

2)Being a web developer (especially PHP) I would like to know how I can restrict my programs to run on specific domains only. In this way if someone steals my code he can not deploy it on his server.

Thanks for your help all


Feb 21st, 2007, 09:24 AM
1) No. If its published anyone can see it.
2) They won't be able to see the php source. They will just be able to see the html.

Feb 21st, 2007, 11:38 AM
You can disable right-clicking although this will only prevent people who don't really know what they are doing from viewing your source. As Aerospace_Eng said, once it's published anyone can see it.


Feb 21st, 2007, 02:14 PM
Ok the first question, hiding your source code.
Depsite what people may beleive it if impossible to hide your source code. The page gets downloaded onto the persons computer so even if you somehow dissable the view source they can still open the file in notepad and viola there's the source code. Of course there are some javascript programes out there that encode your entire site into javascript, but doing this means 1) you will rank poor in search engines, 2) It is easy to get around for anyone who knows javascript.

so in short no you can not hide your source code.

The second question about protecting your php source code.

Well there are several encryptors out there that can obscure your code but I personally dont recommend them. If you want to setup a script so it will only run on certain servers then you would have to code a callback service. Basicly telling the script to send a signal to your website (in the form of an image or other item) then your website would check to see if the site is allowed to run the script, if not you can tell it to either stop running and display an error or in severe cases remove the files off the server and leave a warning page there.

Hope that helps.

Feb 22nd, 2007, 02:04 PM
Just incase anyone thinks this software will help stop their image stealing problems it wont, you can easily get around the print screen by opening up a notepad window or something like that, moving it out of the way of the image and press print screen then. The script will only stop people pressing print screen from within the browser.

Feb 22nd, 2007, 04:56 PM
Don't waste your time doing it. You're wasting time and energy hiding the source code. It can be easily decrypted, easily found, easily read. Nothing on your site will be worth hiding from the public as I'm sure if a designer wanted to make it, he/she could

Feb 22nd, 2007, 05:48 PM
Also, things like no right-click just annoy people more than anything and they'll end up not visiting your site again.

PS. Does anyone think this is a cheap advertising spam trick by webarmour? :P

Feb 22nd, 2007, 09:24 PM
PS. Does anyone think this is a cheap advertising spam trick by webarmour? :P

I do! Somehow, I get the feeling this whole post is spam: http://www.google.com/search?q=webdevelopa

Anyhow, just in case — a quick search on protecting your source code in this forum will show that there is absolutely no way at all anyone can protect their source code:

The FAQ: http://codingforums.com/showthread.php?p=182173#post182173
The Sticky: http://www.codingforums.com/showthread.php?s=&threadid=4437

Show's over people. Nothing to see here, move along…