原帖由 oytktk 于 2005-10-28 19:53 发表
flegg.php文件~
哦,我的意思是直接在注释的地方加个查询把
$thread['flower']和$thread['egg']的值覆盖掉
flegg.php(自己加了点改动):
- <?
- $fe = getconfig('flegg');
- $fes = $_DCACHE['plugins'][$p];
- $navtitle = $fes['plug_title'];
- if(!$discuz_user)showmessage("请先登录!","javascript:history.go(-1)");
- $query = $db->query("SELECT username, money FROM $table_members WHERE username='$discuz_user'");
- $fuser=$db->fetch_array($query);
- if($action && !$pid){
- if(!$username)showmessage("参数不足, 无法进行!","javascript:history.go(-1)");
- $query = $db->query("SELECT username, uid FROM $table_members WHERE username='$username'");
- $tuser=$db->fetch_array($query);
- $touser=$tuser['username'];
- $touid=$tuser['uid'];
- }else{
- $query = $db->query("SELECT author, authorid, tid FROM $table_posts WHERE pid='$pid'");
- $fpost=$db->fetch_array($query);
- $touser=$fpost['author'];
- $touid=$fpost['authorid'];
- $tid=$fpost['tid'];
- }
- $muchflower='';
- for($i=2;$i<=$fe['much'];$i++){
- $muchflower.='<option value='.$i.'> '.$i.' </option>';
- }
- $mucheggs='';
- for($i=2;$i<=$fe['much'];$i++){
- $mucheggs.='<option value='.$i.'> '.$i.' </option>';
- }
- if($action=='flower' && ($flowers*$fe['flower']) > $fuser['money'])showmessage("对不起, 您的现金已经买不起鲜花了!","javascript:history.go(-1)");
- if($action=='eggs' && ($eggss*$fe['eggs']) > $fuser['money'])showmessage("对不起, 您的现金已经买不起鸡蛋了!","javascript:history.go(-1)");
- $moneyadd=$fe['moneyadd']*$flowers;
- $moneydec=$fe['moneydec']*$eggss;
- $credadd=$fe['credadd']*$flowers;
- $creddec=$fe['creddec']*$eggss;
- $flowers=$flowers?$flowers:0;
- $eggss=$eggss?$eggss:0;
- $flowerss=$flowers*$fe['flower'];
- $eggsss=$eggss*$fe['eggs'];
- if($flowers>$fe['much'] || $eggss>$fe['much'])showmessage("超过指定的数量, 请不要耍花招!","javascript:history.go(-1)");
- $msg_1="
- 恭喜您, 社区会员 [b]".$discuz_user."[/b] 送了您 [color=red]".$flowers."[/color] 束鲜花!
- 贴子地址: [url=".$boardurl."viewthread.php?tid=".$tid."][b]单击打开贴子连接[/b][/url]
- 由此对您的影响是:
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- &
- && [color=blue]论坛积分:[/color] [color=red][b] + ".$credadd."[/b][/color]
- &
- && [color=blue]论坛币:[/color] [color=red][b] + ".$moneyadd."[/b][/color]
- &
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- ";
- $msg_2="
- 恭喜您, 社区会员 [b]".$discuz_user."[/b] 送了你 [color=red]".$flowers."[/color] 束鲜花!
- 由此对您的影响是:
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- &
- && [color=blue]论坛积分:[/color] [color=red][b] + ".$credadd."[/b][/color]
- &
- && [color=blue]论坛币:[/color] [color=red][b] + ".$moneyadd."[/b][/color]
- &
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- ";
- $msg_3="
- 请注意, 社区会员 [b]".$discuz_user."[/b] 向你扔了 [color=red]".$eggss."[/color] 个鸡蛋!
- 贴子地址: [url=".$boardurl."viewthread.php?tid=".$tid."][b]单击打开贴子连接[/b][/url]
- 由此对您的影响是:
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- &
- && [color=blue]论坛积分:[/color] [color=red][b] - ".$creddec."[/b][/color]
- &
- && [color=blue]论坛币:[/color] [color=red][b] - ".$moneydec."[/b][/color]
- &
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- ";
- $msg_4="
- 请注意, 社区会员 [b]".$discuz_user."[/b] 向你扔了 [color=red]".$eggss."[/color] 个鸡蛋!
- 由此对您的影响是:
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- &
- && [color=blue]论坛积分:[/color] [color=red][b] - ".$creddec."[/b][/color]
- &
- && [color=blue]论坛币:[/color] [color=red][b] - ".$moneydec."[/b][/color]
- &
- &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
- ";
- $aswhat=dhtmlspecialchars($aswhat);
- if($start=='yes' && $action=='flower'){
- $query = $db->query("SELECT * FROM $table_felog WHERE asfe='flower' and fromuser='$discuz_user' and touser='$touser' and tid='$tid'");
- if(dhtmlspecialchars($aswhat)=='')showmessage("对不起, 您必须说明送鲜花的理由!","javascript:history.go(-1)");
- if($asone=$db->fetch_array($query))showmessage("对不起, 请不要重复送鲜花!","javascript:history.go(-1)");
- $msg=$msg_2;
- if($discuz_user==$touser)showmessage("自己送自己鲜花?!~~没必要这样吧?!","javascript:history.go(-1)");
- if($tid){
- $msg=$msg_1;
- $db->query("UPDATE $table_posts SET flower=flower+$flowers WHERE pid='$pid'");
- $db->query("UPDATE $table_threads SET flower=flower+$flowers WHERE tid='$tid'");}
- $db->query("UPDATE $table_members SET flowers=flowers+$flowers,money=money+$moneyadd,credit=credit+$credadd WHERE username='$touser'");
- $db->query("UPDATE $table_members SET money=money-$flowerss WHERE username='$discuz_user'");
- $db->query("INSERT INTO $table_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES('$discuz_user', '$discuz_uid', '$touid', 'inbox', '1', '恭喜, 有人送鲜花给你啦!', '$timestamp', '$msg')");
- $db->query("INSERT INTO $table_felog (fromuser, touser, asfe, score, tid, aswhat) VALUES ('$discuz_user', '$touser', 'flower', '$flowers', '$tid', '$aswhat')");
- $db->query("UPDATE LOW_PRIORITY $table_members SET newpm='1' WHERE uid='$touid'", 'UNBUFFERED');
- if($tid)showmessage("您已经成功的向 <b>".$touser."</b> 送了 <font color=red>".$flowers."</font> 束鲜花!","viewthread.php?tid=$tid");
- showmessage("您已经成功的向 <b>".$touser."</b> 送了 <font color=red>".$flowers."</font> 束鲜花!","plugins.php?p=flegg");
- }elseif($start=='yes' && $action=='eggs'){
- $query = $db->query("SELECT * FROM $table_felog WHERE asfe='eggs' and fromuser='$discuz_user' and touser='$touser' and tid='$tid'");
- if(dhtmlspecialchars($aswhat)=='')showmessage("对不起, 您必须说明丢鸡蛋的理由!","javascript:history.go(-1)");
- if($asone=$db->fetch_array($query))showmessage("对不起, 请不要重复扔鸡蛋!","javascript:history.go(-1)");
- if($discuz_user==$touser)showmessage("自己扔自己鸡蛋?!~~您受了什么刺激了?!","javascript:history.go(-1)");
- $msg=$msg_4;
- if($tid){
- $msg=$msg_3;
- $db->query("UPDATE $table_posts SET egg=egg+$eggss WHERE pid='$pid'");
- $db->query("UPDATE $table_threads SET egg=egg+$eggss WHERE tid='$tid'");}
- $db->query("UPDATE $table_members SET eggs=eggs+$eggss,money=money-$moneydec,credit=credit-$creddec WHERE username='$touser'");
- $db->query("UPDATE $table_members SET money=money-$eggsss WHERE username='$discuz_user'");
- $db->query("INSERT INTO $table_pms (msgfrom, msgfromid, msgtoid, folder, new, subject, dateline, message) VALUES('$discuz_user', '$discuz_uid', '$touid', 'inbox', '1', '请注意, 有人向你扔鸡蛋啦!', '$timestamp', '$msg')");
- $db->query("INSERT INTO $table_felog (fromuser, touser, asfe, score, tid, aswhat) VALUES ('$discuz_user', '$touser', 'eggs', '$eggss', '$tid', '$aswhat')");
- $db->query("UPDATE LOW_PRIORITY $table_members SET newpm='1' WHERE uid='$touid'", 'UNBUFFERED');
- if($tid)showmessage("您已经成功的向 <b>".$touser."</b> 扔了 <font color=red>".$eggss."</font> 个鸡蛋!","plugins.php?p=flegg");
- }else{
- //记录...排行...
- $query = $db->query("SELECT uid, username, flowers FROM $table_members WHERE flowers>0 ORDER BY flowers DESC LIMIT 10");
- $ii=0;
- while($flist=$db->fetch_array($query)){
- for($i=0;$i<$flist['flowers'];$i++){
- if($i<10)$flpk[$flist['uid']].="<img border=0 src='images/common/flower.gif'>";
- }
- if($i>=10)$flpk[$flist['uid']].="......共 <font color=red>".$flist['flowers']."</font> 束鲜花!";
- $ii++;
- $floop[]=$flist;
- }
- if($ii==0)$emptyf="目前没有人得到鲜花!";
- $query = $db->query("SELECT uid, username, eggs FROM $table_members WHERE eggs>0 ORDER BY eggs DESC LIMIT 10");
- $ii=0;
- while($elist=$db->fetch_array($query)){
- for($i=0;$i<$elist['eggs'];$i++){
- if($i<10)$egpk[$elist['uid']].="<img border=0 src='images/common/eggs.gif'>";
- }
- if($i>=10)$egpk[$elist['uid']].="......共 <font color=red>".$elist['eggs']."</font> 个鸡蛋!";
- $ii++;
- $eloop[]=$elist;
- }
- if($ii==0)$emptye="目前没有人得到鸡蛋!";
- if($discuz_uid==1)$fe['felist']=1;//fix by jia($discuz_uid==1为可以查看鲜花鸡蛋记录的UID,要改为多人,自己改...)
- if($fe['felist']){
- //页数处理
- $query = $db->query("SELECT COUNT(*) FROM $table_felog");
- $count = $db->result($query, 0);
- $pagenum = 30;
- $page = intval($page) ? intval($page) : 1;
- $start = ($page - 1) * $pagenum;
- $multipage = multi($count, $pagenum, $page, "plugins.php?p=flegg");
- //-----------
- $liststart=$start+1;
- $listend=$liststart+$pagenum-1;
- $query = $db->query("SELECT fromuser, id, touser, asfe, score, tid, aswhat FROM $table_felog ORDER BY id DESC LIMIT $start , $pagenum");
- $ii=0;
- while($felist=$db->fetch_array($query)){
- $fepk[$felist['id']]='';
- for($i=0;$i<$felist['score'];$i++){
- $fepk[$felist['id']].="<img border=0 src='images/common/".$felist['asfe'].".gif'>";
- }
- $ii++;
- $felist['tid']=$felist['tid']?"<a href='viewthread.php?tid=".$felist['tid']."' title='点击打开送礼的贴子'>贴子位置</a>":'';
- $felist['what']=cutstr($felist['aswhat'],90);
- $feloop[]=$felist;
- }
- }
- $fekf=$ii!=0?"以下是送鲜花和扔鸡蛋的记录":"目前还没有任何鲜花和鸡蛋的记录!";
- }
- include template('flower');
- ?>
复制代码
[ 本帖最后由 jiayuan1 于 2005-10-31 17:48 编辑 ] |