Jump to content

Encrypting HTML


ilikemath2002

Recommended Posts

I have this code:

<script language="JavaScript"> function doencrypt(theform) { if (theform.code.value == "") { alert("No HTML code to encrypt"); return false; } else { enctext=encrypt(theform.code.value); codetocopy="<Script Language='Javascript'>\n"; codetocopy+="<!-- HTML Encryption -->\n"; codetocopy+="<!--\n"; codetocopy+="document.write(unescape('"+enctext+"'));\n"; codetocopy+="//-->\n"; codetocopy+="</Script\>"; theform.ecode.value=codetocopy; theform.sac.disabled = false; } return false; } function sandc(thisform) { thisform.ecode.focus(); thisform.ecode.select(); copytext=thisform.ecode.createTextRange(); copytext.execCommand("Copy"); alert("Copied the Encrypted HTML Code to clipboard, you may now paste this into your website"); } function encrypt(tx) { var hex=''; var i; for (i=0; i<tx.length; i++) { hex += '%'+hexfromdec(tx.charCodeAt(i)) } return hex; } function hexfromdec(num) { if (num > 65535) { return ("err!") } first = Math.round(num/4096 - .5); temp1 = num - first * 4096; second = Math.round(temp1/256 -.5); temp2 = temp1 - second * 256; third = Math.round(temp2/16 - .5); fourth = temp2 - third * 16; return (""+getletter(third)+getletter(fourth)); } function getletter(num) { if (num < 10) { return num; } else { if (num == 10) { return "A" } if (num == 11) { return "B" } if (num == 12) { return "C" } if (num == 13) { return "D" } if (num == 14) { return "E" } if (num == 15) { return "F" } } } </script> <form name="pageform" onsubmit="return doencrypt(this);"> 

I basically want to encrypt whole files at a time without having to enter the source code, is this possible?

Link to comment
https://forums.phpfreaks.com/topic/143877-encrypting-html/
Share on other sites

oh, i see; your wanting to encrypt your form submission results. well if that is what your trying to do; i would forget about doing it with javascript. because js can be disabled; hence "no more form submission encryption". your best bet is to place the page (that contains the form) in a SSL folder.

Link to comment
https://forums.phpfreaks.com/topic/143877-encrypting-html/#findComment-755061
Share on other sites

I don't think you understand. You input HTML source-code, and the Javascript encrypts it to Javascript. I want to input whole files(get the source-code from that file). I know Javascript can be disabled AND this can be decrypted, but I still would like to use it.

Link to comment
https://forums.phpfreaks.com/topic/143877-encrypting-html/#findComment-755526
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.