Talk:Work:Repair and Optimize All Databases on an Account

From Zoelife4U Wiki
Jump to: navigation, search

Contents

Javascript code

Note. We're only obfuscating and compressing to conserve space, everything is here in the open, same code either way works.

Full version pasted from internet

Need to write a PHP wrapper for this, here's some Javascript to base64 the password. We'll wanna obfuscate it at http://javascriptcompressor.com/ to save space, and protect crap from hackers.

<!--
 
// This code was written by Tyler Akins and has been placed in the
// public domain.  It would be nice if you left this header intact.
// Base64 code from Tyler Akins -- http://rumkin.com
 
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
 
function encode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;
 
   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);
 
      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;
 
      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }
 
      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
 
   return output;
}
 
function decode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;
 
   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
 
   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));
 
      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;
 
      output = output + String.fromCharCode(chr1);
 
      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);
 
   return output;
}
 
//-->


Obfuscated Version

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('<!--7 1="F+/=";t z(a){7 b="";7 c,h,f;7 d,j,8,5;7 i=0;u{c=a.n(i++);h=a.n(i++);f=a.n(i++);d=c>>2;j=((c&3)<<4)|(h>>4);8=((h&s)<<2)|(f>>6);5=f&y;l(r(h)){8=5=k}x l(r(f)){5=k}b=b+1.e(d)+1.e(j)+1.e(8)+1.e(5)}q(i<a.w);v b}t E(a){7 b="";7 c,h,f;7 d,j,8,5;7 i=0;a=a.D(/[^A-C-B-9\\+\\/\\=]/g,"");u{d=1.m(a.e(i++));j=1.m(a.e(i++));8=1.m(a.e(i++));5=1.m(a.e(i++));c=(d<<2)|(j>>4);h=((j&s)<<4)|(8>>2);f=((8&3)<<6)|5;b=b+o.p(c);l(8!=k){b=b+o.p(h)}l(5!=k){b=b+o.p(f)}}q(i<a.w);v b}',42,42,'|keyStr||||enc4||var|enc3||||||charAt|chr3||chr2||enc2|64|if|indexOf|charCodeAt|String|fromCharCode|while|isNaN|15|function|do|return|length|else|63|encode64||z0|Za|replace|decode64|ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'.split('|'),0,{}))

Final Use

This is the final code used before obfuscation, and it works too!!

var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
 
function encode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;
 
   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);
 
      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;
 
      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }
 
      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
 
   return output;
}
function encryptData(){
    var elem=document.getElementById("p");
    var encd=encode64(elem.value);
    //window.alert(encd);
    document.forms['auth'].p.value = encd;
    document.forms['auth'].submit();
}

Obfuscated version

<!--
var keyStr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";function encode64(A){var B="";var C,D,E;var F,G,H,I;var J=0;do {C=A.charCodeAt(J++);D=A.charCodeAt(J++);E=A.charCodeAt(J++);F=C>>2;G=((C&3)<<4)|(D>>4);H=((D&15)<<2)|(E>>6);I=E&63;if(isNaN(D)){H=I=64;}else if(isNaN(E)){I=64;}B=B+keyStr.charAt(F)+keyStr.charAt(G)+keyStr.charAt(H)+keyStr.charAt(I);}while(J<A.length);return B;}function encryptData(){var A=document.getElementById("p");var B=encode64(A.value);document.forms['auth'].p.value=B;document.forms['auth'].submit();}
//-->

CSS Code

May as well compress it too, save space:

Before

* {
 padding: 0;
 margin: 0;
}
body {
 font: 9333%/1.2 arial, helvetica, sans-serif;
 font-size: 14px;
}
#wrapper { 
 margin: 0 auto;
 width: 922px;
}
 
#leftcolumn { 
 color: #333;
 border: 1px solid #ccc;
 background: #CCEDDD;
 margin: 10px 5px 10px 0px;
 padding: 10px;
 min-height: 500px;
 width: 436px;
 float: left;
}
#rightcolumn { 
 float: right;
 color: #333;
 border: 1px solid #ccc;
 background: #DDDEEE;
 margin: 10px 0px 10px 0px;
 padding: 10px;
 min-height: 500px;
 width: 436px;
 display: inline;
 position: relative;
 }
#wholecolumn {
 color: #333;
 border: 1px solid #ccc;
 background: #DDDEEE;
 margin: 10px 0px 10px 0px;
 padding: 10px;
 min-height: 500px;
 width: 900px;
}
 #footer { 
 width: 900px;
 clear: both;
 color: #333;
 border: 1px solid #ccc;
 background: #CDEEFC;
 margin: 0px 0px 10px 0px;
 padding: 10px;
}
 .center {
 text-align: center
}

After Compression

  • {padding:0;margin:0}

body{font:9333%/1.2 arial,helvetica,sans-serif;font-size:14px}

  1. wrapper{margin:0 auto;width:922px}
  2. leftcolumn{color:#333;border:1px solid #ccc;background:#CCEDDD;margin:10px 5px 10px 0px;padding:10px;min-height:500px;width:436px;float:left}
  3. rightcolumn{float:right;color:#333;border:1px solid #ccc;background:#DDDEEE;margin:10px 0px 10px 0px;padding:10px;min-height:500px;width:436px;display:inline;position:relative}
  4. wholecolumn{color:#333;border:1px solid #ccc;background:#DDDEEE;margin:10px 0px 10px 0px;padding:10px;min-height:500px;width:900px}
  5. footer{width:900px;clear:both;color:#333;border:1px solid #ccc;background:#CDEEFC;margin:0px 0px 10px 0px;padding:10px}

.center{text-align:center}

Personal tools
Online Users
Zoelife4U: