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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.