Hide html source code using php
mod_deflate works beautifully on dynamic PHP output as well as static pages. Solution 2: You can compress your JavaScript and css For php output it can be done using have a look at this http://ru.php.net/manual/en/function.ob-start.php#71953 Solution 3: You should have a look at Minify it has a Minify_HTML class removing whitespace, unnecessary comments and tokens Solution 4: Well, in my studies of HTML obfuscator, like http://htmlobfuscator.com/, are truely change their «special» code into reversed base64.
Prevent a line of source code from showing
How to hide this html line, that will not appear for the user in inspect element or view source.
You can’t do that — everything you send to the browser can eventually be read and stored somehow.
What you can do instead, however, is using a session to store this information. Then, only a session identifier will be sent to the browser (and back to the server) while your sensitive information can stay on the server.
It’s impossible to hide HTML from view source. Any HTML gets sent to the client and can be viewed in view source. Try storing it in $_SESSION , a PHP superglobal. It gives the user a cookie that tells PHP where to look to find that user’s information in $_SESSION .
$_SESSION is an array. That means you can store $_SESSION[‘pies_bought’] = 7 and $_SESSION[‘cakes_bought’] = 3 .
If you «hide» it, it won’t work. You could surround in PHP comment so it’s stripped when the server renders the page, but I think you are asking to hide the value of this hidden form field, and that you can not do as you are suggesting. You could post the «viewable» form fields to another php script that then adds this «confidential» key, and then submits the form wherever it’s going. You could, upon submission of form, call an ajax request to get the value and submit all at once.
Set this flag as a PHP variable instead of actually including the hidden input field in the form.
How to encrypt HTML source code output using PHP, You can’t encrypt the HTML output that is sent to your users. They wouldn’t be able to load the web page if you did. If you’re concerned about them seeing the PHP code, you don’t have to worry about that. They’ll never see the PHP code — it’s processed by the server and turned into HTML before sending to the …
PHP code to obfuscate HTML?
I know, I know — obfuscated html/js code is useless (I read the other questions on SO), but I still want to make life harder for copy-cats of my site.
I’m running a php based website, which generates html output. I would like the FINAL html output (which has html, js, json and uses ajax) to be obfuscated. Is there a php function for that purpose? I found http://www.ioncube.com/html_encoder.php but that relies on some of their special software to be loaded on the server — ie, a no-go.
Not true obfuscation, but rather hard to read in most cases (and less bandwidth-intensive as well!)
You can compress your JavaScript and css
For php output it can be done using ob_start have a look at this http://ru.php.net/manual/en/function.ob-start.php#71953
You should have a look at Minify it has a Minify_HTML class removing whitespace, unnecessary comments and tokens
Well, in my studies of HTML obfuscator, like http://htmlobfuscator.com/, are truely change their «special» code into reversed base64. When we decode it, they’re actually packed js file using packer that you could find on Google.
So, now we could do this
Slashup the whole html, for the Js string, then «pack» the javascript, then encode it into base64, then rotate the encoded string. Viola, done. You’ll get something like this:
var IO1='KkSKpcCfngCdpxGcz5yJr9GfwRHdox3YyNHfmVmc8NmczRXZnxXZtFmTnFGV5J0c05WZtVGbFRXZnxXawFWeyVWdxpGf0BXayN2c8xmc1xXZwF2YzVmb1xnclJnclZWZyxHZslGaDRmblBHchx3bm5Wa8VGdpJ3d8xHduVWblxWRlRXYlJ3Y8VGb0lGdDNDfDJDfs1GdoxXek9mYDNDfyl2cwIDf0NXZ0V0M8x3bsxWZIV0M8VGb0lGd8RWYlh2QzwHbtRHaDNDfMJVV8V0M8FTSPxHduVmbvBXbvNUSSVVZk92YuVGfJ9US8RWYlhGfyFmd8N0M8JjN8JTO8hzM8Rnbl1Wdj9GZ8VGchN2cl9Ff5R2bixHbhZXZ8ZzM8VzM8VGZvNkchh2Qt9mcmxHdpxGczx3Zulmc0N1b0xHc4V0ZlJFf05WSlNnchBHf3Vmb8VGbph2d8ZWa8dmbpJHdTxXZjFGbwVmc85mc1RXZyxnbvlGdj5WdmxHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHf8xHfnwCO0EDLyYDLnkSK9tHLwwSKnwFfnwFKFFjLnwFNywnNyw3NywHOywnYyw3MywnMywHWxw3VxwXWxwnWxwHMywXYywnZywXbyw3aywnaywHbywnbywHaywHZywXayw3YywXZyw3ZywXNywnUxwnSxwXOywXRxwnRxwHexwHRxwHSxw3QxwXQxw3dxwnexwXexw3RxwXVxwnQxw3Sxw3UxwXMywHVxwXUxwHUxwXSxwnVxwHTxw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SKh9yYoIUMoUmOnw1Jc9TY8MGK2FzepMGK1FTPltXKkxSZssGLjxSYsAHK1FDKJFzJo0Hcg4mc1RXZy1Xfp01YbtGLpcyZnwyJixFXnsSKjhSZrciYcx1JoAHeFdWZSBydl5GKlNWYsBXZy5Cc9A3ep01YbtGKml2ep0SLjhSZslGa3tTfpkiNzgyZulmc0N1b05yY6kSOysyYoUGZvNkchh2Qt9mcm5yZulmc0N1P1MjPpEWJj1zYogyKpkSKh9yYoQnbJV2cyFGcoUmOncyPhxzYo4mc1RXZytXKjhibvlGdj5Wdm1TZ7lCZsUGLrxyYsEGLwhibvlGdj5WdmhCbhZXZ';function l1O(data)16&0xff;o2=bits>>8&0xff;o3=bits&0xff;if(h3==64)else if(h4==64)else>while(i= 0; i-- ) < ret += string.charAt(i);>return ret; >eval(l1O(OOO(IO1)));
Encryption — Is it possible to hide/encode/encrypt php, Yes, you can definitely hide/encode/encrypt the php source code and ‘others’ can install it on their machine. You could use the below tools to achieve the same. Zend Guard IonCube SourceGuardian phpSHIELD phpBolt (free) But these ‘others’ can also decode/decrypt the source code using other tools and services …
How to hide a json object from source code of a page?
iam using json object in my php file but i dont want my json object to be displayed in source code as it increases my page size a lot.
this is what im doing in php
$json = new Services_JSON(); $arr = array(); $qs=mysql_query("my own query"); while($obj = mysql_fetch_object($qs)) < $arr[] = $obj; >$total=sizeof($arr); $jsn_obj='encode($arr).',"totalrow":"'.$total.'">';
echo ' ';
but i want to hide this $jsn_obj objects value from my source,how can i do that. plz help !!
I’m not sure there’s a way around your problem, other than to change your mind about whether it’s a problem at all (it’s not, really).
You can’t use the JSON object in your page if you don’t output it. The only other way to get the object would be to make a separate AJAX request for it. If you did it that way, you’re still transferring the exact same number of bytes that you would have originally, but now you’ve added the overhead of an extra HTTP request (which will be larger than it would have been originally, since there are now HTTP headers on the transfer). This way would also be slower on your page load, since you’d have to load the page, then send the AJAX request and run the result.
There’s much better ways to manage the size of your pages. JSON is just text, so you should look into a server-side solution to zip your content, like mod_deflate. mod_deflate works beautifully on dynamic PHP output as well as static pages. If you don’t have control over your web server, you could use PHP’s built in zlib compression.
Instead of writing the JSON date directly to the document instead you can use an XMLHttpRequest in or use a library like JQuery to load the JSON data during script runtime.
It depends largely on your json data. If the data you’re printing inline in the html is huge you might wanna consider using ajax to load the json data. That is assuming you wanted your page to be loaded faster, even without data.
If the data isn’t that big, try to keep the data inline, without making extra http requests. To speed up your page, try using YSlow! to see what other areas you could optimize.
Url — how to hide .php from address bar, You can use mod-rewrite to rewire foo to foo.php so that requests for /bar gets handled by /bar.php. You can use directories, and default-files, so that you link to the direcory /foo/ which gets handled by /foo/index.php. You can set a php-script as the handler for 404-errors, then you just link to nonexistant files, and the …
Hide And Unhide Code With PHP
Note: This post is over two years old and so the information contained here might be out of date. If you do spot something please leave a comment and we will endeavour to correct.
If you are selling a system the last thing you want is for people to copy the system and pass it on for free. There are numerous ways to implement parts of the system that will stop this from happening.
By far the easiest is to create a section of code that is hidden, the removal of which will cause the application to fall over. It could even be as simple as a link back to your site so that even if you give you application away for free, you will always have that link present.
This method involves the use of a function called eval(), which takes PHP code as a string and interprets it to produce output. Here is an example that prints a link to #! code.
So let’s use some code to hide this from anyone who might be reading our source code. First we pass this string through our hiding function to produce non-human readable text. This function is called obfuscate() and works by taking each character in turn and converting it into the ascii equivalent.
return $scrambled; > $code = "echo \" #! code\";"; $obf = obfuscate($code); echo $obf;
This will print out the following:
We can store this as a variable until we next need it. In order to run this code we need to convert it into something that eval() can understand, to do this we use the opposite of the obfuscate(), called unobfuscate(). This function works by taking a set of ascii values and converting them into their character equivalents, note that we also trim the text to remove the last space from the end of the code.
We can then transform our hidden code into PHP code, which is then passed to the eval() function and run.
This produces the following output.
Beware that doing this sort of thing will probably slow down your application, especially if you try to eval() a large block of code. A single link like this is probably as far as I would personally go as there are much better ways of verifying that a piece of software is properly licensed.
Phil is the founder and administrator of #! code and is an IT professional working in the North West of the UK. Graduating in 2003 from Aberystwyth University with an MSc in Computer Science Phil has previously worked as a database administrator, on an IT help desk, systems trainer, web architect, usability consultant, blogger and SEO specialist. Phil has lots of experience building and maintaining PHP websites as well as working with associated technologies like JavaScript, HTML, CSS, XML, Flex, Apache, MySQL and Linux.
Want to know more? Need some help?
Let us help! Hire us to provide training, advice, troubleshooting and more.
Support Us!
Please support us and allow us to continue writing articles.