How can I protect my code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

How can I protect my code?

Post by mjseaden »

Dear All

My new code has some pretty nifty technology in it that I don't want anyone else to copy and profit out of (that's just against the rules!).

I've got all my PHP scripts in separate PHP files on my server's public HTML directory. I know if you go to View->Source you can view only the HTML output, however is there any way to stop people copying/downloading my code? E.g. some encryption system that won't take a lot of bother or processing time to use? Or some other method?

What permissions should I use for my PHP scripts for maximum security (bearing in mind they need to be accessed in order to run). Do I turn off 'public read' and just leave 'public execute' on? Would this make them only runnable (i.e. only HTML output viewable in browser) but not capable of being downloaded by a user?

Many thanks

Mark
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

there was a post about this a while back...and few before that aswell, search the forum.

here is a start for you...

viewtopic.php?t=20440&highlight=protect+code
anotherJean
Forum Newbie
Posts: 22
Joined: Tue Mar 30, 2004 3:59 pm

Post by anotherJean »

sorry, but you don't have a clue of anything, though your " new code has some pretty nifty technology in it"?
:lol:

hmmm I think I know why you want hide your nifty code, but I won't say it loud. :x
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

You do know that PHP is executed on the server and then it gives the output. I would find it practically impossible for someone to view your source unless they that ftp access or you were foolish enough to create a script which opens a file given by a variable, like

viewfile.php?file=blah.txt

Also remember to put an index page in each directory to prevent others from seeing your directory listing. And anotherJean just say what you have to say as im very interested. I personally think the user in question is just thinking of the aspects of his security so please do not abuse others for no reason whatso ever. Nevertheless code on and best of luck with your security pal!
anotherJean
Forum Newbie
Posts: 22
Joined: Tue Mar 30, 2004 3:59 pm

Post by anotherJean »

I'm sorry for beeing too harsh. though my opinion remains. and he's not concerned about security (passwords ... whatsoever) but about protecting his "nifty technology".
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

lol, you weren't being harsh, just freeing your opinion as you said. Nevertheless, who cares as long as the guy is happy;)
anotherJean
Forum Newbie
Posts: 22
Joined: Tue Mar 30, 2004 3:59 pm

Post by anotherJean »

Joe wrote:lol, you weren't being harsh, just freeing your opinion as you said. Although who cares as long as the guy is happy;)
ok ok I'm calming down ... who cares ... world is beatiful :D :roll:
User avatar
Joe
Forum Regular
Posts: 939
Joined: Sun Feb 29, 2004 1:26 pm
Location: UK - Glasgow

Post by Joe »

peace my friend ;)
magicrobotmonkey
Forum Regular
Posts: 888
Joined: Sun Mar 21, 2004 1:09 pm
Location: Cambridge, MA

Post by magicrobotmonkey »

on my server's public HTML directory
hes concerned about other users on the server looking at the code!
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post by qads »

Code: Select all

IndexIgnore */*
put that in a .htaccess file and upload it to your root, that will stop all dirs from listing files in them :D.
bla5e
Forum Contributor
Posts: 234
Joined: Tue May 25, 2004 4:28 pm

Post by bla5e »

get Zend
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post by kettle_drum »

Write a license for it saying that nobody can copy the code without your permission and payment etc etc.
mjseaden
Forum Contributor
Posts: 458
Joined: Wed Mar 17, 2004 5:49 am

Post by mjseaden »

Thanks to those who made helpful comments. Everyone else - you really know how to waste your own time. I want to protect my code because I just spent the last 3-4 months of my life making it - is that simple enough?

Mark
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

kettle_drum wrote:Write a license for it saying that nobody can copy the code without your permission and payment etc etc.
the chances of that being effective is slim

face it, if someone has the intentions of copying the code, how would anyone else be able to find out if their code is being used? Copyrighted or not, its just the harsh reality of lazy slobs who cannot write their own.
anotherJean
Forum Newbie
Posts: 22
Joined: Tue Mar 30, 2004 3:59 pm

Post by anotherJean »

mjseaden wrote:Thanks to those who made helpful comments. Everyone else - you really know how to waste your own time. I want to protect my code because I just spent the last 3-4 months of my life making it - is that simple enough?

Mark
my names's not everyone else :roll: whatever you can't hide your code. just don't write it, that's the best solution to keep it secret. there's so much brilliant code out there, just believe no one's interested in your "nifty technology".
referring to your first post above I just doubt you are able to write such great code as it seems you even don't know the basics. however if it's really your own code, try to hide it, waste your time and your/servers ressources .

oops I am being harsh again? I'm sorry. I just had to put in my two cents' worth

btw my suggestion

Code: Select all

<?php

    print str_rot13(str_rot13("nifty technology")) ;

?>
:lol:
Post Reply