i want to do some security

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
mo2sh
Forum Newbie
Posts: 2
Joined: Fri Dec 10, 2010 2:12 pm

i want to do some security

Post by mo2sh »

hi all,
i Apologize if my topic is in wrong forum.
i want to do something that my script work on one domain

example domain.com
and if any one put it on other domain don't work
but i don't Know the code :banghead:
can any one help me plz :oops:
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: i want to do some security

Post by Apollo »

Encrypt the entire code (or at least an essential / 'main' php file), using a checksum of the required host name as the encryption key.

Then in a stub php file, do something along the lines of eval(your_favorite_decypt_function(the_encrypted_code,sha512(the_current_domain))).
Optionally, checksum-verify the decrypted result before eval'ing it to avoid random garbage on invalid domains.

Obviously this is not secure if people know on what domain this is supposed to run (in that case they can simply fake the host name). You could add some salt data stored in a database and/or local (non-http-accessible) file. That way, even if they get access to your php files and know on which server it's supposed to run, they still can't obtain the key necessary to run the code.
mo2sh
Forum Newbie
Posts: 2
Joined: Fri Dec 10, 2010 2:12 pm

Re: i want to do some security

Post by mo2sh »

thanks Apollo,
can u give me code because i don't know exactly the code
User avatar
Apollo
Forum Regular
Posts: 794
Joined: Wed Apr 30, 2008 2:34 am

Re: i want to do some security

Post by Apollo »

I don't have any code for this, but the above pretty much explains itself. Look on php.net for the necessary functions.
Post Reply