USB
|
分享:
▲
▼
medal.htm <!-- <?php print <<<EOT --> $msg_guide <table width=$tablewidth border=0 cellspacing=0 cellpadding=0 align=center $i_table> <tr><td> <table width=颼%' border=Ɔ' cellspacing=Ƈ' cellpadding=ƈ'> <tr height="25"> <td align='center' class=head><a href="hack.php?H_name=medal">勛章介紹</a> | <a href="hack.php?H_name=medal&action=list">獲得勛章名單</a> <!-- EOT; if(strpos($xz_award, '|'.$groupid.'|')!==false){print <<<EOT --> | <a href="hack.php?H_name=medal&action=pos">頒發勛章</a> <!-- EOT; }if(strpos($xz_manage, '|'.$groupid.'|')!==false){print <<<EOT --> | <a href="hack.php?H_name=medal&action=manage">勛章管理</a> <!-- EOT; }print <<<EOT --> | <a href="hack.php?H_name=medal&action=log">勛章頒發情況</a></td> </tr> <tr bgcolor=$forumcolorone height=26> <td align="center" height="30">$userdb[medals]</td></tr> </table> </td> </tr> </table><br/> <!-- EOT; if(!$action){print <<<EOT --> <table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=0><tr><td><table cellspacing=1 cellpadding=5 width=100% border=0 $i_table> <tr> <td class=head height=25 colspan=3 align=left><span class=bold>勛章介紹</span></td> </tr> <tr align=center height=23> <td width=25% class=cbg>勛章名稱</td> <td width=50% class=cbg>勛章說明</td> <td width=25% class=cbg>勛章圖示</td> </tr> <!-- EOT; foreach($medals as $medal) {print <<<EOT --> <tr> <td width=5% align=center valign=middle class='f_one'>$medal[name]</td> <td width=5% align=center valign=middle class='f_two'>$medal[intro]</td> <td width=5% align=center valign=middle class='f_one'><img src="$medal[picurl]" alt="$medal[name]" border="0" /></td> </tr> <!-- EOT; }print <<<EOT --> </table></td></tr></table> <!-- EOT; }elseif($action=='list'){print <<<EOT --> <table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=0><tr><td><table cellspacing=1 cellpadding=5 width=100% border=0 $i_table> <tr> <td class=head height=25 colspan=3 align=left><span class=bold> 獲得勛章名單 </span></td> </tr> <tr align=center height=23> <td width=25% class=cbg>用戶名</td> <td width=75% class=cbg>所獲勛章</td> </tr> <!-- EOT; foreach($membersdb as $members) {print <<<EOT --> <tr> <td width=5% align=center valign=middle class='f_one'><a href="profile.php?action=show&uid=$members[uid]">$members[username]</a></td> <td width=5% align=center valign=middle class='f_two'>$members[medals]</td> </tr> <!-- EOT; }print <<<EOT --> </table></td></tr></table> <!-- EOT; }elseif($action=='log'){print <<<EOT --> <table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=0><tr><td><table cellspacing=1 cellpadding=5 width=100% border=0 $i_table> <tr> <td class=head height=25 colspan=6 align=left><span class=bold>勛章頒發日志</span></td> </tr> <tr align=center height=23> <td width=10% class=cbg>用戶名</td> <td width=10% class=cbg>操作人</td> <td width=5% class=cbg>情況</td> <td width=10% class=cbg>對應勛章</td> <td width=20% class=cbg>日期時間</td> <td width=45% class=cbg>原因</td> </tr> <!-- EOT; foreach($logsdb as $log) {print <<<EOT --> <tr> <td align=center valign=middle class='f_two'>$log[awardee]</td> <td align=center valign=middle class='f_one'>$log[awarder]</td> <td align=center valign=middle class='f_two'>$log[action]</td> <td align=center valign=middle class='f_one'>$log[level]</td> <td align=center valign=middle class='f_one'>$log[awardtime]</td> <td align=center valign=middle class='f_two'>$log[why]</td> </tr> <!-- EOT; }print <<<EOT --> </table></td></tr> <tr><td align=right>{$fenye} $xz_log/頁 總{$count}條</td></tr> </table> <!-- EOT; }elseif($action=='pos'){print <<<EOT --> <form action='hack.php?H_name=medal&action=pos' method=post name=form> <table width=$tablewidth border=0 cellspacing=1 cellpadding=4 align=center $i_table> <tr height=25> <td class=head colspan=2> 勛章頒發或者摘除 </td> </tr> <tr> <td width=40% bgcolor=$forumcolorone align=right> 用 戶 名:</td> <td width=60% bgcolor=$forumcolorone> <input type=txt size=20 maxlength=30 name=pos_name> </tr> <tr> <td width=40% bgcolor=$forumcolorone align=right> 執行動作:</td> <td width=60% bgcolor=$forumcolorone> 頒發<input type="radio" name="pos_act" value="1" checked="checked" />摘除<input type="radio" name="pos_act" value="0" /> </tr> <tr> <td width=40% bgcolor=$forumcolorone align=right> 勛章選擇:</td> <td width=60% bgcolor=$forumcolorone> <select name="pos_medal"> <option value="0">請選擇勛章</option>$medalselect </select> </tr> <tr> <td width=40% bgcolor=$forumcolorone align=right> 執行理由:</td> <td width=60% bgcolor=$forumcolorone> <input type=txt size=50 maxlength=100 name=pos_why> </tr> </table><br> <center> <input type=submit name=submit value=確認操作> <input type=hidden value=2 name=step> </form><center> <!-- EOT; }elseif($action=='manage'){print <<<EOT --> <table cellspacing=0 cellpadding=0 width=$tablewidth align=center border=0><tr><td><table cellspacing=1 cellpadding=5 width=100% border=0 $i_table> <form method="POST" action=hack.php?H_name=medal&action=manage> <tr> <td class=head height=25 colspan=6 align=center><span class=bold>勛章管理</span> <a href="hack.php?H_name=medal&action=add">【增加勛章】</a><a href="hack.php?H_name=medal&action=upcache">【更新緩存】</a></td> </tr> <tr align=center height=23> <td width=4% class=cbg>ID</td> <td width=15% class=cbg>勛章名稱</td> <td width=40% class=cbg>勛章說明</td> <td width=25% class=cbg>圖片地址</td> <td width=10% class=cbg>圖片演示</td> <td width=6% class=cbg>操作</td> </tr> <!-- EOT; foreach($medals as $medal) {print <<<EOT --> <tr> <td align=center valign=middle class='f_one'>$medal[id]</td> <td align=center valign=middle class='f_two'><input size=20 value="$medal[name]" name="medal_name[$medal[id]]" type=text></td></td> <td align=center valign=middle class='f_one'><input size=50 value="$medal[intro]" name="medal_intro[$medal[id]]" type=text></td> <td align=center valign=middle class='f_two'><input size=40 value="$medal[picurl]" name="medal_picurl[$medal[id]]" type=text></td> <td align=center valign=middle class='f_one'><img src="$medal[picurl]" alt="$medal[name]" border="0" /></td> <td align=center valign=middle class='f_two'><a href="hack.php?H_name=medal&action=del&medalid=$medal[id]">刪除</a></td> </tr> <!-- EOT; }print <<<EOT --> <tr> <td height=25 colspan=6 align=center class=cbg><input type=hidden value=2 name=step><input type=submit name=submit value=提交修改> </td></form> </tr> </table></td></tr></table> <!-- EOT; }elseif($action=='add'){print <<<EOT --> <form action='hack.php?H_name=medal&action=add' method=post name=form> <table width=$tablewidth border=0 cellspacing=1 cellpadding=4 align=center $i_table> <tr height=25> <td class=head colspan=2> 增加勛章 </td> </tr> <tr> <td width=40% bgcolor=$forumcolorone align=right> 勛章名稱:</td> <td width=60% bgcolor=$forumcolorone> <input type=txt size=20 maxlength=75 name=medal_name> </tr> <tr> <td width=40% bgcolor=$forumcolorone align=right> 勛章說明:</td> <td width=60% bgcolor=$forumcolorone> <input type=txt size=50 maxlength=100 name=medal_intro> </tr> <tr> <td width=40% bgcolor=$forumcolorone align=right> 圖片地址:</td> <td width=60% bgcolor=$forumcolorone> <input type=txt size=50 maxlength=100 name=medal_picurl> </tr> </table><br> <center> <input type=submit name=submit value=確認增加> <input type=hidden value=2 name=step> </form><center> <!-- EOT; }?>--> medal.php <?php /** * phpwind勛章插件 v1.2 * 作 者:bg9cx (http://www.ph....net id:bg9cx) * 適合版本:phpwind 2.00 * 最后更新:2004年10月25日22時 * 版權所有,嚴禁用于商業用途! */ require_once('./global.php'); require_once('./header.php'); require_once('./require/forum.php'); if (!file_exists('./data/bbscache/medals.php')) { updatecache_medals(); } require_once('./data/bbscache/medals.php'); if ($xz_open == Ɔ') { Showmsg('對不起!!勛章中心被管理員關閉!'); } if ($groupid == 'guest') { Showmsg('對不起!!您還沒有登陸或注冊,暫時不能使用此功能!'); } $guidename['勛章中心'] = 'hack.php?H_name=medal' $msg_guide = headguide($guidename); $userdb = $db->get_one("SELECT uid,medals FROM pw_members WHERE uid=$winddb[uid]"); if ($userdb[medals]) { require('./data/bbscache/medals.php'); $userdb['medals'] = explode(",", $userdb['medals']); foreach ($userdb['medals'] as $mid) { $usermedals .= "<img src={$medals[$mid]['picurl']} alt={$medals[$mid]['name']}> "; } $userdb['medals'] = "您現在的勛章:" . $usermedals . "<br>"; } else { $userdb['medals'] = "您現在還沒有勛章,繼續努力!"; } if (!$action) { require_once(PrintEot('medal')); footer(); } /*else if ($action=='list') { if($page>1) { $start_limit = ($page - 1) * $xz_list; } else { $start_limit = 0; $page = 1; } $rs = $db->get_one("SELECT count(*) as count FROM pw_members where medals<>''"); $count = $rs['count']; $numofpage = ceil($count/$xz_list); $totlepage = $numofpage; if ($numofpage && $page > $numofpage) { $page = $numofpage; } $fenye = numofpage($count, $page, $numofpage, "hack.php?H_name=medal&action=list&"); $query = $db->query("SELECT uid,username,medals FROM pw_members where medals<>'' ORDER BY uid limit $start_limit, $xz_list"); while($members = $db->fetch_array($query)) { $medalid = explode(",", $members['medals']); $members['medals'] = ""; foreach($medalid as $mid) { $members['medals'] .= "<img src={$medals[$mid]['picurl']} alt={$medals[$mid]['name']}> "; } $membersdb[] = $members; } require_once(PrintEot('medal')); footer(); } */ else if ($action=='list') { if (!file_exists('./data/bbscache/medals_list.php')) { updatecache_medals_list(); } $medaluserlist = openfile("data/bbscache/medals_list.php"); foreach($medaluserlist as $member) { $member = explode("|",$member); $members['uid'] = $member[1]; $members['username'] = $member[2]; $medalid = explode(",", $member[3]); $members['medals'] = '' foreach($medalid as $mid) { $members['medals'] .= "<img src={$medals[$mid]['picurl']} alt={$medals[$mid]['name']}> "; } $membersdb[] = $members; } require_once(PrintEot('medal')); footer(); }
else if ($action == 'log') { if($page>1) { $start_limit = ($page - 1) * $xz_log; } else { $start_limit = 0; $page = 1; } $rs = $db->get_one("SELECT count(*) as count FROM pw_medalslog"); $count = $rs['count']; $numofpage = ceil($count/$xz_log); $totlepage = $numofpage; if ($numofpage && $page > $numofpage) { $page = $numofpage; } $fenye = numofpage($count, $page, $numofpage, "hack.php?H_name=medal&action=log&"); $query = $db->query("SELECT * FROM pw_medalslog ORDER BY id limit $start_limit, $xz_log"); while($logs = $db->fetch_array($query)) { $logs[awardtime] = date("Y-m-d H:i:s",$logs[awardtime]); if ($logs[action] == "0") { $logs[action] = "摘除"; } elseif ($logs[action] == "1") { $logs[action] = "頒發"; } $src = $medals[$logs[level]][picurl]; $logs[level] = "<img src=$src>"; $logsdb[] = $logs; } require_once(PrintEot('medal')); footer(); } else if ($action == 'pos') { if(strpos($xz_award, '|'.$groupid.'|')===false) { Showmsg('你所在的組沒有管理權限!'); } if ($_POST['step'] == 2) { if (!$pos_name || $pos_name == '') { showmsg('請填寫要頒發的用戶名'); } if (!$pos_why || $pos_why == '') { showmsg('請填寫要頒發的理由'); } if (!$medals[$pos_medal]) { showmsg('沒有此勛章!請選擇要頒發的勛章'); } $pos_name = Char_cv($pos_name); $pos_why = Char_cv($pos_why); $ownerdb = $db->get_one("SELECT * FROM pw_members WHERE username='$pos_name'"); if (!$ownerdb) { Showmsg('您所指定的用戶不存在'); } if ($pos_act == 0) { if (strpos($ownerdb[medals], $pos_medal) === false) { showmsg('該用戶沒有這個勛章,無法使用摘除功能'); } $new_medals = str_replace($pos_medal, "", $ownerdb[medals]); $new_medals = str_replace(",,", ",", $new_medals); $new_medals = ereg_replace('^(,)([0-9,]{1,})$', '\\2', $new_medals); $new_medals = ereg_replace('^([0-9,]{1,})(,)$', '\\1', $new_medals); $db->update("UPDATE pw_members SET medals ='$new_medals' where username='$ownerdb[username]'"); $db->update("insert into pw_medalslog (awarder,awardee,awardtime,level,action,why)VALUES('$winddb[username]','$ownerdb[username]','$timestamp','$pos_medal','$pos_act','$pos_why')"); if($xz_msg) { require_once(R_P.'require/msg.php'); $pos_medalname = $medals[$pos_medal]['name']; writenewmsg(array($ownerdb[username],$winduid,"您的[{$pos_medalname}]勛章被摘除",$timestamp,"您的[{$pos_medalname}]勛章被摘除\n操作:$windid\n理由:$pos_why",0,$windid)); } updatecache_medals_list(); showmsg('勛章摘除成功!'); } else if ($pos_act == 1) { if(strpos($ownerdb[medals], $pos_medal) !== false) { showmsg('該用戶已經有這個勛章!'); } if (!$ownerdb[medals] || $ownerdb[medals] == "") { $new_medals = $pos_medal; } else { $new_medals = $ownerdb[medals].",$pos_medal"; } $db->update("UPDATE pw_members SET medals ='$new_medals' where username='$ownerdb[username]'"); $db->update("insert into pw_medalslog (awarder,awardee,awardtime,level,action,why)VALUES('$winddb[username]','$ownerdb[username]','$timestamp','$pos_medal','$pos_act','$pos_why')"); if($xz_msg) { require_once(R_P.'require/msg.php'); $pos_medalname = $medals[$pos_medal]['name']; writenewmsg(array($ownerdb[username],$winduid,"您被授予[{$pos_medalname}]勛章",$timestamp,"您被授予[{$pos_medalname}]勛章\n操作:$windid\n理由:$pos_why",0,$windid)); } updatecache_medals_list(); showmsg('勛章頒發成功!'); } else { showmsg('你沒有選擇要操作的動作'); } exit; } foreach ($medals as $mid) { $medalselect .= "<option value=\"$mid[id]\">$mid[name]</option>"; } require_once(PrintEot('medal')); footer(); } else if ($action=='manage') { if(strpos($xz_manage, '|'.$groupid.'|')===false) { Showmsg('你所在的組沒有管理權限!'); } if ($_POST['step'] == ƈ') { foreach ($medal_name as $key=>$newmedal) { $db->update("UPDATE pw_medals SET name='$newmedal',intro='$medal_intro[$key]',picurl='$medal_picurl[$key]' WHERE id='$key'"); } updatecache_medals(); showmsg('修改成功!'); } require_once(PrintEot('medal')); footer(); } else if ($action=='del') { if(strpos($xz_manage, '|'.$groupid.'|')===false) { Showmsg('你所在的組沒有管理權限!'); } if(!is_numeric($medalid)) { showmsg('勛章ID非法'); } $db->query("DELETE FROM pw_medals WHERE id='$medalid'"); updatecache_medals(); showmsg('刪除成功!'); } else if ($action=='add') { if(strpos($xz_manage, '|'.$groupid.'|')===false) { Showmsg('你所在的組沒有管理權限!'); } if ($_POST['step'] == ƈ') { $medal_name = Char_cv($medal_name); $medal_intro = Char_cv($medal_intro); $medal_picurl = Char_cv($medal_picurl); $db->query("insert pw_medals (name,intro,picurl)VALUES('$medal_name','$medal_intro','$medal_picurl')"); updatecache_medals(); showmsg('添加成功!'); } } else if ($action=='upcache') { if(strpos($xz_manage, '|'.$groupid.'|')===false) { Showmsg('你所在的組沒有管理權限!'); } updatecache_medals(); updatecache_medals_list(); showmsg('更新完畢'); } require_once(PrintEot('medal')); footer(); /** * 更新勛章緩沖 */ function updatecache_medals() { global $db; $query = $db->query("SELECT * FROM pw_hack WHERE hk_name LIKE 'xz_%'"); $medalscache = "<?php\n"; while(@extract($db->fetch_array($query))){ $medalscache .= "\$$hk_name='$hk_value'\r\n"; } $query = $db->query("SELECT * FROM pw_medals ORDER BY id"); $medalscache .= "\$medals=array(\n"; while ($medals = $db->fetch_array($query)) { $medals['name'] = preg_replace("/\<(.+?)\>/eis", "", $medals['name']); $medalscache .= "'$medals[id]' => Array(\n\t\t'id' => '$medals[id]',\n\t\t'name' => '$medals[name]',\n\t\t'intro' => '$medals[intro]',\n\t\t'picurl' => '$medals[picurl]'\n\t\t),\n"; } $medalscache .= "\n);\n?>"; writeover(R_P.'data/bbscache/medals.php', $medalscache); } function updatecache_medals_list() { global $db; $query = $db->query("SELECT uid,username,medals FROM pw_members where medals<>'' ORDER BY uid"); $medalscache = '' while($members = $db->fetch_array($query)) { $medalscache .= "<?die;?>|$members[uid]|$members[username]|$members[medals]|\n"; } writeover(R_P.'data/bbscache/medals_list.php', $medalscache); } ?>
|