[分享](後台) 拍賣區管理

WOG設定安裝教學

版主: 涅魂, 簫哥

頭像
齋月
 
文章: 557
註冊時間: 2006-02-27 7:54 am

[分享](後台) 拍賣區管理

文章齋月 » 2007-03-23 9:37 am

就是能夠在後台管理拍賣區的功能。。。
簡單明瞭 :)


後台拍賣區管理 寫:
開啟 acpleft.php 寫:尋找
代碼: 選擇全部
      <tr>
         <td align="left">
         <p><font size="1" face="新細明體">
         <input class="text" type="submit" value="物品管理" name="actions"></font></td>
      </tr>

上方,加入
代碼: 選擇全部
      <tr>
         <td align="left">
         <p><font size="1" face="新細明體">
         <input class="text" type="submit" value="拍賣管理" name="actions"></font></td>
      </tr>

開啟 acpmain.php 寫:尋找
代碼: 選擇全部
case "工會管理":
print_header();
admin_group();
print_footer();
break;

上方,加入
代碼: 選擇全部
case "拍賣管理":
print_header();
bid_list();
print_footer();
break;

case "檢視拍賣":
print_header();
bid_admin();
print_footer();
break;

case "更新拍賣":
print_header();
bid_admin_sub();
print_footer();
break;




尋找
代碼: 選擇全部
//工會管理
function admin_group()

上方,加入
代碼: 選擇全部
//拍賣管理
function bid_list()
{
global $DB_site;
?>
<form action="acpmain.php" method="POST" target="_self">
<table borderColor="#4b689e" cellSpacing="0" cellPadding="2" width="97%" align="center" border="1">
<tr>
<td>拍賣者</td>
<td>商品</td>
<td>物攻</td>
<td>魔攻</td>
<td>物防</td>
<td>魔防</td>
<td>速度</td>
<td>職業限制</td>
<td>能力限制</td>
<td>金額</td>
<td>原價</td>
<td>剩餘日</td>
<td>選擇</td>
</tr>
<?
$templist=$DB_site->query("select * from wog_sale order by dateline");
$temp_s=""; 
   while($getitemlist=$DB_site->fetch_array($templist))
   {
   $getdf=$DB_site->query_first("select d_name,d_at,d_mat,d_df,d_mdf,d_agl,d_mstr,d_magl,d_msmart,d_money,ch_id,ch_pro,d_type from wog_df where d_id='".$getitemlist[d_id]."'");
   $getplayer=$DB_site->query_first("select p_name from wog_player where p_id='".$getitemlist[p_id]."'");
      $d_name=$getdf[d_name];
      $d_at=$getdf[d_at];
      $d_mat=$getdf[d_mat];
      $d_df=$getdf[d_df];
      $d_mdf=$getdf[d_mdf];
      $d_agl=$getdf[d_agl];
      $d_mstr=$getdf[d_mstr];
      $d_magl=$getdf[d_magl];
      $d_msmart=$getdf[d_msmart];
      $d_money=$getdf[d_money];
      $d_ch_id=$getdf[ch_id];
      $d_ch_pro=$getdf[ch_pro]/35;
      $d_type=$getdf[d_type];
      $tempplayer = $getplayer[p_name];
      switch($d_type)
      {
      case "0":
      $temptype = "武器";
      break;
                     
        case "1":
      $temptype = "頭部";
      break;                   
                     
        case "2":
      $temptype = "身體";
      break;                   
                       
        case "3":
      $temptype = "手套";
      break;                   
                       
        case "4":
      $temptype = "鞋子";
      break;
                       
        case "5":
      $temptype = "道具";
      break;
        case "6":
      $temptype = "特殊";
      break;
      }
   $getcname=$DB_site->query_first("select ch_name from wog_character where ch_id='".$d_ch_id."'");
      if (!$getcname){
      $tempcname ="";
      }else{
      $tempcname ="$getcname[ch_name] $d_ch_pro%";
      }
   $nowtime=time();
   $time=round(($getitemlist[dateline]-$nowtime)/60/60/24);
   $temp_s = $temp_s."<tr><td>".$tempplayer."</td><td>".$d_name." (".$temptype.")</td><td>".$d_at."</td><td>".$d_mat."</td><td>".$d_df."</td><td>".$d_mdf."</td><td>".$d_agl."</td><td>".$tempcname."</td><td>力:".$d_mstr." 速:".$d_magl." 智:".$d_msmart."</td><td>".$getitemlist[s_money]."</td><td>".$d_money."</td><td>".$time." 天</td><td><input type='radio' value='".$getitemlist[s_id]."' name='temp_s_id'></td></tr>";
   }
echo $temp_s;
?>
<tr>
<td colSpan="22" width="748"><input class='text' type="submit" name="Submit" value="更新/送出">刪除已選取拍賣:<input type="checkbox" name="del_sale" value="1"></td>
</tr>
</tbody>
</table>
<input type="hidden" value="<?=$_SESSION["SID"];?>" name="sid">
<input type='hidden' name='actions' value='檢視拍賣'>
</form>       
<?
}

//檢視拍賣
function bid_admin()
{
check_ulv();
global $DB_site;
$temps_id = $_POST["temp_s_id"];
   if($_POST["del_sale"] != "1")
   {
   $imodify=$DB_site->query_first("select * from wog_sale where s_id='".$temps_id."'");
      if($imodify)
      {
      $s_id=$imodify["s_id"];
      $p_id=$imodify["p_id"];
      $d_id=$imodify["d_id"];
      $s_money=$imodify["s_money"];
      $dateline=$imodify["dateline"];
      }else{
      alertMsg("別自創拍賣物品阿");
      bid_list();
      exit;
      }
   $player=$DB_site->query_first("select p_name from wog_player where p_id='".$p_id."'");
      if($player)
      {
      $p_name=$player["p_name"];
      }
   $dfname=$DB_site->query_first("select d_name from wog_df where d_id='".$d_id."'");
      if($dfname)
      {
      $d_name=$dfname["d_name"];
      }
   $nowtime=time();
   $time=round(($dateline-$nowtime)/60/60/24);
   ?>
   <form action="acpmain.php" method="POST" target="_self">
   <table borderColor="#4b689e" cellSpacing="0" cellPadding="2" width="320" align="center" border="1">
   <tbody>
   <tr>
   <td colSpan="5" width="320">拍賣資料</td>
   </tr>
   <tr>
   <td>拍賣者:</td>
   <td><?=$p_name;?></td><td><input class='text' type="text" value="<?=$p_id;?>" name="p_id" size="10"></td>
   </tr>
   <tr>
   <td>商品:</td>
   <td><?=$d_name;?></td><td><input class='text' type="text" value="<?=$d_id;?>" name="d_id" size="10"></td>
   </tr>
   <tr>
   <td>金額:</td>
   <td><?=$s_money;?> 元</td><td><input class='text' type="text" value="<?=$s_money;?>" name="s_money" size="10"></td>
   </tr>
   <tr>
   <td>剩餘日:</td>
   <td><?=$time;?> 日</td><td><input class='text' type="text" value="<?=$time;?>" name="time" size="10"></td>
   </tr>
   <tr>
   <td colSpan="3" width="320"><input class='text' type="submit" name="Submit" value="傳送"></td>
   </tr>
   </tbody>
   </table>
   <input type='hidden' name='actions' value='更新拍賣'>
   <input type="hidden" value="<?=$s_id;?>" name="s_id">
   <input type="hidden" value="<?=$_SESSION["SID"];?>" name="sid">
   </form>
   <?
   }else{
   $DB_site->query("delete from wog_sale where s_id='".$temps_id."'");
   echo "從wog_sale刪除此拍賣成功!<BR>";         
   }
}

function bid_admin_sub()
{
check_ulv();
global $DB_site;
$s_id = $_POST["s_id"];
$p_id = $_POST["p_id"];
$d_id = $_POST["d_id"];
$s_money = $_POST["s_money"];
$dateline = time()+$_POST["time"]*24*60*60;
   if($p_id=="" || $d_id=="" || $s_money=="" || $dateline=="")
   {
   alertMsg("拍賣者ID、商品ID、金額、剩餘日,不可空白");
   }else{
      if($s_money=="0" || $dateline=="0")
      {
      alertMsg("金額、剩餘日,不可為0");
      }else{
      $DB_site->query("Update wog_sale set p_id ='".$p_id."',d_id='".$d_id."',s_money='".$s_money."',dateline='".$dateline."' where s_id='".$s_id."'");
      echo "拍賣更新成功!";
      }
   }
}


儲存檔案,關閉。(完)


如有任何累贅OR錯誤的地方,請回復告知 :oops:
(很早以前寫的,不知道有沒有PO完全)

============================
還是停留在 修改程式碼 + 寫小小功能 的我 :oops:[quote="涅魂"]<u>積分 +3</u>

分享修改

at 2007-03-23 07:46 pm[/point]




涅魂
 
文章: 4463
註冊時間: 2004-01-04 11:17 am
來自: Taiwan
性別: 男生

文章涅魂 » 2007-03-23 7:48 pm

不錯的分享,謝謝月的付出囉 :wink:

其實最近有想過要寫個後台,不過還是等大學考上再說吧 XD


圖檔


回到 精華區

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 5 位訪客