Advertising (This ad goes away for registered users. You can Login or Register)

Protecting PHP code?

Programming on your favorite platform, for your favorite platform? Post here
Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Protecting PHP code?

Post by Nickolas » Fri Dec 23, 2011 12:23 pm

I've written a small PHP script for use on a website... But I want to protect this from the people that view the website's source... How do I do it?
Advertising
Image
Image
Image
Image

wololo
Site Admin
Posts: 3619
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Protecting PHP code?

Post by wololo » Fri Dec 23, 2011 12:28 pm

People who view the website's source are the website's administrators, why would you prevent them from seeing your php script?
At best you can obfuscate your script (there are tools for that, look for "obfuscate php" in google, I guess), but it won't prevent somebody with enough dedication to reverse it.

But again, I would question your goals, why would you prevent the administrators of a website to see what's on that website? That sounds dangerous to me.
Advertising
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!

Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting PHP code?

Post by Nickolas » Fri Dec 23, 2011 12:32 pm

wololo wrote:People who view the website's source are the website's administrators, why would you prevent them from seeing your php script?
At best you can obfuscate your script (there are tools for that, look for "obfuscate php" in google, I guess), but it won't prevent somebody with enough dedication to reverse it.

But again, I would question your goals, why would you prevent the administrators of a website to see what's on that website? That sounds dangerous to me.
No, I meant *right-click - view page source* people...
Image
Image
Image
Image

User avatar
Xian Nox
Retired Mod
Posts: 2749
Joined: Fri Nov 05, 2010 5:27 pm
Location: Over the hills and far away

Re: Protecting PHP code?

Post by Xian Nox » Fri Dec 23, 2011 12:40 pm

They can't see the PHP code, since it's executed server-side.

wololo
Site Admin
Posts: 3619
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Protecting PHP code?

Post by wololo » Fri Dec 23, 2011 12:50 pm

Nickolas wrote:
wololo wrote:People who view the website's source are the website's administrators, why would you prevent them from seeing your php script?
At best you can obfuscate your script (there are tools for that, look for "obfuscate php" in google, I guess), but it won't prevent somebody with enough dedication to reverse it.

But again, I would question your goals, why would you prevent the administrators of a website to see what's on that website? That sounds dangerous to me.
No, I meant *right-click - view page source* people...
Lol, you're my story for this monday's coffee break at work, congrats :lol: (seriously though, see Xian Nox's answer above)
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!

Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting PHP code?

Post by Nickolas » Fri Dec 23, 2011 1:50 pm

Xian Nox wrote:They can't see the PHP code, since it's executed server-side.
Still you don't get me. I need this code to be protected even if the server is hacked... I need it to be hidden somehow...
Image
Image
Image
Image

wololo
Site Admin
Posts: 3619
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Protecting PHP code?

Post by wololo » Fri Dec 23, 2011 1:59 pm

If your server is hacked, you should have much more concerns that your php script's content being accessed :|
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!

Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting PHP code?

Post by Nickolas » Fri Dec 23, 2011 2:02 pm

wololo wrote:If your server is hacked, you should have much more concerns that your php script's content being accessed :|
I have personal reasons to keep this script to myself... Is there any way to encrypt it?
Image
Image
Image
Image

wololo
Site Admin
Posts: 3619
Joined: Wed Oct 15, 2008 12:42 am
Location: Japan

Re: Protecting PHP code?

Post by wololo » Fri Dec 23, 2011 2:06 pm

No. How do you expect Apache to interpret and execute your script if your script is encrypted? As I said, at best you can obfuscate it.
If you need US PSN Codes, this technique is what I recommend.

Looking for guest bloggers and news hunters here at wololo.net, PM me!

Nickolas
Posts: 174
Joined: Sat Jan 22, 2011 3:14 pm
Location: In a black hole...

Re: Protecting PHP code?

Post by Nickolas » Fri Dec 23, 2011 2:09 pm

wololo wrote:No. How do you expect Apache to interpret and execute your script if your script is encrypted? As I said, at best you can obfuscate it.
Hmm, I'll give it a try...
Image
Image
Image
Image

Post Reply

Return to “Programming”