发新话题
打印

discuz 6.1抢沙发插件(程序与安装说明)

本主题由 一粒沙 于 2008-8-7 23:10 设置高亮

discuz 6.1抢沙发插件(程序与安装说明)

在DISCUZ上 发现有很多朋友需要抢沙发的插件,所以就抽时间做了个
主要功能:
1.沙发 地板 板凳的单独设置是否加分 加分数量
2.设置加分类型 威望 金钱等
3.设置加分版块
4.固定楼层的加分 如T楼活动 就不用再去人工去对照了
5.为了防止用户恶意抢楼加分,本插件在楼主抢到"沙发,板凳,地板"不加分,本插件在同一用户连续抢到"沙发,板凳,地板"不加分!!
说明:本程序是基于PW论坛的一个插件 修改 完善的。

程序后台截图:




前台截图:

2楼发具体的安装步骤
附件: 您所在的用户组无法下载或查看附件

TOP

程序压缩包中 有说明文档 注意看下
1.如果程序没什么改动 直接把压缩包中的文件 覆盖到相应目录就好了  就不用向下看了
2.如果程序有改动请看这里
(1)在admin/home.inc.php文件中
搜索 if(submitcheck('notesubmit', 1))
把下边这段代码 加再上边
复制内容到剪贴板
代码:
echo '<table width="80%" algin="left">
<tr>
<td>
<a href="shafa.php?action=set" target="_self" style="color:red;font-size:14px;">沙发插件设置</a>
</td>
</tr>
</table>';
嘿嘿 这个其实作用就是 进入后台就直接显示 抢沙发软件的入口了 位置自己可以随便调 我是看这里方便
(2)
在include/newreply.inc.php文件中
搜索if($special == 3 && $thread['authorid'] != $discuz_uid && $thread['price'] > 0
把下边代码 加在上边
复制内容到剪贴板
代码:
    /*抢沙发奖励*/
if($shafa['shafa_open'] == '1'){
  if($shafa['shafa_fid']){
   $fidstaus=0;
   if(in_array($fid,explode(',',$shafa['shafa_fid']))){
    $fidstaus=999;
   }
  }else{
   $fidstaus=999;
  }
  //echo $fidstaus;exit;
  if($fidstaus==999){
    $extcreditstype=$shafa['shafa_e_style'];
    $extcreditname='extcredits'.$extcreditstype;
   if($thread['replies']=='0' && $shafa['shafa_e_1'] == '1' && $discuz_uid !=$thread['authorid']){
     $reason = '抢到沙发 ';
     $scores=$shafa['shafa_num_1'];
        $sqladd =$extcreditname.'='.$extcreditname.'+'.$scores;
     $db->query("UPDATE {$tablepre}members SET $sqladd WHERE uid='$discuz_uid'");
     $db->query("UPDATE {$tablepre}posts SET rate=rate+".$scores.",ratetimes=ratetimes+1 WHERE pid='$pid'");
     $db->query("insert into {$tablepre}ratelog
        (pid, uid, username, extcredits, dateline, score, reason)
        values
        ('$pid', '1', 'admin', '$extcreditstype', '$timestamp', '$scores', '$reason')");
   }elseif($thread['replies']=='1' && $shafa['shafa_e_2'] == '1' && $discuz_uid !=$thread['authorid']){
    $query = $db->query("select authorid from {$tablepre}posts  where fid=".$fid." and tid=".$tid." order by pid limit 2");
    while($poster = $db->fetch_array($query)) {
     $res_post[]=$poster['authorid'];
    }
    if(!in_array($discuz_uid, $res_post)){
     $reason = '抢到板凳 ';
     $scores=$shafa['shafa_num_2'];
        $sqladd =$extcreditname.'='.$extcreditname.'+'.$scores;
     $db->query("UPDATE {$tablepre}members SET $sqladd WHERE uid='$discuz_uid'");
     $db->query("UPDATE {$tablepre}posts SET rate=rate+".$scores.",ratetimes=ratetimes+1 WHERE pid='$pid'");
     $db->query("insert into {$tablepre}ratelog
        (pid, uid, username, extcredits, dateline, score, reason)
        values
        ('$pid', '1', 'admin', '$extcreditstype', '$timestamp', '$scores', '$reason')");
    }
   }elseif($thread['replies']=='2' && $shafa['shafa_e_3'] == '1' && $discuz_uid !=$thread['authorid']){
    $query = $db->query("select pid,authorid from {$tablepre}posts  where fid=".$fid." and tid=".$tid." order by pid limit 3");
    while($poster = $db->fetch_array($query)) {
     $res_post[]=$poster['authorid'];
    }
    if(!in_array($discuz_uid, $res_post)){
     $reason = '抢到地板 ';
     $scores=$shafa['shafa_num_3'];
     $sqladd =$extcreditname.'='.$extcreditname.'+'.$scores;
     $db->query("UPDATE {$tablepre}members SET $sqladd WHERE uid='$discuz_uid'");
     $db->query("UPDATE {$tablepre}posts SET rate=rate+".$scores.",ratetimes=ratetimes+1 WHERE pid='$pid'");
     $db->query("insert into {$tablepre}ratelog
        (pid, uid, username, extcredits, dateline, score, reason)
        values
        ('$pid', '1', 'admin', '$extcreditstype', '$timestamp', '$scores', '$reason')");
    }
   }elseif($shafa['shafa_e'] == '1'){
     $shafa_floor_num_array = explode(',',$shafa['shafa_floor_num']);
     foreach($shafa_floor_num_array as $key => $value){
      if($thread['replies'] == ($value-2)){
       $reason = '指定楼层奖励 ';
       $scores=$shafa['shafa_num'];
          $sqladd =$extcreditname.'='.$extcreditname.'+'.$scores;
       $db->query("UPDATE {$tablepre}members SET $sqladd WHERE uid='$discuz_uid'");
       $db->query("UPDATE {$tablepre}posts SET rate=rate+".$scores.",ratetimes=ratetimes+1 WHERE pid='$pid'");
       $db->query("insert into {$tablepre}ratelog
          (pid, uid, username, extcredits, dateline, score, reason)
          values
          ('$pid', '1', 'admin', '$extcreditstype', '$timestamp', '$scores', '$reason')");
      }
     }
   }
}
}
/*抢沙发奖励*/
这个作用就是 给后台设定的楼层加分了
(3)在post.php文件中搜索require_once DISCUZ_ROOT.'./include/post.func.php';
把下边代码加再上边
复制内容到剪贴板
代码:
require_once DISCUZ_ROOT.'./forumdata/plugin_cache/shafa_cache.php';
作用就是包含我们后台设置好的配置文件
(4)直接把shafa.php 拷到论坛根目录
作用就是后台的界面显示,与设置文件

TOP

由于插件刚做好 可能说明写的不太详细啊
大家有问题 意见什么的 就直接跟帖 或者再水区开新帖 发问就好了 保证及时回答

TOP

不错,顶之!!
期待能给大家带来更多乐趣
想关住我?没那么容易~~

TOP

真好玩,顶贴子就送分

TOP

这里不是手机论坛吗?还开网页设计的课?

TOP

说得够详细了

TOP

成功上8楼。。。。。。。。。。。。。好高兴咯
本帖最近评分记录
  • luoye 金钱 +16 指定楼层奖励  2008-8-13 23:13

TOP

支持。。

TOP

谢谢分享

TOP

发新话题