Sivo 悉见

插件编写规范和流程

匿名 · 更新于 2015/1/15

为了能让更多的人加入到编写插件的队伍中来,避免由于编写不规范而引起论坛安全问题.写了这么一个文档,希望对插件作者和对插件有浓厚兴趣的有多帮助。前面泡哥已经写过一个关于怎么写插件的帖子了(http://www.discuz.net/thread-315307-1-1.html),当时写的是Discuz4.x的,关于Discuz5一直没更新,我就补上我这篇.有什么建议欢迎大家讨论.
也不罗嗦了,马上就开始写插件吧,都说光看不练是不行的.这次我就拿怎么重新编写规范的<<斑竹申请>>这个插件来给大家讲解一下,写插件的流程.当然应该还是要感谢原作者的创意.

NO.1.
        一个好的插件来源于好的想法和好的结构设计.一个程序的开发,50%的时间不是用在代码开发上,而在设计和分析上。插件也是,第一步当然是分析插件的功能需要用到什么,怎么实现,怎么设计了.这里原作者已经给帮我们想好了。我们就按他的思路来走一边吧.
在开始之前,我先简单的说一下变量的命名尽量使用能一目了然的英文意思,不要拼音,英文合用.
先找到与Discuz相关联的地方
申请斑竹的要求:
        会员最多能申请次数:                applycount                                int
        注册时间不少于几天:                lowestregdates                        int
        最低要求积分数 :                integral                                int
        相关的积分扩展 :                extcredit                                        text
        最低发贴数          :                lowestposts                        int
和Discuz相关联的地方我们已经设计好了。这样就可以先去后台把相关的地方设置好了.
扩展设置->插件管理
 

添加以后,选右边的详情在进行设置.在设置之前,我们先来介绍一个标准的插件的文件和目录结构.这个在泡哥的帖子里已经说过一次了,我再重复一次吧.
D:\WWW\Discuz\plugins
└─ apply                                ------插件整体目录
    ├─images                        ------插件图片目录
    │  └─img_apply                                   
    ├─apply                        -------插件程序存放目录
    └─templates                        -------插件模块存放目录
        └─defaults
        |------apply.lang.php                -------语言包(这个是可选的)
        |------apply.htm                -------模版文件用htm结尾
        |------adminapply.htm
|----apply.inc.php                        --------插件程序配置文件
|----discuz_plugin_apply.txt                --------这个是生成的.
|----apply.sql                        --------数据库表文件
|-----readme.txt
 
 
 
 

NO.2设计数据库
        这里我就不多复述了。给出我的表结构:
表名:cdb_plugin_apply
appid                     申请ID
uid                         用户ID
username               用户名
fid                         版块ID
fname                    版块名
suggest                申请建议
description            自我介绍
nettime                上网时间
dateline                申请时间
agreeapply            是否同意


前期的设计到这里就结束了.

NO.3 程序的开发--程序不但要考虑安全,效率,也要考虑代码的编写规范和美观.
Discuz调用插件的过程是先访问plugins/apply/apply.inc.php(这里的apply目录名是上面我们自己指定好的),所有的插件访问过程都是从apply.inc.php开始的.那我们的程序编写也从这个开始.
  1.  
  2. <?php
  3. If(!defined('IN_DISCUZ')) {
  4.         Exit('Access Deined');
  5. }
  6.  
复制代码


建议:在每个插件程序的开头加上上面的代码.这是为了防止禁止直接外部访问文件
					<div class="blockcode" style="word-wrap: break-word; overflow: hidden; margin: 10px 0px; padding: 10px 0px 5px 10px; background-image: url(http://www.discuz.net/static/image/common/codebg.gif); background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); background-position: 0px 0px; background-repeat: no-repeat repeat; ">
					<div id="code_wz2" style="word-wrap: break-word; ">
					<ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding-right: 0px !important; padding-left: 0px !important; ">
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">@include_once DISCUZ_ROOT.&#39;./forumdata/cache/plugin_apply.php&#39;;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
					</ol>
					</div>
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><em style="word-wrap: break-word; font-style: normal; color: rgb(51, 102, 153) !important; margin-left: 43px; font-size: 12px; cursor: pointer; ">复制代码</em></em></div>
					<br style="word-wrap: break-word; " />
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><font color="Red" style="word-wrap: break-word; ">调用DISCUZ生成的插件参数的缓存文件.调用缓存文件以后,就可以调用里面的变量了.<br style="word-wrap: break-word; " />
					Discuz生成的插件参数的配置文件是保存在一个二维的数组里的。$_DPLUGIN[&lsquo;apply&rsquo;][&lsquo;vars&rsquo;];</font><br style="word-wrap: break-word; " />
					这里我们为了美观,对这个二维数组进行一下简化</em>

					<div class="blockcode" style="word-wrap: break-word; overflow: hidden; margin: 10px 0px; padding: 10px 0px 5px 10px; background-image: url(http://www.discuz.net/static/image/common/codebg.gif); background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); background-position: 0px 0px; background-repeat: no-repeat repeat; ">
					<div id="code_udS" style="word-wrap: break-word; ">
					<ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding-right: 0px !important; padding-left: 0px !important; ">
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$applycount = $_DPLUGIN[&#39;apply&#39;][&#39;vars&#39;][&#39;applycount&#39;];</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$lowestregdates = $_DPLUGIN[&#39;apply&#39;][&#39;vars&#39;][&#39;lowestregdates&#39;];</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$integral = $_DPLUGIN[&#39;apply&#39;][&#39;vars&#39;][&#39;integral&#39;];</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$extcredit = $_DPLUGIN[&#39;apply&#39;][&#39;vars&#39;][&#39;extcredit&#39;];</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$lowestposts = $_DPLUGIN[&#39;apply&#39;][&#39;vars&#39;][&#39;lowestposts&#39;];</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
					</ol>
					</div>
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><em style="word-wrap: break-word; font-style: normal; color: rgb(51, 102, 153) !important; margin-left: 43px; font-size: 12px; cursor: pointer; ">复制代码</em></em></div>
					<br style="word-wrap: break-word; " />
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">到这里插件的初始化就完成了.在继续我们的插件编写之前.我先介绍一下Discuz对变量是怎么处理,怎样才写出安全的插件.<br style="word-wrap: break-word; " />
					大家可以先看一下Discuz的include/目录下的common.inc.php文件的第31行和global.func.php的111行.这个Discuz在进行数据处理之前,首先进行的初始化功能,</em>

					<div class="blockcode" style="word-wrap: break-word; overflow: hidden; margin: 10px 0px; padding: 10px 0px 5px 10px; background-image: url(http://www.discuz.net/static/image/common/codebg.gif); background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); background-position: 0px 0px; background-repeat: no-repeat repeat; ">
					<div id="code_LnV" style="word-wrap: break-word; ">
					<ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding-right: 0px !important; padding-left: 0px !important; ">
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$magic_quotes_gpc = get_magic_quotes_gpc();</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">@extract(daddslashes($_COOKIE));</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">@extract(daddslashes($_POST));</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">@extract(daddslashes($_GET));</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">if(!$magic_quotes_gpc) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $_FILES = daddslashes($_FILES);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">}</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">function daddslashes($string, $force = 0) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if(!$GLOBALS[&#39;magic_quotes_gpc&#39;] || $force) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if(is_array($string)) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; foreach($string as $key =&gt; $val) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $string[$key] = daddslashes($val, $force);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } else {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $string = addslashes($string);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; return $string;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">}</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
					</ol>
					</div>
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><em style="word-wrap: break-word; font-style: normal; color: rgb(51, 102, 153) !important; margin-left: 43px; font-size: 12px; cursor: pointer; ">复制代码</em></em></div>
					<br style="word-wrap: break-word; " />
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">这两段的代码功能就是在magic_quotes_gpc为off的情况,对$_GET,$_POST,$_COOKIE的值以及数组里面的每个值都进行转义,因为在magic_quotes_gpc为On时PHP本身自动会对这几个全局的变量进行转义,这些具体的内容介绍,可以看一下PHP相关的资料.<br style="word-wrap: break-word; " />
					从这里可以看出Discuz本身已经对变量做了一个安全的处理.在编写插件时就应该尽量使用Discuz处理过的变量.<br style="word-wrap: break-word; " />
					因为我们在开头使用了defined(&lsquo;IN_DISCUZ&rsquo;)进行判断.现在所有想访问此文件的都必须从Discuz过来,也就会经过common.inc.php对变量进行处理.<br style="word-wrap: break-word; " />
					<br style="word-wrap: break-word; " />
					<font color="Red" style="word-wrap: break-word; ">这里需要强调的一点:<br style="word-wrap: break-word; " />
					Discuz是对提交过来的变量的值进行了转义,我们可以认为他过来的值就是一个字符串,那么在使用他的时候,要尽量放在一个不会解析变量的单引号内.这样无论是安全还是效率都会有所提高.尤其是在SQL语句中.一定要把变量放在单引号呢。例如<br style="word-wrap: break-word; " />
					$db-&gt;query(&quot;SELECT * FROM cdb_members WHERE uid=&#39;$discuz_uid&#39;&quot;);</font><br style="word-wrap: break-word; " />
					再说几个写插件时经常要用到的函数,其实有很多东西Discuz已经帮大家做好了,大家可以拿来就用.具体的使用可以查找Discuz的代码<br style="word-wrap: break-word; " />
					常用的函数:<br style="word-wrap: break-word; " />
					include template(&#39;apply&#39;) 调用模版&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;(模版名一定要以htm结束,如apply.htm)<br style="word-wrap: break-word; " />
					include language(&#39;apply&#39;) 调用语言包&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;(语言包的命名上面已经说了,apply.lang.php)<br style="word-wrap: break-word; " />
					showmessage &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;提示信息&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp;<br style="word-wrap: break-word; " />
					例如:showmessage(&#39;not_loggedin&#39;,&#39;logging.php?action=login&#39;);<br style="word-wrap: break-word; " />
					<font color="Red" style="word-wrap: break-word; ">dhtmlspecialchars&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 对html标签进行转义<br style="word-wrap: break-word; " />
					FORMHASH&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 生成表单唯一的标识<br style="word-wrap: break-word; " />
					ispage()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 判断页号是否是数字<br style="word-wrap: break-word; " />
					multi()&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 分页函数<br style="word-wrap: break-word; " />
					sendpm&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 发送短消息<br style="word-wrap: break-word; " />
					forumselect()</font><br style="word-wrap: break-word; " />
					数据库操作类<br style="word-wrap: break-word; " />
					$db-&gt;query();<br style="word-wrap: break-word; " />
					$db-&gt;result();<br style="word-wrap: break-word; " />
					$db-&gt;fetch_array();<br style="word-wrap: break-word; " />
					<br style="word-wrap: break-word; " />
					常用的常量:<br style="word-wrap: break-word; " />
					$discuz_uid,$discuz_user,$adminid</em></td>
				</tr>
			</tbody>
		</table>
		</div>
		</div>
		</div>
		</td>
	</tr>
</tbody>
OK,现在可以进行核心代码的编写了.
先来判断是否已经登陆,如果你想允许游客也可以访问去掉这个就可以了。但一定要分清楚那些是必须要登陆才有权限操作的
'not_loggedin'这个是已经在discuz语言包里定义好的内容
					<div class="blockcode" style="word-wrap: break-word; overflow: hidden; margin: 10px 0px; padding: 10px 0px 5px 10px; background-image: url(http://www.discuz.net/static/image/common/codebg.gif); background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); background-position: 0px 0px; background-repeat: no-repeat repeat; ">
					<div id="code_WL3" style="word-wrap: break-word; ">
					<ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding-right: 0px !important; padding-left: 0px !important; ">
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">if(!$discuz_uid) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;not_loggedin&#39;,&#39;logging.php?action=login&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">}</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
					</ol>
					</div>
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><em style="word-wrap: break-word; font-style: normal; color: rgb(51, 102, 153) !important; margin-left: 43px; font-size: 12px; cursor: pointer; ">复制代码</em></em></div>
					&nbsp;

					<div class="blockcode" style="word-wrap: break-word; overflow: hidden; margin: 10px 0px; padding: 10px 0px 5px 10px; background-image: url(http://www.discuz.net/static/image/common/codebg.gif); background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); background-position: 0px 0px; background-repeat: no-repeat repeat; ">
					<div id="code_Ye9" style="word-wrap: break-word; ">
					<ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding-right: 0px !important; padding-left: 0px !important; ">
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$applys = $apply = $applylist = &#39;&#39;;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$page = !ispage($page) ? 1 : $page;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$start_limit = ($page - 1) * 10;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
					</ol>
					</div>
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><em style="word-wrap: break-word; font-style: normal; color: rgb(51, 102, 153) !important; margin-left: 43px; font-size: 12px; cursor: pointer; ">复制代码</em></em></div>
					<br style="word-wrap: break-word; " />
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">这是将要用到的变量的初始化和分页的处理,你可以搜索一下DZ处理分页的函数ispage(),multi(),他会生成一个分页的代码,<br style="word-wrap: break-word; " />
					填上相应的参数以后就可以直接放在模块了使用了。<br style="word-wrap: break-word; " />
					<font color="Red" style="word-wrap: break-word; ">注意:记得对变量初始化,这是一个好的习惯,也可以避免安全问题。</font><br style="word-wrap: break-word; " />
					<br style="word-wrap: break-word; " />
					下面是处理申请的流程。你可以先画个流程图,把一些情况先考虑清楚了。这样写程序会比较清晰,也不会容易犯错。</em>

					<div class="blockcode" style="word-wrap: break-word; overflow: hidden; margin: 10px 0px; padding: 10px 0px 5px 10px; background-image: url(http://www.discuz.net/static/image/common/codebg.gif); background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); background-position: 0px 0px; background-repeat: no-repeat repeat; ">
					<div id="code_rqQ" style="word-wrap: break-word; ">
					<ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding-right: 0px !important; padding-left: 0px !important; ">
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">if($action == &#39;apply&#39;) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //申请斑竹</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $query = $db-&gt;query(&quot;SELECT count(appid) FROM cdb_plugin_apply WHERE uid=&#39;$discuz_uid&#39;&quot;);&nbsp;&nbsp;//查看申请用户的申请次数</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $applys = $db-&gt;result($query,0);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //$db-&gt;result($query,0)可以用来取得一个记录值</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if($applys &gt;= $applycount) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //判断是否申请次数</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;你已经到达了申请的最多次数,请耐心等待管理员的审核&#39;,&#39;plugin.php?identifier=apply&amp;module=apply&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; } else {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; require_once DISCUZ_ROOT.&#39;./include/forum.func.php&#39;;&nbsp; &nbsp; &nbsp; &nbsp; //包含相关与论坛帖子相关的文件。这里因为下面的forumselect()函数需要用到</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; require_once DISCUZ_ROOT.&#39;./forumdata/cache/cache_forums.php&#39;;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $forumselect = &quot;&lt;select name=\&quot;fid\&quot;&gt;\n&lt;option value=\&quot;\&quot;&gt;&amp;nbsp;&amp;nbsp;&gt;请选择版块&lt;/option&gt;&lt;option value=\&quot;\&quot;&gt;&amp;nbsp;&lt;/option&gt;&quot;.str_replace(&#39;%&#39;, &#39;%%&#39;, forumselect()).&#39;&lt;/select&gt;&#39;;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //这里是生成下拉采单式的版块选择,你可以看看DZ的操作方式</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; include_once DISCUZ_ROOT . &#39;./plugins/apply/apply/apply.php&#39;;&nbsp; &nbsp; &nbsp; &nbsp; //到apply目录下用对应的程序来处理申请的过程</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">} elseif ($action == &#39;del&#39;) {&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //这里是删除用户申请的过程</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if($discuz_uid == $uid || $admin == 1 &amp;&amp; $formhash == FORMHASH) {&nbsp; &nbsp; &nbsp; &nbsp; //只有用户和管理员才有权限删除</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $db-&gt;query(&quot;DELETE FROM cdb_plugin_apply WHERE uid=&#39;$discuz_uid&#39; AND fid=&#39;$fid&#39;&quot;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;操作成功&#39;,&#39;plugin.php?identifier=apply&amp;module=apply&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; } else&nbsp;&nbsp;{</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;禁止非法操作&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">} else {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $query = $db-&gt;query(&quot;SELECT * FROM cdb_plugin_apply LIMIT $start_limit,10&quot;); //取得记录,并格式化时间</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; while($apply = $db-&gt;fetch_array($query)) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $apply[&#39;dateline&#39;] = gmdate(&quot;$dateformat $timeformat&quot;, $apply[&#39;dateline&#39;] + $timeoffset * 3600);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $applylist[] = $apply;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $query = $db-&gt;query(&quot;SELECT COUNT(*) FROM cdb_plugin_apply&quot;);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //分页显示</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $applynum = $db-&gt;result($query,0);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $multipage = multi($applynum, 10, $page, &quot;plugin.php?identifier=apply&amp;module=apply&quot;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; include template(&#39;apply&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">}</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
					</ol>
					</div>
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><em style="word-wrap: break-word; font-style: normal; color: rgb(51, 102, 153) !important; margin-left: 43px; font-size: 12px; cursor: pointer; ">复制代码</em></em></div>
					<br style="word-wrap: break-word; " />
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">到这里apply.inc.php文件已经可以说是写完了。有什么问题,跟贴提问吧。</em></td>
				</tr>
			</tbody>
		</table>
		</div>
		</div>
		</div>
		</td>
	</tr>
</tbody>
上面当你访问插件的时候,初始化文件已经写完了
下面就是具体功能的实现了。
					<div class="blockcode" style="word-wrap: break-word; overflow: hidden; margin: 10px 0px; padding: 10px 0px 5px 10px; background-image: url(http://www.discuz.net/static/image/common/codebg.gif); background-color: rgb(247, 247, 247); color: rgb(102, 102, 102); zoom: 1; border: 1px solid rgb(204, 204, 204); background-position: 0px 0px; background-repeat: no-repeat repeat; ">
					<div id="code_q2j" style="word-wrap: break-word; ">
					<ol style="word-wrap: break-word; margin: 0px 0px 0px 10px !important; padding-right: 0px !important; padding-left: 0px !important; ">
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&lt;?php</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">if(!defined(&#39;IN_DISCUZ&#39;)) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; exit(&#39;ACCESS Diened&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">}</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$total = $userinfo = &#39;&#39;;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$query = $db-&gt;query(&quot;SELECT count(uid) FROM cdb_plugin_apply WHERE uid=&#39;$discuz_uid&#39;&quot;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$total = $db-&gt;result($query,0);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$query = $db-&gt;query(&quot;SELECT posts,$extcredit,regdate FROM {$tablepre}members WHERE uid=&#39;$discuz_uid&#39;&quot;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$userinfo = $db-&gt;fetch_array($query);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$userinfo[&#39;regdate&#39;] = $timestamp - $userinfo[&#39;regdate&#39;];</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">$userinfo[&#39;regdate&#39;] = ceil($userinfo[&#39;regdate&#39;] / (3600*24));</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">if(submitcheck(&#39;forumsubmit&#39;)) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if($userinfo[&#39;regdate&#39;] &lt; $lowestregdates || $userinfo[$extcredit] &lt; $integral || $userinfo[&#39;posts&#39;] &lt; $lowestposts) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;请仔细查看申请斑竹的条件&#39;,&#39;plugin.php?identifier=apply&amp;module=apply&amp;action=apply&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $query = $db-&gt;query(&quot;SELECT name FROM {$tablepre}forums WHERE fid=&#39;$fid&#39;&quot;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $fname = $db-&gt;result($query,0);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if(empty($fname)){</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;请选择正确的版块&#39;,&#39;javascript:history.go(-1)&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; } else {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $query = $db-&gt;query(&quot;SELECT COUNT(*) FROM cdb_plugin_apply WHERE uid=&#39;$discuz_uid&#39; AND fid=&#39;$fid&#39;&quot;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if($db-&gt;result($query,0)) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;请不要重复申请相同的版块&#39;,&#39;javascript:history.go(-1)&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if(empty($nettime)) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;上网时间不能为空&#39;,&#39;javascript:history.go(-1)&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; } else {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $nettime = intval($nettime);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if(!empty($description) &amp;&amp; strlen($description) &gt;= 16) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $description = nl2br(dhtmlspecialchars($description));</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; } else {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;自我介绍不能为空,或者少与16个字&#39;,&#39;javascript:history.go(-1)&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; if(!(empty($suggest) &amp;&amp; strlen($suggest) &gt;= 16)) {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $suggest = nl2br(dhtmlspecialchars($suggest));</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; } else {</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;建议不能为空,或者少于16个字&#39;,&#39;javascript:history.go(-1)&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; }</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; $db-&gt;query(&quot;INSERT INTO cdb_plugin_apply (`uid`,`username`,`fid`,`fname`,`suggest`,`description`,`nettime`,`dateline`,`agreeapply`)&nbsp;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; VALUES (&#39;$discuz_uid&#39;,&#39;$discuz_user&#39;,&#39;$fid&#39;,&#39;$fname&#39;,&#39;$suggest&#39;,&#39;$description&#39;,&#39;$nettime&#39;,&#39;$timestamp&#39;,&#39;$agreeapply&#39;)&quot;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">&nbsp; &nbsp; &nbsp; &nbsp; showmessage(&#39;请耐心等待管理的审核&#39;,&#39;plugin.php?identifier=apply&amp;module=apply&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">}&nbsp;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">include template(&#39;apply&#39;);</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; "><em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">?&gt;</em></li>
						<li style="word-wrap: break-word; margin: 0px 0px 0px 2em; padding: 0px 0px 0px 10px; list-style-type: decimal-leading-zero; font-family: Monaco, Consolas, 'Lucida Console', 'Courier New', serif; font-size: 12px; line-height: 1.8em; ">&nbsp;</li>
					</ol>
					</div>
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; "><em style="word-wrap: break-word; font-style: normal; color: rgb(51, 102, 153) !important; margin-left: 43px; font-size: 12px; cursor: pointer; ">复制代码</em></em></div>
					<br style="word-wrap: break-word; " />
					<br style="word-wrap: break-word; " />
					<em style="word-wrap: break-word; font-style: normal; color: rgb(68, 68, 68); font-family: Tahoma, 'Microsoft Yahei', Simsun; font-size: 12px; line-height: 18px; ">这次先不加注释,大家先自己看看,看看常用的函数会不会使用了。哪里不懂的。提问,我会及时回复的。</em></td>
				</tr>
			</tbody>
		</table>
		</div>
		</div>
		</div>
		</td>
	</tr>
</tbody>