This question already has answers here:
Obfuscate PHP code [closed]
(7 answers)
Closed 9 years ago.
Here goes my question I just started to investigate some of the php's methods to create Encrypted strings , and surprisingly I found quite alot .
Md5 , Sha1 , base64 , salts, str_replace(which isnt even of an encryptor ) etc etc. But here is my Real Question - Can i create similar to those CODE encryptors. Atm i can convert only strings,is it possable encrypt my whole PHP source code then decrypt it (with my own enccryptor) and run the Code . Sth like that - . Most of those i found are easily reversable.
Thx in advance!
There is no point in "encrypting" your code. Don't make too much a deal of it. There are billions of lines of freely available PHP code already. Anyone could have any code they want. So, just take it easy and put your efforts in improving your code instead of encoding it.
Related
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
Face detection in PHP
I want to be able to detect a portion of an image like a person's face in image $filetoReplace and then
replace it by another face in image $fileReplaceWith. Is there any way this can be done in php?
$filetoReplace = 'image/person.jpg';
$fileReplaceWith = 'image/anotherperson.jpg';
Short answer: Yes
Long answer: Yes, it's possible (how was already mentioned in comments: basically everything is possible), but you won't be able to write the algorithm without knowledge of image processing & pattern recognition; it's actually kinda rocket science :)
So that means, that you'll need to use some library. I would recommend OpenCV which is quite mature open source library built for this purpose (any many others). There is already built-in detector of faces.
I suggest to search for "OpenCV in PHP" to find PHP wrapper for this library and then you'll need to figure out how to pass the image properly to find face(s) in OpenCV in $filetoReplace and how to replace rectange/oval with $fileReplaceWith.
This question already has an answer here:
Closed 10 years ago.
I am developing a CMS which has a PHP Encryption engine. But as the PHP code is completely visible, the method of encryption of data is easily compromised as every person who purchases the product can read the code. I want to pre compile the PHP or use any other server side scripting language that allows me to give a file containing the byte code of the program and which carries out the exact same function as the original PHP file. Is there any such language?
I know that perl can be precompiled.
This might be useful: http://www.perlmonks.org/?node_id=402933
This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How would you transform a pre-existing web app in a multilingual one?
Best way to internationalize simple PHP website
I'm trying to figure out how to translate all the static texts on my webpage (I'm using PHP). But I'm not really sure what the "correct" way is. This is what I thought of so far, but maybe it's all wrong :D
1.
For every static piece of text on the page, just get the translation with something like "getTranslation("Hello World!") and it will just look up the translation in the database or a file like XML/CSV/PHP with all the translations.
But this seem pretty bad since we will have to query the database or parse the file on every page, everytime it's refreshed/loaded.
2
Everytime a page is loaded I could read from the database/file and store the translations for the current language in an array and get the translations from the array as the page is building, instead querying the database / parsing the file again.
3
Is there some way to read the translations only once and then make it accesible for all pages? The only thing I can think of is php's SESSION but it just seems so wrong to store the translations there.
So what the "most common" or "right" way to do it?
Happy hunting!
Sounds like you need gettext. gettext is widely used and widely supported. I'm pretty sure it's also pretty well optimized.
This question already has answers here:
encoding php scripts on fly [duplicate]
(4 answers)
Closed 9 months ago.
I have a PHP script,
for example
<?php
$name="Alfred";
echo $name;
?>
I used following script to encrypt,(by www.rightscripts.com/phpencode/index.php)
<?php
eval(gzinflate(str_rot13(base64_decode('encrypted code'))));
?>
But it only print "$name="Alfred";" and "Undefined variable $name".
What is the problem ? Is there any other solution ? Please help me ?
"Encoding" this way doesn't really protect you from anything.
The encoded PHP code is on the server, and so is the code that decodes it back to regular PHP.
If someone has sufficient access to your server that they can read your encoded PHP scripts, then it is almost certain that they also have sufficient access to read the decoder script. Which means your code isn't actually protected at all.
There are a number of obfuscators and encoders which can do what you want, but at the end of the day, all you're really doing to your code is slowing it down (eval() is a major performance killer, quite aside from its other issues).
A better solution might be to compile your code. There is a PHP compiler called HipHop which will do the trick for you. It's worth giving it a try.
Even with compiled code (in any language), it is still possible for someone who's determined to pull it apart and learn your secrets, but it'll be a lot harder than a simple encoded script, and also it should run faster than normal when compiled, compared with slower than normal when encoded, so you win both ways.
This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
How to encrypt HTML, CSS and JavaScript to prevent theft
Is there any technique in PHP language, or some software available to encrypt the html code that is seen while clicking on view source and view generated source on browsers.Can the code be encrypted to binary strings ie( 0 and 1) format.
No. The browser needs valid HTML to display the document. There is no way to encrypt HTML.
The whole world is serving pages that are not encrypted, so it stands to reason it's not necessary, either.
People will always be able to get to your html - even if you did find some way to obfuscate / hide it, maybe using javascript, anyone can always use wget or similar to view it.
No. You can obscure it a bit, but in the end your browser needs to read it, and it reads HTML.
In a word: no. You can make the HTML ugly by removing whitespace, but the browser needs to be able to read it! You can obfuscate your Javascript pretty darn well by removing whitespace and newlines and using short or crazy variable names: for example see here.