有好多人想要..本人只是从网上找来..如有错误找作者
插件名称 帖子买卖+流量管制系统
插件作者 rain5017
插件用法 [sell=帖子价格,管制时间]文章内容[/sell]
插件说明 本插件将是论坛插件里的一大创举,以往要管制下载点流量都要倚靠流量管制系统才能达到目的,但是本插件在帖子买卖插件基础上加上时间管制,因此有着跟流量管制系统的相同效果
附注
1.本帖子买卖插件为小弟我个人论坛需求而委托rain5017大大制定开发出来的,看见其他商业用户朋友对帖子买卖插件非常需求,因此我徵求作者同意将本插件放出让大家也能使用
2.旧语法[sell=XX]文章内容[/sell]也能共用
3.因为本插件相当吃资源,因此加上限制单帖内使用语法数量控制,请大家慎用本插件避免影响论坛速度
4.因为本插件相当吃资源,因此将语法模板上的"已付费统计人数"功能关闭,但是名单上可以查询数量
- DROP TABLE IF EXISTS `cdb_postpay`;
- CREATE TABLE `cdb_postpay` (
- `id` int(12) NOT NULL auto_increment,
- `tid` mediumint(8) NOT NULL default '0',
- `pid` int(10) unsigned NOT NULL default '0',
- `sellcount` smallint(3) unsigned NOT NULL default '0',
- `author` varchar(25) NOT NULL default '',
- `username` varchar(25) NOT NULL default '',
- `money` smallint(6) unsigned NOT NULL default '0',
- `dateline` int(10) unsigned NOT NULL default '0',
- PRIMARY KEY (`id`),
- KEY `tid` (`tid`)
- ) TYPE=MyISAM AUTO_INCREMENT=1 ;
复制代码
开启config.inc.php
最下方加上
- // ============================================================================
- $hacktable_postpay = 'cdb_postpay';
- $allowpostpay =1;
- $paypostoff=0;//是否关闭帖子卖买 0 否 1关闭
- $paypostlimit=3;//限制单帖里使用帖子买卖语法数量!0为无限制,否则一个帖子只有前$paypostlimit有效
- $paymixtime=0;//默认管制时间,以分为单位
- $cnteacher_postsell_maxprice =300;
- $cnteacher_paylist_perpage =20;
- $payfield='extcredits2';//设定消费的拓展积分,可依个人设定改变
- //=============================================================================
复制代码
开启include\discuzcode.func.php
找到
- global $discuzcodes, $credits, $tid, $discuz_uid, $highlight, $maxsmilies, $db, $tablepre;
复制代码
替换成
- global $discuzcodes, $credits, $tid, $discuz_user,$discuz_uid, $sellmessage,$highlight, $maxsmilies, $db, $tablepre,$post,$post_sellcount,$paymixtime,$postdowntime,$paypostlimit,$paypostoff;
复制代码
找到
- if(!$bbcodeoff && $allowbbcode) {
- $message = preg_replace("/\s*\[code\](.+?)\[\/code\]\s*/ies", "codedisp('\\1')", $message);
- }
复制代码
下面添加
- $message = preg_replace("/\[sell=(\d+)\]\s*(.+?)\s*\[\/sell\]/ies", "postsell(\\1,$paymixtime,'\\2')", $message);
- $message = preg_replace("/\[sell=(\d{1,3})[x|\,](\d{1,3})\]\s*(.+?)\s*\[\/sell\]/ies", "postsell(\\1,\\2,'\\3')", $message);
-
复制代码
找到
- for($i = 0; $i <= $discuzcodes['pcodecount']; $i++) {
- $message = str_replace("[\tDISCUZ_CODE_$i\t]", $discuzcodes['codehtml'][$i], $message);
- }
复制代码
下面添加
- for($si = 0; $si <= $post_sellcount; $si++) {
- $message = str_replace("|\tDISCUZ_SELL_$si\t|", $sellmessage[$si], $message);
- }
- unset ($sellmessage);
复制代码
找到
上面加入
- function postsell($price,$paytimes, $message) {
- global $thisbg, $db, $tablepre,$sellmessage,$tid,$hacktable_postpay,$discuz_user,$discuz_uid,$adminid,$page,$post,$payfield,$post_sellcount,$forum,$postdowntime,$paypostlimit,$paypostoff;
- $usermoney=$GLOBALS['_DSESSION'][$payfield];
- $nowtime=time();
- $paytimes=$paytimes*60;
-
- $message = str_replace("\\"", """, preg_replace("/^[\n\r]*(.+?)[\n\r]*$/is", "\\1", $message));
- if($paypostoff)return $message;
- $post_sellcount++;
- if($paypostlimit){
- if($post_sellcount>$paypostlimit) return "|\tDISCUZ_SELL_$post_sellcount\t| "."超过本帖卖帖次数,请另外发帖";
- }
- $post[postcount]= $post_sellcount;
- $price=abs(intval($price));
- $post['needmoney']=$post['needmoney']+$price;
- //$query = $db->query("SELECT COUNT(*) FROM $hacktable_postpay WHERE pid='$post[pid]' AND sellcount='$post_sellcount' ");
- //$payusercount=$db->result($query, 0);
- if ($discuz_user){
- if ($usermoney >= $price){
- $query = $db->query("SELECT dateline as lastpaytimes FROM $hacktable_postpay WHERE pid='$post[pid]' AND sellcount='$post_sellcount' ");
- @extract($db->fetch_array($query));
- $yutime=$lastpaytimes+$paytimes-$nowtime;//剩余时间
- $yutime=$yutime>0?$yutime:1;
- $paymessage="你拥有:$usermoney 金币,<span id="n_".$post_sellcount."_".$post[pid]."">下载管制,尚余 $yutime 秒.</span>";
- // if($yutime>1){
- $yutime=$yutime>0?$yutime:0;
- $countsell=$post_sellcount-1;
- //$tid,$post[pid],$price,$page,$post_sellcount
- $postdowntime.="delay[".$countsell."] = '".$post_sellcount."_".$post[pid]."-".$yutime."-0-".$tid."-".$post[pid]."-".$price."-".$page."-".$post_sellcount."';\n";
- // }
- /*************/
- //echo $paymessage;exit;
-
- }else{
- $paymessage="你拥有:$usermoney 金币,无法付费。去[<a href='memcp.php?action=credits'><font color=#FBA51F>兑换</font></a>]或者购买金币吧。";
- }
- }else{
- $paymessage= "非本站会员无权购买,请[<a href='logging.php?action=login'><font color=#FBA51F>登陆</font></a>],或者[<a href='register.php'><font color=#FBA51F>注册</font></a>]";
- }
-
- $sm1="<br><center><table style='background: threedface; color: windowtext; margin: 2px; BORDER-STYLE: none' width='90%'><tr><td><FIELDSET style='width: 100%; text-align: center'><LEGEND> 收费单</font></LEGEND><table border='0' width='98%' cellspacing='0' cellpadding='6' ><tr><td class='smalltxt'><font color=#000000>编号:</font><input type='text' readonly name='p101' value='$tid-$post[pid]-$post[postcount]'></td><td><font color=#000000>价格:</font><input type=text readonly name=p102 value='$price' size=5><font color=#000000>金额</font></td><td align='right'><font color=#000000>已付费人数:</font><input type=text name=p103 value='未统计' size=5> <a href='postpay.php?action=showpayuser&tid=$tid&pid=$post[pid]&sellcount=$post_sellcount'><font color=red>名单</font></a></td></tr><tr><td colspan='3'><hr><font color ='#000000'>请付费察看本帖隐藏内容,$paymessage</td></tr></table></FIELDSET></tr></table></center>";
-
- $sm2="<br><center><table style='background: threedface; color: windowtext; margin: 2px; BORDER-STYLE: none' width='90%'><tr><td><FIELDSET style='width: 100%; text-align: center'><LEGEND> 付款证明</font></LEGEND><table border='0' width='98%' cellspacing='0' cellpadding='6'><tr><td class='smalltxt'><font color=#000000>编号:</font><input type='text' readonly name='p101' value='$tid-$post[pid]-$post[postcount]'></td><td><font color=#000000>价格:</font><input type=text readonly name=p102 value='$price' size=5> <font color=#000000>金额</font></td><td align='right'><font color=#000000>已付费人数:</font><input type=text name=p103 value='未统计' size=5> <a href= 'postpay.php?action=showpayuser&tid=$tid&pid=$post[pid]&sellcount=$post_sellcount'><font color=red>名单</font></a></td></tr><tr><td colspan='3'><hr><font color='#000000'>感谢您的付费!你可以观看以下付费内容了。如发现非法敛财,可以投诉给版主<span id="n_".$post_sellcount."_".$post[pid].""></span></td></tr></table></FIELDSET></tr></table></center>";
- if ($discuz_user){
- //$query = $db->query("SELECT COUNT(*) FROM {$tablepre}posts WHERE pid='$post[pid]' AND author='$discuz_user'");
- // $isauthor = $db->result($query, 0);
- $isauthor = ($post[uid]==$discuz_uid)?1:0;
- if(in_array($adminid, array(1,2))||$forum['ismoderator']||$isauthor){
- $post['paymoney']=$post['needmoney'];
- $post['payed']=2;
- $sellmessage[$post_sellcount]=$sm2;
- } else {
- $query = $db->query("SELECT COUNT(*) FROM $hacktable_postpay WHERE pid='$post[pid]' AND sellcount='$post_sellcount' and money='$price' and username='$discuz_user'");
- if($db->result($query, 0)) {
- $post['paymoney']=$post['paymoney']+$price;
- $post['payed']=2;
- $sellmessage[$post_sellcount]=$sm2;
- }else{
- $post['payed']=1;
- $message='';
- $sellmessage[$post_sellcount]=$sm1;
- }
- }
- }else{
- $post['payed']=1;
- $message='';
- $sellmessage[$post_sellcount]=$sm1;
- }
- return "|\tDISCUZ_SELL_$post_sellcount\t| ".$message;
- }
复制代码
开启include\newreply.inc.php
找到
- $time = gmdate("$dateformat $timeformat", $thaquote['dateline'] + ($timeoffset * 3600));
复制代码
下面添加
- $message = preg_replace("/\[sell=?\d*\](.+?)\[\/sell\]/is", "[b]**** 付费信息,已经隐藏 *****[/b]", $message);
- $message = preg_replace("/\[sell=(\d{1,3})[x|\,](\d{1,3})\](.+?)\[\/sell\]/ies","付费信息,已经隐藏", $message);
复制代码
开启templates\default\viewthread.htm
找到两个地方都要加上
- <table width="{TABLEWIDTH}" cellspacing="0" cellpadding="0" align="center">
- <tr>
复制代码
上面添加
- <!--{if $postdowntime}-->
- <script language="javascript">
- <!--
- var wait_time = 10;
- var load_time = (new Date()).getTime();
- var delay = new Array();
- // delay[0] = '9p-1033-0';
- // delay[1] = '12p-295-0';
- $postdowntime
- var okImg = new Image();
- okImg.src = 'http://220.134.160.16/non-cgi/images/ok.gif';
- function updateDelay() {
- var refresh_enabled = 0;
- var refresh_time = 3600000;
- var now_time = (new Date()).getTime();
- for(i=0; i<delay.length; i++) {
- var data = delay[i].split("-");
- var pass_time = Math.floor((now_time - load_time)/1000);
- var diff = data[1] - pass_time;
- var diff_str = '';
- if(diff >= 0) {
- refresh_enabled = 1;
- if(diff > 3600) {
- if(diff <= 3600*2) refresh_time = 60000;
- var diff1 = Math.floor(diff/3600);
- diff_str = diff1 + ' 个多小时';
- } else {
- if(diff > 60) {
- if(refresh_time > 60000) refresh_time = 60000;
- if(diff <= 60*2) refresh_time = 1000;
- var diff1 = Math.floor(diff/60);
- diff_str = diff1 + ' 分钟多';
- } else {
- refresh_time = 1000;
- diff_str = diff + ' 秒多';
- }
- }
- if(data[2] == 0) {
- document.getElementById('n_'+data[0]).innerHTML = '下载管制,尚余 ' + diff_str + '.';
- } else {
- if(diff <= wait_time*60) {
- document.getElementById('n_'+data[0]).innerHTML = '下载管制,尚余 ' + diff_str + '.';
-
- }
- }
- } else {
- document.getElementById('n_'+data[0]).innerHTML = '<a href=postpay.php?action=pay&tid='+data[3]+'&sellcount='+data[7]+'&money='+data[5]+'&page='+data[6]+'&pid='+data[4]+'><b><font color=#FBA51F>[你已经可以买帖]</font></b></a>';
- if(data[2] == 0) {
- // eval('document.delpost.b_'+data[0]).value = '立即下载';
- // eval('document.delpost.b_'+data[0]).disabled = true;
- // document.delpost.b_+data[0]+.disabled = true;
- } else {
- location.reload();
- }
- }
- }
- if(refresh_enabled == 1) setTimeout("updateDelay()", refresh_time);
- }
- updateDelay();
- // -->
- </script>
- <!--{/if}-->
复制代码
[ 本帖最后由 haohao036 于 2005-12-17 01:52 编辑 ] |