Bin working on a project and my custumor asked if there was a way to display the generated view in a js code string like smartgb.com offers with their free HTML Encrypter, and i said yes of course there is.
Even though i told him that people who realy wanted to copycat the content could easily do it.
Demo: view-source:[Only registered and activated users can see links. ] make sure to view page source (and not the developer console) to see it's encrypted content | I have only enabled this function on that page for preview purposes.
Uncrypted version: view-source:[Only registered and activated users can see links. ]
And for us web developers we do know once the page is fully loaded and the JS is executed we will have a readable HTML/CSS mockup in any developer console.
Here's my function to encrypt your output HTML:
function encryptHtml($content) //Post request naar smartgb.com met nodige velden
$url = 'http://www.smartgb.com/free_encrypthtml.php?do=crypt';
$fields = array(
foreach($fields as $key=>$value)
$ch = curl_init();
$result = curl_exec($ch);
$doc = new DOMDocument();
$els = $doc->getElementsByTagName('textarea');
for($i = $els->length; --$i >= 0; )
$el = $els->item($i);
if($el->getAttribute('name') == 'Textruta')
$encryption = $el->nodeValue;
return "Please check out the site smartgb, unable to retrieve the encryption. External page probably changed or moved content.";
//Server offline return standard HTML
The above code actualy sends a POST request to their site and retrieves the response, than it loops through the dom document to find the textarea with name: Textruta once found it saves the field value inside a variable that get's printed out at the end of the function.
If you want this to work without overload you have to make sure all view content is in one variable (as you don't want to make multiple POST requests to their server).
In my application for example i output all of my html with one var:
Yes, this will prevent many starters from copying your website, however as i've told before once the website is loaded on your screen and you open up a dev console all elements and code will be visible. Because once that "converted" js is loaded it will print out your elements and other code like js, css,...
To me it's still encrypting because we've made it possible to hide our whole view source into a long and unreadable JS string, most likley advanced developers will always be able to copycat you because of their knowledge however do they realy need to copy you when having all that knowledge ?