Discuz!官方免费开源建站系统

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索

[已经确认] 1.5rc2竞价排行榜增加积分Bug确切解决办法

[复制链接]
fyhao 发表于 2008-9-13 22:04:18 | 显示全部楼层 |阅读模式
经本人查证,果真有错误。错误在于赠送 stake 和 竞价 show 这两个词汇,官方统统放成 show 了。
因此大家可以更改一下档案
source/cp_credit.php

  1. <?php
  2. /*
  3.         [UCenter Home] (C) 2007-2008 Comsenz Inc.
  4.         $Id: cp_credit.php 8504 2008-08-18 01:20:23Z liguode $
  5. */

  6. if(!defined('IN_UCHOME')) {
  7.         exit('Access Denied');
  8. }

  9. if(submitcheck('friendsubmit')) {
  10.         $stakecredit = intval($_POST['stakecredit']);
  11.         if($stakecredit > $space['credit']) $stakecredit = $space['credit'];
  12.         if($stakecredit < 1) {
  13.                 showmessage('showcredit_error');
  14.         }
  15.         
  16.         //检测好友
  17.         $_POST['fusername'] = trim($_POST['fusername']);
  18.         $fuid = getcount('friend', array('uid'=>$space['uid'], 'fusername'=>$_POST['fusername'], 'status'=>1), 'fuid');
  19.         if(empty($fuid) || $fuid == $space['uid']) {
  20.                 showmessage('showcredit_fuid_error');
  21.         }
  22.         
  23.         //赠送
  24.         $count = getcount('show', array('uid'=>$fuid));
  25.         if($count) {
  26.                 $_SGLOBAL['db']->query("UPDATE ".tname('show')." SET credit=credit+$stakecredit WHERE uid='$fuid'");
  27.         } else {
  28.                 inserttable('show', array('uid'=>$fuid, 'username'=>$_POST['fusername'], 'credit'=>$stakecredit), 0, true);
  29.         }
  30.         
  31.         //减少自己的积分
  32.         $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET credit=credit-$stakecredit WHERE uid='$space[uid]'");
  33.         
  34.         //给好友通知
  35.         notification_add($fuid, 'credit', cplang('note_stakecredit', array($stakecredit)));
  36.         
  37.         //feed
  38.         feed_add('show', cplang('feed_stakecredit'), array(
  39.                 'fusername'=>"<a href="space.php?uid=$fuid">$_POST[fusername]</a>",
  40.                 'credit'=>$showcredit));
  41.         
  42.         showmessage('stakecredit_friend_do_success', "space.php?do=rank");
  43.         
  44. } elseif(submitcheck('showsubmit')) {
  45.         
  46.         $showcredit = intval($_POST['showcredit']);
  47.         if($showcredit > $space['credit']) $showcredit = $space['credit'];
  48.         if($showcredit < 1) {
  49.                 showmessage('showcredit_error');
  50.         }
  51.         $_POST['note'] = getstr($_POST['note'], 100, 1, 1, 1);
  52.         
  53.         //增加
  54.         $count = getcount('show', array('uid'=>$_SGLOBAL['supe_uid']));
  55.         if($count) {
  56.                 $notesql = $_POST['note']?", note='$_POST[note]'":'';
  57.                 $_SGLOBAL['db']->query("UPDATE ".tname('show')." SET credit=credit+$showcredit $notesql WHERE uid='$_SGLOBAL[supe_uid]'");
  58.         } else {
  59.                 inserttable('show', array('uid'=>$_SGLOBAL['supe_uid'], 'username'=>$_SGLOBAL['supe_username'], 'credit'=>$showcredit, 'note'=>$_POST['note']), 0, true);
  60.         }

  61.         //减少自己的积分
  62.         $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET credit=credit-$showcredit WHERE uid='$space[uid]'");
  63.         
  64.         //feed
  65.         feed_add('show', cplang('feed_showcredit_self'), array('credit'=>$showcredit), '', array(), $_POST['note']);
  66.                
  67.         showmessage('showcredit_do_success', "space.php?do=rank");
  68. }

  69. if(empty($_GET['op'])) {

  70.         //空间大小
  71.         $maxattachsize = checkperm('maxattachsize');
  72.         if(empty($maxattachsize)) {
  73.                 $percent = 0;
  74.                 $maxattachsize = '-';
  75.         } else {
  76.                 $maxattachsize = $maxattachsize + $space['addsize'];//额外空间
  77.                 $percent = intval($space['attachsize']/$maxattachsize*100);
  78.                 $maxattachsize = formatsize($maxattachsize);
  79.         }
  80.         $space['attachsize'] = formatsize($space['attachsize']);
  81.         
  82.         //用户组
  83.         $space['grouptitle'] = checkperm('grouptitle');
  84.         
  85.         @include_once(S_ROOT.'./data/data_creditrule.php');
  86.         if(empty($_SGLOBAL['creditrule'])) {
  87.                 $get = $pay = array();
  88.         } else {
  89.                 $get = $_SGLOBAL['creditrule']['get'];
  90.                 $pay = $_SGLOBAL['creditrule']['pay'];
  91.         }

  92.         $groups = array();
  93.         @include_once(S_ROOT.'./data/data_usergroup.php');
  94.         $space['grouptitle'] = checkperm('grouptitle');
  95.         foreach ($_SGLOBAL['usergroup'] as $gid => $value) {
  96.                 if(empty($value['system'])) $groups[] = $value;
  97.         }

  98. } elseif ($_GET['op'] == 'exchange') {
  99.         
  100.         @include_once(S_ROOT.'./uc_client/data/cache/creditsettings.php');
  101.         if(submitcheck('exchangesubmit')) {
  102.                 $netamount = $tocredits = 0;
  103.                 $tocredits = $_POST['tocredits'];
  104.                 $outexange = strexists($tocredits, '|');
  105.                 if(!$outexange && !$_CACHE['creditsettings'][$tocredits]['ratio']) {
  106.                         showmessage('credits_exchange_invalid');
  107.                 }
  108.                 $amount = intval($_POST['amount']);
  109.                 if($amount <= 0) {
  110.                         showmessage('credits_transaction_amount_invalid');
  111.                 }
  112.                 @include_once(S_ROOT.'./uc_client/client.php');
  113.                 $ucresult = uc_user_login($_SGLOBAL['supe_username'], $_POST['password']);
  114.                 list($tmp['uid']) = saddslashes($ucresult);
  115.                
  116.                 if($tmp['uid'] <= 0) {
  117.                         showmessage('credits_password_invalid');
  118.                 } elseif($space['credit']-$amount < 0) {
  119.                         showmessage('credits_balance_insufficient');
  120.                 }
  121.                 $netamount = floor($amount * 1/$_CACHE['creditsettings'][$tocredits]['ratio']);
  122.                 list($toappid, $tocredits) = explode('|', $tocredits);
  123.                
  124.                 $ucresult = uc_credit_exchange_request($_SGLOBAL['supe_uid'], $_CACHE['creditsettings'][$tocredits]['creditsrc'], $tocredits, $toappid, $netamount);
  125.                 if(!$ucresult) {
  126.                         showmessage('extcredits_dataerror');
  127.                 }
  128.                 $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET credit=credit-$amount WHERE uid='$_SGLOBAL[supe_uid]'");
  129.                
  130.                 showmessage('do_success', 'cp.php?ac=credit&op=exchange');
  131.         } elseif(empty($_CACHE['creditsettings'])) {
  132.                 showmessage('integral_convertible_unopened');
  133.         }
  134.         
  135. } elseif ($_GET['op'] == 'addsize') {

  136.         @include_once(S_ROOT.'./data/data_creditrule.php');
  137.         if(empty($_SGLOBAL['creditrule'])) {
  138.                 $get = $pay = array();
  139.         } else {
  140.                 $get = $_SGLOBAL['creditrule']['get'];
  141.                 $pay = $_SGLOBAL['creditrule']['pay'];
  142.         }
  143.         
  144.         //更新统计
  145.         $query = $_SGLOBAL['db']->query("SELECT SUM(size) FROM ".tname('pic')." WHERE uid='$_SGLOBAL[supe_uid]'");
  146.         $allsize = $_SGLOBAL['db']->result($query, 0);
  147.         if($allsize != $space['attachsize']) {
  148.                 $space['attachsize'] = $allsize;
  149.                 updatetable('space', array('attachsize'=>$allsize), array('uid'=>$_SGLOBAL['supe_uid']));
  150.         }
  151.         
  152.         if(empty($pay['attach'])) {
  153.                 showmessage('not_enabled_this_feature');
  154.         }
  155.         
  156.         //空间大小
  157.         $maxattachsize = checkperm('maxattachsize');
  158.         if(empty($maxattachsize)) {
  159.                 $sizewidth = 0;
  160.                 $maxattachsize = '-';
  161.         } else {
  162.                 $maxattachsize = $maxattachsize + $space['addsize'];//额外空间
  163.                 $sizewidth = intval($space['attachsize']/$maxattachsize*100);
  164.                 $maxattachsize = formatsize($maxattachsize);
  165.         }
  166.         $space['attachsize'] = formatsize($space['attachsize']);
  167.         
  168.         //提交处理
  169.         if(submitcheck('addsizesubmit')) {
  170.                 $addsize = intval($_POST['addsize']);
  171.                 if($addsize < 1) {
  172.                         showmessage('space_size_inappropriate');
  173.                 }
  174.                 $needcredit = $addsize * $pay['attach'];
  175.                 if($needcredit > $space['credit']) {
  176.                         showmessage('integral_inadequate','',1,array($space['credit'],$needcredit));
  177.                 }
  178.                 //兑换空间
  179.                 $addsize = $addsize*1024*1024;
  180.                 $_SGLOBAL['db']->query("UPDATE ".tname('space')." SET credit=credit-$needcredit, addsize=addsize+$addsize WHERE uid='$_SGLOBAL[supe_uid]'");
  181.                 showmessage('do_success', 'cp.php?ac=credit&op=addsize');
  182.         }
  183. }

  184. include_once template("cp_credit");

  185. ?>
复制代码


template/default/space_rank.htm

  1. <!--{template header}-->

  2. <div class="c_header a_header">
  3.         <a href="space.php?uid=$space[uid]"><img src="<!--{avatar($space[uid],small)}-->" alt="{$_SN[$space[uid]]}" class="avatar" /></a>
  4.         <h1>排行榜</h1>
  5.         <a href="space.php?uid=$space[uid]" class="spacelink">我的主页</a>
  6. </div>

  7. <div class="tabs_header">
  8.         <ul class="tabs">
  9.                 <li$actives[show]><a href="space.php?do=rank&view=show">竞价排行榜</a>
  10.                 <li$actives[mm]><a href="space.php?do=rank&view=mm">美女排行榜</a>
  11.                 <li$actives[gg]><a href="space.php?do=rank&view=gg">帅哥排行榜</a>
  12.                 <li$actives[credit]><a href="space.php?do=rank&view=credit">积分总排行榜</a>
  13.                 <li$actives[friendnum]><a href="space.php?do=rank&view=friendnum">好友数总排行榜</a>
  14.         </ul>
  15. </div>

  16. <div class="h_status">
  17.         <!--{if $_GET[view]=='show'}-->
  18.                 按照竞价积分递减排序
  19.         <!--{else}-->
  20.                 显示48小时内有更新的前50名用户(数据30分钟更新一次)
  21.         <!--{/if}-->
  22. </div>

  23. <div class="side_right s_clear">
  24.         <div class="wide">
  25.         
  26.         <!--{if $now_pos}-->
  27.                 <div class="notice">
  28.                 排行榜公告:
  29.                 <!--{if $_GET[view]=='show'}-->
  30.                         <!--{if $space[showcredit]}-->
  31.                         自己当前的竞价积分为:$space[showcredit],当前排名 <span style="font-size:20px;color:red;">$now_pos</span> ,再接再励!
  32.                         <!--{else}-->
  33.                         您现在还没有上榜。让自己上榜吧,这会大大提升您的主页曝光率。
  34.                         <!--{/if}-->
  35.                 <!--{else}-->
  36.                         <!--{if $_GET[view]=='credit'}-->
  37.                         <a href="cp.php?ac=credit">自己当前的积分:$space[credit]</a>
  38.                         <!--{elseif $_GET[view]=='friendnum'}-->
  39.                         <a href="space.php?do=friend">自己当前的好友数:$space[friendnum]</a>
  40.                         <!--{else}-->
  41.                         <a href="space.php">自己当前的访问量:$space[viewnum]</a>
  42.                         <!--{/if}-->
  43.                         ,当前排名 <span style="font-size:20px;color:red;">$now_pos</span> ,再接再励!
  44.                 <!--{/if}-->
  45.                 </div>
  46.         <!--{/if}-->
  47.                
  48.                 <!--{if $list}-->
  49.                 <div class="thumb_list" id="friend_ul">
  50.                         <table cellspacing="6" cellpadding="0">
  51.                                 <!--{loop $list $key $value}-->
  52.                                 <tr>
  53.                                         <td id="friend_$value[uid]_li" class="thumb <!--{if $ols[$value[uid]]}-->online<!--{/if}--> rank_$value[i]">
  54.                                                 <table cellpadding="0" cellspacing="0">
  55.                                                         <tr>
  56.                                                                 <td class="image"><a href="space.php?uid=$value[uid]" class="avatarlink"><img src="<!--{avatar($value[uid],middle)}-->" alt="{$_SN[$value[uid]]}" /></a></td>
  57.                                                                 <td>
  58.                                                                         <h6>
  59.                                                                                 <!--{if $_GET['view']=='credit'}-->
  60.                                                                                         <p class="r_option"><img src="image/credit.gif" align="absmiddle"><span class="gray">积分:</span>$value[credit]<span class="pipe">|</span><strong>第 $value[i] 名</strong></p>
  61.                                                                                 <!--{elseif $_GET['view']=='friendnum'}-->
  62.                                                                                         <p class="r_option"><span class="gray">好友数:</span>$value[friendnum]<span class="pipe">|</span><strong>第 $value[i] 名</strong></p>
  63.                                                                                 <!--{elseif $_GET['view']=='show'}-->
  64.                                                                                         <p class="r_option"><span class="gray">竞价积分:</span>$value[credit]<span class="pipe">|</span><strong>第 $value[i] 名</strong></p>
  65.                                                                                 <!--{else}-->
  66.                                                                                         <p class="r_option"><span class="gray">访问量:</span>$value[viewnum]<span class="pipe">|</span><strong>第 $value[i] 名</strong></p>
  67.                                                                                 <!--{/if}-->
  68.                                                                                 <!--{if $value['sex']==2}-->
  69.                                                                                 <img src="image/mm.gif" align="absmiddle">
  70.                                                                                 <!--{elseif $value['sex']==1}-->
  71.                                                                                 <img src="image/gg.gif" align="absmiddle">
  72.                                                                                 <!--{/if}-->
  73.                                                                                 <a href="space.php?uid=$value[uid]">{$_SN[$value[uid]]}</a>
  74.                                                                                 <!--{if $value['username'] && $_SN[$value[uid]]!=$value['username']}--><span class="gray">($value[username])</span><!--{/if}-->
  75.                                                                         </h6>
  76.                                                                         <p class="l_status">
  77.                                                                                 <!--{if $value['isfriend']}-->
  78.                                                                                 <a href="space.php?uid=$value[uid]" target="_blank">好友主页</a>
  79.                                                                                 <!--{else}-->
  80.                                                                                 <img src="image/add.gif" alt="+" title="加为好友" align="absmiddle"> <a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="a_friend_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)">加为好友</a>
  81.                                                                                 <!--{/if}-->
  82.                                                                                 <span class="pipe">|</span><a href="cp.php?ac=pm&uid=$value[uid]" id="a_pm_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)">发短消息</a>
  83.                                                                                 <span class="pipe">|</span><a href="cp.php?ac=poke&op=send&uid=$value[uid]" id="a_poke_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)">打招呼</a>
  84.                                                                         </p>

  85.                                                                         <!--{if $ols[$value[uid]]}-->
  86.                                                                         <p><span class="gray">动作:</span><!--{date('m-d H:i',$ols[$value[uid]],1)}--></p>
  87.                                                                         <!--{/if}-->

  88.                                                                         <!--{if $value[resideprovince] || $value[residecity]}-->
  89.                                                                         <p><span class="gray">地区:</span><a href="network.php?ac=space&resideprovince=$value[p]&residecity=&searchmode=1">$value[resideprovince]</a> <a href="network.php?ac=space&resideprovince=$value[p]&residecity=$value[c]&searchmode=1">$value[residecity]</a></p>
  90.                                                                         <!--{/if}-->

  91.                                                                         <!--{if $value[note]}-->
  92.                                                                         <div class="quote"><span id="quote" class="q">$value[note]</span></div>
  93.                                                                         <!--{/if}-->
  94.                                                                 </td>
  95.                                                         </tr>
  96.                                                 </table>
  97.                                         </td>
  98.                                 </tr>
  99.                                 <!--{/loop}-->
  100.                         </table>
  101.                 </div>
  102.                 <div class="page">$multi</div>
  103.         
  104.                 <!--{else}-->
  105.                 <div class="article c_form">
  106.                         还没有相关用户列表。
  107.                 </div>
  108.                 <!--{/if}-->
  109.         </div>

  110.         <div class="narrow">
  111.                
  112. <!--{if $_GET[view]=='show'}-->
  113.                 <div>
  114.                         <h2>上榜帮助提示</h2>
  115.                         <ol>
  116.                                 <li>竞价积分越多,竞价排名越靠前,您的主页曝光率也会越高;</li>
  117.                                 <li>上榜用户的主页被别人有效浏览一次,其竞价积分将减少1个(恶意刷新访问不扣减)。</li>
  118.                         </ol>
  119.                 </div>
  120.                 <div>
  121.                         <h2>帮助好友来上榜</h2>
  122.                         <form method="post" action="cp.php?ac=credit" onsubmit="return checkCredit('stakecredit');">
  123.                         <p>
  124.                                 要帮助的好友用户名:<br />
  125.                                 <input type="text" name="fusername" value="" size="25" class="t_input" /><br />
  126.                                 赠送竞价积分:<br><span class="gray">需小于自己的积分:$space[credit]</span><br />
  127.                                 <input type="text" id="stakecredit" name="showcredit" value="100" size="5" class="t_input" onblur="checkCredit('stakecredit');" /> <input type="submit" name="friend_submit" value="赠送" class="submit" />
  128.                         </p>
  129.                         <input type="hidden" name="friendsubmit" value="true" />
  130.                         <input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" /></form>
  131.                 </div>
  132.                 <div>
  133.                         <h2>我也要上榜</h2>
  134.                         <form method="post" action="cp.php?ac=credit" onsubmit="return checkCredit('showcredit');">
  135.                         <p>
  136.                                 我的上榜宣言:<br>
  137.                                 <span class="gray">最多50个汉字,会显示在榜单中,并会覆盖您之前的宣言。</span>
  138.                                 <input type="text" name="note" value="" size="35" class="t_input" /><br />
  139.                                 增加竞价积分:<br><span class="gray">这会扣除您同样数目的积分,填入的数值需小于自己的积分:$space[credit]</span><br />
  140.                                 <input type="text" id="showcredit" name="showcredit" value="100" size="5" class="t_input" onblur="checkCredit('showcredit');" /> <input type="submit" name="show_submit" value="增加" class="submit" />
  141.                         </p>
  142.                         <input type="hidden" name="showsubmit" value="true" />
  143.                         <input type="hidden" name="formhash" value="<!--{eval echo formhash();}-->" /></form>
  144.                 </div>
  145.                 <script type="text/javascript">
  146.                         function checkCredit(id) {
  147.                                 var maxCredit = $space[credit];
  148.                                 if($(id).value > maxCredit) {
  149.                                         alert("您的当前积分为:"+maxCredit+",请填写一个小于该值的数字");
  150.                                         return false;
  151.                                 } else if($(id).value < 1) {
  152.                                         alert("您所填写的积分值不能小于1");
  153.                                         return false;
  154.                                 }
  155.                                 return true;
  156.                         }
  157.                 </script>
  158. <!--{else}-->
  159.                 <div>
  160.                         <h2>上榜帮助提示</h2>
  161.                         <p>
  162.                         <!--{if $_GET['view']=='credit'}-->
  163.                                 抓紧赚取积分吧。请<a href="cp.php?ac=credit">点这里查看积分规则</a>,了解一下如何赚积分。
  164.                         <!--{elseif $_GET['view']=='friendnum'}-->
  165.                                 加一下自己的好友吧。您<a href="cp.php?ac=friend&op=find">寻找好友</a>,也可以<a href="cp.php?ac=invite">邀请自己的好友</a>加入进来。
  166.                         <!--{else}-->
  167.                                 自己多活跃点,<a href="cp.php?ac=blog">写个日志</a>、<a href="cp.php?ac=upload">传点图片</a>,多回复一下好友,下次您就能上榜。
  168.                         <!--{/if}-->
  169.                         </p>
  170.                 </div>               
  171.                 <div>
  172.                         <h2>刚刚更新的空间</h2>
  173.                         <table cellspacing="3" cellpadding="3">
  174.                                 <!--{loop $updatelist $key $value}-->
  175.                                 <tr>
  176.                                         <td>
  177.                                                 <a href="space.php?uid=$value[uid]" title="{$_SN[$value[uid]]}" target="_blank"><img src="<!--{avatar($value[uid],small)}-->" alt="{$_SN[$value[authorid]]}" class="avatar" /></a>
  178.                                         </td>
  179.                                         <td>
  180.                                         <!--{if !$value['isfriend']}-->
  181.                                         <a href="cp.php?ac=friend&op=add&uid=$value[uid]" id="add_ppc_friend_$key" onclick="ajaxmenu(event, this.id, 99999, '', -1)" class="addfriend"><img src="image/add.gif" alt="+" title="加为好友" /></a> <a href="space.php?uid=$value[uid]" title="{$_SN[$value[uid]]}" target="_blank">{$_SN[$value[uid]]}</a>
  182.                                         <!--{else}-->
  183.                                         <a href="space.php?uid=$value[uid]" title="{$_SN[$value[uid]]}" target="_blank">{$_SN[$value[uid]]}</a>
  184.                                         <!--{/if}-->
  185.                                         <!--{if $value['friendnum']}--><p class="gray">已有 $value[friendnum] 个好友</p><!--{/if}-->
  186.                                         <p><!--{date('m-d H:i',$value[updatetime],1)}--></p>
  187.                                         </td>
  188.                                 </tr>
  189.                                 <!--{/loop}-->
  190.                         </table>
  191.                 </div>
  192. <!--{/if}-->
  193.         </div>
  194. </div>

  195. <div class="f_status s_clear">
  196.         <a href="javascript:;" onclick="window.scrollTo(0,0);" id="a_top" title="TOP">TOP</a>
  197. </div>
  198. <!--{template footer}-->
复制代码


用以上代码覆盖即可看到效果。

其实还有些没改,如语言文件。。。
romy2008 发表于 2008-10-9 20:31:56 | 显示全部楼层
完全没用,还自以为成功,你试下赠送
回复

使用道具 举报

茄子 发表于 2008-10-13 10:21:00 | 显示全部楼层
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|Discuz! 官方站 ( 皖ICP备16010102号 )star

GMT+8, 2024-6-2 12:34 , Processed in 0.095902 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2023, Tencent Cloud.

快速回复 返回顶部 返回列表