十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
实现办法:
十年的利川网站建设经验,针对设计、前端、开发、售后、文案、推广等六对一服务,响应快,48小时及时工作处理。营销型网站建设的优势是能够根据用户设备显示端的尺寸不同,自动调整利川建站的显示方式,使网站能够适用不同显示终端,在浏览器中调整网站的宽度,无论在任何一种浏览器上浏览网站,都能展现优雅布局与设计,从而大程度地提升浏览体验。创新互联从事“利川网站设计”,“利川网站推广”以来,每个客户项目都认真落实执行。
(1)利用弹出窗口封锁鼠标右键将下面这段代码放在网页HTML代码的标志中,就可以实现封锁右键,给网页加密。
(2)弹出“添加收藏夹”封锁鼠标右键将下面这段代码放在网页的HTML代码的标志中。实现点击右键出现“添加到收藏夹”选项。
(3)彻底封锁鼠标右键将下面这段代码放在网页的HTML代码的标志中能够实现彻底封锁鼠标右键的效果,由于这个脚本在右键按下时调用一个函数,所以可以改为很多种类型。即使按下左键,再按下右键,放开左键,再放开右键的方法也还是破解不了。
(4)禁止查看源文件将下面这段代码放在网页的HTML代码的标志中则可以实现禁止利用IE浏览器查看源文件。
(5)用乱码显示链接、调用地址加密。利用某些函数把URL字符转换成ASCII码,从而达到隐藏链接Frame页面和*.js,*.asp等脚本的目的。返回ASCII码escape(character),ASCII码为%XX格式,XX是十六进制,如空格键为%20。返回字符unEscape(string)。
加密和解密原则上都应该在后台完成才合乎常理,如果在前端加密,就好比在众目睽睽之下化妆易容,然后声称自己是另一个人一样,没意义啊。
如果一定要在前端加密,可以这样:
input type="submit" name="submit" value="注册" onclick="var pwd=document.getElementsByName('password')[0];pwd.value=md5(pwd.value);"/
var hexcase=0;
function encryptToMD5(a){ if(a=="") return a; return rstr2hex(rstr_md5(str2rstr_utf8(a)))}function hex_hmac_md5(a,b){return rstr2hex(rstr_hmac_md5(str2rstr_utf8(a),str2rstr_utf8(b)))}function md5_vm_test(){return hex_md5("abc").toLowerCase()=="900150983cd24fb0d6963f7d28e17f72"}function rstr_md5(a){return binl2rstr(binl_md5(rstr2binl(a),a.length*8))}function rstr_hmac_md5(c,f){var e=rstr2binl(c);if(e.length16){e=binl_md5(e,c.length*8)}var a=Array(16),d=Array(16);for(var b=0;b16;b++){a[b]=e[b]^909522486;d[b]=e[b]^1549556828}var g=binl_md5(a.concat(rstr2binl(f)),512+f.length*8);return binl2rstr(binl_md5(d.concat(g),512+128))}function rstr2hex(c){try{hexcase}catch(g){hexcase=0}var f=hexcase?"0123456789ABCDEF":"0123456789abcdef";var b="";var a;for(var d=0;dc.length;d++){a=c.charCodeAt(d);b+=f.charAt((a4)15)+f.charAt(a15)}return b}function str2rstr_utf8(c){var b="";var d=-1;var a,e;while(++dc.length){a=c.charCodeAt(d);e=d+1c.length?c.charCodeAt(d+1):0;if(55296=aa=5631956320=ee=57343){a=65536+((a1023)10)+(e1023);d++}if(a=127){b+=String.fromCharCode(a)}else{if(a=2047){b+=String.fromCharCode(192|((a6)31),128|(a63))}else{if(a=65535){b+=String.fromCharCode(224|((a12)15),128|((a6)63),128|(a63))}else{if(a=2097151){b+=String.fromCharCode(240|((a18)7),128|((a12)63),128|((a6)63),128|(a63))}}}}}return b}function rstr2binl(b){var a=Array(b.length2);for(var c=0;ca.length;c++){a[c]=0}for(var c=0;cb.length*8;c+=8){a[c5]|=(b.charCodeAt(c/8)255)(c%32)}return a}function binl2rstr(b){var a="";for(var c=0;cb.length*32;c+=8){a+=String.fromCharCode((b[c5](c%32))255)}return a}function binl_md5(p,k){p[k5]|=128((k)%32);p[(((k+64)9)4)+14]=k;var o=1732584193;var n=-271733879;var m=-1732584194;var l=271733878;for(var g=0;gp.length;g+=16){var j=o;var h=n;var f=m;var e=l;o=md5_ff(o,n,m,l,p[g+0],7,-680876936);l=md5_ff(l,o,n,m,p[g+1],12,-389564586);m=md5_ff(m,l,o,n,p[g+2],17,606105819);n=md5_ff(n,m,l,o,p[g+3],22,-1044525330);o=md5_ff(o,n,m,l,p[g+4],7,-176418897);l=md5_ff(l,o,n,m,p[g+5],12,1200080426);m=md5_ff(m,l,o,n,p[g+6],17,-1473231341);n=md5_ff(n,m,l,o,p[g+7],22,-45705983);o=md5_ff(o,n,m,l,p[g+8],7,1770035416);l=md5_ff(l,o,n,m,p[g+9],12,-1958414417);m=md5_ff(m,l,o,n,p[g+10],17,-42063);n=md5_ff(n,m,l,o,p[g+11],22,-1990404162);o=md5_ff(o,n,m,l,p[g+12],7,1804603682);l=md5_ff(l,o,n,m,p[g+13],12,-40341101);m=md5_ff(m,l,o,n,p[g+14],17,-1502002290);n=md5_ff(n,m,l,o,p[g+15],22,1236535329);o=md5_gg(o,n,m,l,p[g+1],5,-165796510);l=md5_gg(l,o,n,m,p[g+6],9,-1069501632);m=md5_gg(m,l,o,n,p[g+11],14,643717713);n=md5_gg(n,m,l,o,p[g+0],20,-373897302);o=md5_gg(o,n,m,l,p[g+5],5,-701558691);l=md5_gg(l,o,n,m,p[g+10],9,38016083);m=md5_gg(m,l,o,n,p[g+15],14,-660478335);n=md5_gg(n,m,l,o,p[g+4],20,-405537848);o=md5_gg(o,n,m,l,p[g+9],5,568446438);l=md5_gg(l,o,n,m,p[g+14],9,-1019803690);m=md5_gg(m,l,o,n,p[g+3],14,-187363961);n=md5_gg(n,m,l,o,p[g+8],20,1163531501);o=md5_gg(o,n,m,l,p[g+13],5,-1444681467);l=md5_gg(l,o,n,m,p[g+2],9,-51403784);m=md5_gg(m,l,o,n,p[g+7],14,1735328473);n=md5_gg(n,m,l,o,p[g+12],20,-1926607734);o=md5_hh(o,n,m,l,p[g+5],4,-378558);l=md5_hh(l,o,n,m,p[g+8],11,-2022574463);m=md5_hh(m,l,o,n,p[g+11],16,1839030562);n=md5_hh(n,m,l,o,p[g+14],23,-35309556);o=md5_hh(o,n,m,l,p[g+1],4,-1530992060);l=md5_hh(l,o,n,m,p[g+4],11,1272893353);m=md5_hh(m,l,o,n,p[g+7],16,-155497632);n=md5_hh(n,m,l,o,p[g+10],23,-1094730640);o=md5_hh(o,n,m,l,p[g+13],4,681279174);l=md5_hh(l,o,n,m,p[g+0],11,-358537222);m=md5_hh(m,l,o,n,p[g+3],16,-722521979);n=md5_hh(n,m,l,o,p[g+6],23,76029189);o=md5_hh(o,n,m,l,p[g+9],4,-640364487);l=md5_hh(l,o,n,m,p[g+12],11,-421815835);m=md5_hh(m,l,o,n,p[g+15],16,530742520);n=md5_hh(n,m,l,o,p[g+2],23,-995338651);o=md5_ii(o,n,m,l,p[g+0],6,-198630844);l=md5_ii(l,o,n,m,p[g+7],10,1126891415);m=md5_ii(m,l,o,n,p[g+14],15,-1416354905);n=md5_ii(n,m,l,o,p[g+5],21,-57434055);o=md5_ii(o,n,m,l,p[g+12],6,1700485571);l=md5_ii(l,o,n,m,p[g+3],10,-1894986606);m=md5_ii(m,l,o,n,p[g+10],15,-1051523);n=md5_ii(n,m,l,o,p[g+1],21,-2054922799);o=md5_ii(o,n,m,l,p[g+8],6,1873313359);l=md5_ii(l,o,n,m,p[g+15],10,-30611744);m=md5_ii(m,l,o,n,p[g+6],15,-1560198380);n=md5_ii(n,m,l,o,p[g+13],21,1309151649);o=md5_ii(o,n,m,l,p[g+4],6,-145523070);l=md5_ii(l,o,n,m,p[g+11],10,-1120210379);m=md5_ii(m,l,o,n,p[g+2],15,718787259);n=md5_ii(n,m,l,o,p[g+9],21,-343485551);o=safe_add(o,j);n=safe_add(n,h);m=safe_add(m,f);l=safe_add(l,e)}return Array(o,n,m,l)}function md5_cmn(h,e,d,c,g,f){return safe_add(bit_rol(safe_add(safe_add(e,h),safe_add(c,f)),g),d)}function md5_ff(g,f,k,j,e,i,h){return md5_cmn((fk)|((~f)j),g,f,e,i,h)}function md5_gg(g,f,k,j,e,i,h){return md5_cmn((fj)|(k(~j)),g,f,e,i,h)}function md5_hh(g,f,k,j,e,i,h){return md5_cmn(f^k^j,g,f,e,i,h)}function md5_ii(g,f,k,j,e,i,h){return md5_cmn(k^(f|(~j)),g,f,e,i,h)}function safe_add(a,d){var c=(a65535)+(d65535);var b=(a16)+(d16)+(c16);return(b16)|(c65535)}function bit_rol(a,b){return(ab)|(a(32-b))};
这是javascript的md5算法,测试过跟java的MD5加出来是一样的
使用方法:
var md5Pwd = encryptToMD5(str);
MD5不是加密算法,它是Hash算法,所以它不可逆,也没法还原成原文。
你可以用base64、异或或者aes des等加密算法去实现。
1、base64加密
在页面中引入base64.js文件,调用方法为:
?
123456789101112131415161718
!DOCTYPE HTMLhtmlheadmeta charset="utf-8"titlebase64加密/titlescript type="text/javascript" src="base64.js"/scriptscript type="text/javascript" var b = new Base64(); var str = b.encode("admin:admin"); alert("base64 encode:" + str);//解密 str = b.decode(str); alert("base64 decode:" + str);/script/headbody/body/html
2、md5加密
在页面中引用md5.js文件,调用方法为
?
1234567891011121314
!DOCTYPE HTMLhtmlheadmeta charset="utf-8"titlemd5加密/titlescript type="text/ecmascript" src="md5.js"/scriptscript type="text/javascript" var hash = hex_md5("123dafd"); alert(hash)/script/headbody/body/html
3、sha1加密
据说这是最安全的加密
页面中引入sha1.js,调用方法为
?
1234567891011121314
!DOCTYPE HTMLhtmlheadmeta charset="utf-8"titlesha1加密/titlescript type="text/ecmascript" src="sha1.js"/scriptscript type="text/javascript" var sha = hex_sha1('mima123465') alert(sha)/script/headbody/body/html
一下为js们的源代码
base64.js:
?
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
/**** Base64 encode / decode** @author haitao.tu* @date 2010-04-26* @email tuhaitao@foxmail.com**/function Base64() { // private property _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; // public method for encoding this.encode = function (input) { var output = ""; var chr1, chr2, chr3, enc1, enc2, enc3, enc4; var i = 0; input = _utf8_encode(input); while (i input.length) { 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); } return output; } // public method for decoding this.decode = function (input) { var output = ""; var chr1, chr2, chr3; var enc1, enc2, enc3, enc4; var i = 0; input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ""); while (i input.length) { 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); } } output = _utf8_decode(output); return output; } // private method for UTF-8 encoding _utf8_encode = function (string) { string = string.replace(/\r\n/g,"\n"); var utftext = ""; for (var n = 0; n string.length; n++) { var c = string.charCodeAt(n); if (c 128) { utftext += String.fromCharCode(c); } else if((c 127) (c 2048)) { utftext += String.fromCharCode((c 6) | 192); utftext += String.fromCharCode((c 63) | 128); } else { utftext += String.fromCharCode((c 12) | 224); utftext += String.fromCharCode(((c 6) 63) | 128); utftext += String.fromCharCode((c 63) | 128); } } return utftext; } // private method for UTF-8 decoding _utf8_decode = function (utftext) { var string = ""; var i = 0; var c = c1 = c2 = 0; while ( i utftext.length ) { c = utftext.charCodeAt(i); if (c 128) { string += String.fromCharCode(c); i++; } else if((c 191) (c 224)) { c2 = utftext.charCodeAt(i+1); string += String.fromCharCode(((c 31) 6) | (c2 63)); i += 2; } else { c2 = utftext.charCodeAt(i+1); c3 = utftext.charCodeAt(i+2); string += String.fromCharCode(((c 15) 12) | ((c2 63) 6) | (c3 63)); i += 3; } } return string; }}
两个功能是一样的,min的那个是压缩过的,文件比较小,因为把空格什么的都压缩掉了,所以打开看上去比较乱,如果你想研究一下里面的代码,就用没有min的那个。
jquery.sha1.js 具体解决方案如下:
用script标签引入,,,,代码
script src="....."/script
script language="JScript" runAt="server"
function add(x, y)
{
return ((x0x7FFFFFFF) + (y0x7FFFFFFF)) ^ (x0x80000000) ^ (y0x80000000);
}
function MD5hex(i)
{
var sHex = "0123456789abcdef"
h = "";
for(j = 0; j = 3; j++)
{
h += sHex.charAt((i (j * 8 + 4)) 0x0F) +
sHex.charAt((i (j *) 0x0F);
}
return h;
}