Results 1 to 7 of 7

Thread: Encrypt && Decrypt PHP Script

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question Encrypt && Decrypt PHP Script

    Hi All,

    I have a question. Is it possible to encrypt a php script ? I mean I do not want to show my php script to users. If somebody is trying to access it from View --> Source Code , then he would not be able to see it. If it is possible to encrypt the entire html, java script and php script then it will be so good. Again we need to decrypt it. Please help me out.

    Thank you so much in advance.

  2. #2
    Hyperactive Member
    Join Date
    Oct 2006
    Posts
    354

    Re: Encrypt && Decrypt PHP Script

    You need to seperate out the PHP and HTML/Javascript into different categories.

    User won't be able to see your PHP code, only the people who have admin access to your web server will be able to see your PHP code. If you are the only user with access to you web server this is uneeded. I have seen some commercial PHP software using a PHP encoder of some type. However, it requires your user to install the encoder as well, which probably involves them paying for an additional license.

    If you want to encode your script then read this site. It details several products that accomplishes it.

    http://www.seocompany.ca/software/fr...-software.html


    As trying to hide your HTML/Javascript. There is not really a good way. In the end your web browser will have to read it.

    There is software out there you can google for that will "encrypt" your HTML. What it is really doing is using javascript and document.write to have an encrypted verision of your page. This will stop most people and web crawlers from reading your page with view source. However, most human can figure how to "unencyrpt it" your HTML code. You just run the algorithmn or reverse it depending on the situation.

    As to javascript, it works in the same way. You can encrypt, or more accurately obfuscate the code, but with a little work, someone will be able to read it. Again this will stop web crawlers and the casual person viewing your source.

    The moral of the story is, your web browser will have to see an unencrypted verision of your page before it is displayed. So, at some point the page will have to unecyrpt it self and reveal it's source.

    What I am getting at is, don't bother. The only expection to that is I would watermark mark your images.
    Last edited by superbovine; Aug 20th, 2007 at 08:08 AM.

  3. #3
    Addicted Member mfurqan's Avatar
    Join Date
    Oct 2005
    Location
    Pakistan
    Posts
    176

    Smile Re: Encrypt && Decrypt PHP Script

    Using that View Source Option in Web Browsers, Public cannot view your PHP or any other Server-Side Scripting. If you are making Your PHP script available for download and you want to protect your source then I think only better solution to do this is to Purchase either Zend or IonCube encoder but they are indeed very costy. Also, If you want to encode just your HTML and Javascript Source then I am sure there will be a Free encoder software if you can Google it But I don't think if its needed to encode HTML or Javascript Source code.

    Thank You.
    Muhammad Furqan Attari.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question Re: Encrypt && Decrypt PHP Script

    Thanks superbovine. Your given site is helping.

    And yes mfurqan, you understand my problem correctly. I like to give my php source code to someone who can use it only, but unable to see or modify my code. Except third party tool, is there any better option.

    Is it possible to use PHP to encrypt PHP code ? Can we use any encryption technology ? Say MD5.

    Please try to provide some sort help. Thanks.

  5. #5
    VBA Nutter visualAd's Avatar
    Join Date
    Apr 2002
    Location
    Ickenham, UK
    Posts
    4,906

    Re: Encrypt && Decrypt PHP Script

    Quote Originally Posted by systech44
    Thanks superbovine. Your given site is helping.

    And yes mfurqan, you understand my problem correctly. I like to give my php source code to someone who can use it only, but unable to see or modify my code. Except third party tool, is there any better option.

    Is it possible to use PHP to encrypt PHP code ? Can we use any encryption technology ? Say MD5.

    Please try to provide some sort help. Thanks.
    You can MD5 encrypt you PHP script. It is a very secure encryption because it is impossible to decrypt :P. I.e: MD5 is a one way hash function.

    The best you can do with a PHP script is obfuscate it and transform it or encrypt it usiong mcrypt. However, there will always have to be code inside your script to turn it back in to a legible script. The Zend encoder works by transforming the PHP code to byte code and by obfuscating the logic through optimizations.

    Obfuscation is your best weapon here. You can encrypt variable names and you can remove 90% of the white space from your code. This will make it harder for an adversary but not impossible.

    In 90% of cases there is no need to protect your source code however. The someone knows how an application works it can often be reverse engineered. If you have an original idea you need to apply for a world wide patent and get it copyrighted appropriatly.
    PHP || MySql || Apache || Get Firefox || OpenOffice.org || Click || Slap ILMV || 1337 c0d || GotoMyPc For FREE! Part 1, Part 2

    | PHP Session --> Database Handler * Custom Error Handler * Installing PHP * HTML Form Handler * PHP 5 OOP * Using XML * Ajax * Xslt | VB6 Winsock - HTTP POST / GET * Winsock - HTTP File Upload

    Latest quote: crptcblade - VB6 executables can't be decompiled, only disassembled. And the disassembled code is even less useful than I am.

    Random VisualAd: Blog - Latest Post: When the Internet becomes Electricity!!


    Spread happiness and joy. Rate good posts.

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2006
    Posts
    266

    Question Re: Encrypt && Decrypt PHP Script

    Thanks a lot VisualAd for the reply. Can you please provide me some documentation, url or anything that can make me understandable in MD5 and its implementation.

    By the way, what if there will be different server available. Is the php code run properly ?

    Thanks a lot.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: Encrypt && Decrypt PHP Script

    Quote Originally Posted by systech44
    Can you please provide me some documentation, url or anything that can make me understandable in MD5 and its implementation.
    He was joking. Hash functions are one way only.


    Consider whether you need to encrypt your software at all. vBulletin, the software that this forum runs on, is a commercial closed-source product which is distributed unencrypted. The large community of vBulletin modification authors would not exist if its source code were encrypted. The relatively small amount of genuine piracy that does occur is a fair trade-off for the benefits of enabling an enthusiast community to exist.

    If you must encrypt your code, Zend Guard is probably the best solution, but it's really not cheap.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width