DedeCMS 仅限会员发表评论的修改方法
只有会员才可以发表评论。 实现原理:判断是否登录,是,则加载评论框和按钮等,否,则提示只有注册或登录后才可以发表评论。
下面列出需要修改的文件的代码:
1、文章页模板article_article.htm (以下代码插入你模板的合适位置):
Copy to ClipboardLiehuo.Net Codes引用的内容:[www.dede58.com]
<div class="box">
<h2><a name="comment">评论内容</a></h2>
<p> </p>
<div class="content">
<form action="{dede:field name='phpurl'/}/feedback.php" method="post" name="feedback">
<input type="hidden" name="action" value="send" />
<input type="hidden" name="comtype" value="comments">
<input type="hidden" name="aid" value="{dede:field name="id"/}" />
<input type="hidden" name="isconfirm" value="yes" />
<p>
<script language='javascript' type='text/javascript' src="{dede:field name='phpurl'/}/feedback_js.php?aid={dede:field name='id'/}"></script>
<br></p>
<p><label for="txaArticle"></label></p>
<div class="dcmp-userinfo" id="_ajax_feedback">
请您<b><a target="_blank" href="{dede:global.cfg_memberurl/}/index_do.php?fmdo=user&dopost=regnew"><font size="4" color="#008000">注册</font></a></b>或者<b><a target="_blank" href="{dede:global.cfg_memberurl/}/login.php"><font size="4" color="#008000">登录</font></a></b>后发表评论! 忘记密码了?点击<b><a target="_blank" href="{dede:global.cfg_memberurl/}/resetpassword.php"><font color="#008000" size="4">这里</font></a></b>找回密码!
</div>
<script language="javascript" type="text/javascript">CheckLogin();</script>
</p><br>
</form>
</div></div>
2、member目录下的ajax_feedback.php (全部内容):
Copy to ClipboardLiehuo.Net Codes引用的内容:[www.dede58.com]
<?php
require_once(dirname(__FILE__)."/config.php");
AjaxHead();
if($myurl == '')
{
exit('');
}
$uid = $cfg_ml->M_LoginID;
$face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face'];
?>
<p>
<div class="dcmp-mood">
<strong>评价:</strong>
<ul>
<li><input type="radio" name="feedbacktype" checked="1" value="feedback" id="dcmp-stand-neu" /><label for="dcmp-stand-neu"><img src="/templets/images/cmt-neu.gif" />中立</label>
<li><input type="radio" name="feedbacktype" value="good" id="dcmp-stand-good" /><label for="dcmp-stand-good"><img src="/templets/images/cmt-good.gif" />好评</label>
<li><input type="radio" name="feedbacktype" value="bad" id="dcmp-stand-bad" /><label for="dcmp-stand-bad"><img src="/templets/images/cmt-bad.gif" />差评</label>
</ul>
</div>
</p>
<div class="dcmp-mood">
<strong>表情:</strong>
<ul>
<li><input type="radio" name='face' value='6' checked="1" /><img src="/templets/images/mood/ico-mood-6.gif" /></li>
<li><input type="radio" name='face' value='4'/><img src="/templets/images/mood/ico-mood-4.gif" /></li>
<li><input type="radio" name='face' value='3'/><img src="/templets/images/mood/ico-mood-3.gif" /></li>
<li><input type="radio" name='face' value='5'/><img src="/templets/images/mood/ico-mood-5.gif" /></li>
<li><input type="radio" name='face' value='2'/><img src="/templets/images/mood/ico-mood-2.gif" /></li>
<li><input type="radio" name='face' value='1'/><img src="/templets/images/mood/ico-mood-1.gif" /></li>
<li><input type="radio" name='face' value='7'/><img src="/templets/images/mood/ico-mood-7.gif" /></li>
</ul>
</div>
<p><textarea cols="60" name="msg" rows="5" class="ipt-txt" style="width:600px; height:100px;" ></textarea></p>
以用户名 <?php echo $cfg_ml->M_UserName; ?> 发表评论,请控制在200字以内。系统会自动记录你的IP地址,请勿发布非法信息!
<p>验证码:<input name="validate" type="text" id="validate" size="10" style="height:15px;width:50px;margin-right:6px;" class="nb" />
<img src='<?php echo $cfg_cmsurl;?>/include/vdimgck.php' width='50' height='20' />
<input type="submit" id="submit" value="提交评论" class="button" />
<?php if($cfg_feedback_ck=='Y') { ?>
</p>
<?php } ?>
3、templets目录下plus里的feedback_templet_js.htm (全部内容):
Copy to ClipboardLiehuo.Net Codes引用的内容:[www.dede58.com]
{dede:config pagesize='5'/}
{dede:datalist}
<?php
if($fields['userid']!='') $spaceurl = $cfg_basehost.'/member/index.php?uid='.$fields['userid'];
else $spaceurl = "#";
if($fields['username']=='匿名') $spaceurl = "#";
$fields['bgimg'] = 'cmt-neu.gif';
$fields['ftypetitle'] = '该用户表示中立';
if($fields['ftype']=='bad') {
$fields['bgimg'] = 'cmt-bad.gif';
$fields['ftypetitle'] = '该用户表示差评';
}
else if($fields['ftype']=='good') {
$fields['bgimg'] = 'cmt-good.gif';
$fields['ftypetitle'] = '该用户表示好评';
}
?>
document.write("<div class='decmt-box'>");
document.write("<div class='decmt-title'>");
document.write("<span class='moodico'><img src='{dede:global.cfg_templeturl/}/images/mood/ico-mood-<?php if($fields['face']>0) echo $fields['face'];?>.gif'/></span>");
document.write("<span class='username'><a href='<?php echo $spaceurl;?>'>{dede:field.username/}</a></span>");
document.write("<span class='date'>{dede:field.dtime function=GetDateMk(@me)/}</span>");
document.write("<span>评论<img src='{dede:global.cfg_templeturl/}/images/{dede:field.bgimg/}' alt='{dede:field.ftypetitle/}' /></span>");
document.write("</div>");
document.write("<div class='decmt-act'>");
document.write("</div>");
document.write("<div class='decmt-content'>{dede:field.msg function='jstrim(@me,500)'/}");
document.write(" ");
document.write("<span id='goodfb{dede:field.id/}'><a href=#goodfb{dede:field.id/} onclick=postBadGood('goodfb',{dede:field.id/})>支持</a>[{dede:field.good/}]</span>");
document.write("<span id='badfb{dede:field.id/}'><a href=#badfb{dede:field.id/} onclick=postBadGood('badfb',{dede:field.id/})>反对</a>[{dede:field.bad/}]</span>");
document.write("</div>");
document.write("</div>");
{/dede:datalist}
免责声明:本站所有文章和图片均来自用户分享和网络收集,文章和图片版权归原作者及原出处所有,仅供学习与参考,请勿用于商业用途,如果损害了您的权利,请联系网站客服处理。
来源:网友投稿 关注:
时间:2019-01-14 11:52
☉首先声明,只要是我们的vip会员所有源码均可以免费下载,不做任何限制(了解更多)
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
☉本站的源码不会像其它下载站一样植入大量的广告。为了更好的用户体验以后坚持不打水印
☉本站只提供精品织梦源码,源码在于可用,不在多!!希望在这里找到你合适的。
☉本站提供的整站织梦程序,均带数据及演示地址。可以在任一源码详情页查看演示地址
☉本站所有资源(包括源码、模板、素材、特效等)仅供学习与参考,请勿用于商业用途。
☉如有其他问题,请加网站客服QQ进行交流。
相关织梦教程:
- dedecms SQL注入漏洞 member/album_add.php 修复
- dedecms cookies泄漏导致SQL漏洞 /member/article_add
- Windows虚拟主机指定目录禁用脚本执行权限方法
- 西部数码虚拟主机设置禁止脚本执行权限
- 阿里云主机设置织梦程序禁止脚本执行权限及禁止写入
- dedecms织梦导致CPU峰值现象的解决办法
- 织梦程序网站被挂马或快照劫持终极解决办法
- 阿里云提醒/member/reg_new.php注入漏洞解决办法
- 织梦安全:更改plus名称
- 织梦栏目属性增加链接rel、nofollow和新窗口target
- 织梦问答模块PHP7报错解决方法
- dedecms解决移动端首页不自动更新问题