-
New-TypeChobits
-
- 文章: 176
- 註冊時間: 2003-12-12 9:44 am
- 來自: HONG KONG
- 性別: 男生
-
由 New-TypeChobits » 2004-04-17 5:02 pm
拍賣系統....
CORE原自WOG 2.0.5, 由於已作大幅度的修改,故此未必適合其他WOG
如不熟悉MySQL,PHP,Javascript的使用者 勿試...
Mysql
在wog_sale加入欄位
"f_money":INT UNSIGNED 長度9, 預設值0
"b_money":INT UNSIGNED 長度9, 預設值0
"bid_count":INT 長度 11, 預設值0
"b_id":INT 長度 11, 預設值0
wog.js <修改Function sale_view及sale_item
- 代碼: 選擇全部
function sale_item(s) { var temp_s=""; if(s!=null) { if(s.length!=undefined) { for(var i=0;i<s.length;i++) { if(s[i].checked==true) { temp_s+=","+s[i].value; } } temp_s=temp_s.substr(1,temp_s.length); }else { temp_s=s.value; } } var s1=temp_s.split(","); message_cls(); var view_name=parent.wog_view; view_name.document.write('<form action="wog_act.php" method="post" target="mission">'); view_name.document.write(temp_table1); view_name.document.write('<tr><td colspan="5">拍賣商品</td></tr>'); view_name.document.write('<tr><td colspan="5">拍賣時間單位為天數,時間到期自動下架</td></tr>'); view_name.document.write('<tr><td>'+s1[1]+'</td><td>底價 <input type="text" name="money" size="9" maxlength="9">元<BR>(必須輸入)</td><td>搶先買價錢<input type="text" name="f_money" size="9" maxlength="9">元<BR>(如果關閉此功能請留空)</td><td>每口叫價<input type="text" name="b_money" size="9" maxlength="9">元<BR>(如果關閉此功能請留空)</td><td>拍賣時間 <input type="text" name="day" size="2" maxlength="2">天<BR>(必須輸入)</td></tr>'); view_name.document.write('<tr><td colspan="5"><input class="text" type="submit" value="開始拍賣"></td></tr>'); view_name.document.write('<tr><td colspan="5">拍賣時間不能超過10天,一人拍賣的商品不能超過5種</td></tr>'); view_name.document.write(temp_table2); view_name.document.write('<input type="hidden" name="f" value="sale">'); view_name.document.write('<input type="hidden" name="act" value="sale">'); view_name.document.write('<input type="hidden" name="item_id" value="'+s1[0]+'">'); view_name.document.write('</form>'); }
function sale_view(saletotal,page,s,type) { message_cls(); var view_name=parent.wog_view; view_name.document.write('<form action="wog_etc.php" method="get" name="pageform" target="mission">'); pagesplit(saletotal,page); view_name.document.write('<input type="hidden" name="page" value="1">'); view_name.document.write('<input type="hidden" name="type" value="'+type+'">'); view_name.document.write('<input type="hidden" name="f" value="sale">'); view_name.document.write('<input type="hidden" name="act" value="view">'); view_name.document.write('</form>'); view_name.document.write('<form action="wog_act.php" method="post" target="mission" name=f1>'); view_name.document.write(temp_table1); view_name.document.write('<tr><td colspan="16"><a href=javascript:parent.sel_type("0");>武器</a> <a href=javascript:parent.sel_type("1");>頭部</a> <a href=javascript:parent.sel_type("2");>身體</a> <a href=javascript:parent.sel_type("3");>手套</a> <a href=javascript:parent.sel_type("4");>鞋子</a> <a href=javascript:parent.sel_type("5");>道具</a> <a href=javascript:parent.sel_type("6");>技能之書</a> <a href=javascript:parent.sel_type("8");>寵物</a></td></tr>'); view_name.document.write('<tr><td colspan="16">拍賣商品</td></tr>'); if(type < 7) { view_name.document.write('<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><td>競投次數</td><td>每口價</td><td>選擇</td></tr>'); if(s!="") { var s1=s.split(";"); for(var i=0;i<s1.length;i++) { var s2=s1[i].split(","); view_name.document.write('<tr><td>'+s2[0]+'</td><td>'+s2[16]+'</td><td>'+s2[1]+'</td><td>'+s2[2]+'</td><td>'+s2[3]+'</td><td>'+s2[4]+'</td><td>'+s2[5]+'</td><td>'+s2[6]+'</td><td>力:'+s2[7]+' 速:'+s2[8]+' 智:'+s2[9]+'</td><td>'+s2[12]+'</td><td>'+s2[15]+'</td><td>'+s2[10]+'</td><td>'+s2[13]+'</td><td>'+s2[14]+'</td><td>'+s2[17]+'</td><td><input type="radio" name="s_id" value="'+s2[11]+'"></td></tr>'); } } view_name.document.write('<input type="hidden" name="stype" value="0">'); view_name.document.write('<tr><td colspan="16">你的出價:<input class="text" name="buy_money" type="text" value=""> 搶先買:<input name="f_buy" type="checkbox" value="1"> <input class="text" type="submit" value="競投"></td></tr>'); }else { view_name.document.write('<tr><td>拍賣者</td><td>商品</td><td>AT</td><td>MT</td><td>DEF</td><td>個性</td><td>年紀</td><td>出擊值</td><td>金額</td><td>到期日</td><td></td></tr>'); if(s!="") { var s1=s.split(";"); for(var i=0;i<s1.length;i++) { var s2=s1[i].split(","); view_name.document.write('<tr><td>'+s2[0]+'</td><td>'+s2[2]+'-'+s2[3]+'</td><td>'+s2[4]+'</td><td>'+s2[5]+'</td><td>'+s2[6]+'</td><td>'+pet_type(s2[7])+'</td><td>'+s2[8]+'</td><td>'+s2[9]+'</td><td>'+s2[10]+'</td><td>'+s2[11]+'</td><td><input type="radio" name="s_id" value="'+s2[1]+'"></td></tr>'); } } view_name.document.write('<input type="hidden" name="stype" value="1">'); view_name.document.write('<tr><td colspan="12"><input class="text" type="submit" value="購買"></td></tr>'); } view_name.document.write(temp_table2); view_name.document.write('<input type="hidden" name="f" value="sale">'); view_name.document.write('<input type="hidden" name="act" value="buy">'); view_name.document.write('</form>'); }
wog_act.php <修改Function sale_sale 及sale_buy> - 代碼: 選擇全部
function sale_sale($user_id) { global $DB_site,$_POST,$a_id,$temp_ss,$wog_arry; $money=(int)$_POST["money"]; $f_money=(int)$_POST["f_money"]; $b_money=(int)$_POST["b_money"]; $day=(int)$_POST["day"]; if(empty($_POST["item_id"])) { alertWindowMsg("沒有選擇欲拍賣的裝備"); exit(); } if(empty($day) || empty($money)) { alertWindowMsg("沒有填入天數 或 拍賣金額"); exit(); } if($money<0 || $day<0 || !is_numeric($_POST["money"]) || !is_numeric($_POST["day"]) ) { alertWindowMsg("天數或金額不能為負數,或資料錯誤"); exit(); }
if($f_money != "" && !is_numeric($f_money) ) { alertWindowMsg("搶先買金額不能為負數,或資料錯誤"); exit(); } if($b_money != "" && !is_numeric($b_money) ) { alertWindowMsg("每口價金額不能為負數,或資料錯誤"); exit(); } if($f_money < $money and $f_money != ""){ alertWindowMsg("搶先買金額不能少於拍賣金額"); exit(); }
if($b_money > ($money/10) and $b_money != ""){ alertWindowMsg("每口價金額不能大於底價的10%"); exit(); } if($day>$wog_arry["sale_day"]) { alertWindowMsg("拍賣天數不能大於".$wog_arry["sale_day"]); exit(); } $total=$DB_site->query_first("select count(s_id) as s_id from wog_sale where p_id=".$user_id." "); if($total[0]>=5) { alertWindowMsg("拍賣的商品不能超過5樣"); exit(); } $s2=item_check($user_id,$_POST["item_id"]); if ($a_id == "d_ssk_id"){ alertWindowMsg("特殊技不能拍賣!"); exit(); } $DB_site->query("update wog_item set ".$a_id."='".$temp_ss."' where p_id=".$user_id." "); $DB_site->query("insert wog_sale(p_id,d_id,s_money,f_money,b_money,dateline)values(".$user_id.",".$_POST["item_id"].",".$money.",".$f_money.",".$b_money.",".(time()+($day*24*60*60)).")");
showscript("parent.arm_select()"); unset($d_money); unset($pay); unset($s2); unset($a_id); } function sale_buy($user_id) {
global $DB_site,$_POST,$a_id; $phpbbsidget=$DB_site->query_first("select p_bbsid,p_money from wog_player where p_id=".$user_id.""); $phpbbuserbank=$DB_site->query_first("select user_loan from phpbb_users where user_id=".$phpbbsidget["p_bbsid"].""); if ($phpbbuserbank[user_loan] > 0 ){ alertWindowMsg("你以已用貸款功能,所以銀行禁止你購買拍賣欄商品的權限!"); exit(); }
$temp["money"]="d_money"; $temp["table"]="wog_df"; if(!isset($_POST["s_id"])) { alertWindowMsg("沒有選擇欲購買的裝備"); exit(); }
$pack=$DB_site->query_first("select b.d_type,b.d_id,a.p_id,a.s_money,b.d_name,a.b_id,a.f_money,a.b_money from wog_sale a,wog_df b where a.s_id=".$_POST["s_id"]." and a.d_id=b.d_id "); if(!$pack) { alertWindowMsg("商品已被買走!"); exit(); } check_type($pack[0],1); $temp_add=$pack[1]; $temp["user_id"]=$pack[2]; $temp["d_name"]=$pack[4]; $must_price=$pack[3]; $temp_price=$pack[3]; $temp["buyer_id"]=$pack[5]; $f_money = $pack[6]; $b_money = $pack[7];
if ( $_POST["f_buy"] != 1 and $b_money == 0){ if($_POST["buy_money"]<0 || !is_numeric($_POST["buy_money"])) { alertWindowMsg("出價金額不能為負數,或資料錯誤"); exit(); }} if ($_POST["f_buy"] == 1 and $f_money == 0){ alertWindowMsg("搶先買修件不合!"); exit(); } if($_POST["f_buy"] == 1){ $must_price=$pack[6]; }
if ($temp["buyer_id"] == $user_id and $_POST["f_buy"] != 1){ alertWindowMsg("你已是出價的最高者!"); exit(); } $sql="select ".$a_id." from wog_item where p_id=".$user_id." "; $pack=$DB_site->query_first($sql); $pack[0]=trim($pack[0]); $temp_pack=split(",",$pack[0]); if(count($temp_pack)+1 > 10) { alertWindowMsg("裝備欄中每一系列裝備只能放入10個裝備"); unset($temp_pack); exit(); } if(empty($temp_add)) { alertWindowMsg("沒有選擇欲購買的裝備");
exit(); } $have_price=$DB_site->query_first("select p_money,p_name from wog_player where p_id=".$user_id."");
if($must_price>$have_price[0]){ alertWindowMsg("金額不足"); exit(); }
if ($must_price >= $_POST["buy_money"] and $_POST["f_buy"] != 1 and $b_money == 0){ alertWindowMsg("你已不是最高出價者!"); exit(); } if ($_POST["f_buy"] != 1){ if ($b_money != 0){ //每口價 $DB_site->query("update wog_player set p_money=p_money-".($must_price + $b_money)." where p_id=".$user_id.""); }else{ //普通拍賣 $DB_site->query("update wog_player set p_money=p_money-".$_POST["buy_money"]." where p_id=".$user_id.""); } if ($temp["buyer_id"] != 0){ $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$temp["buyer_id"].",'您已不是 ".$temp["d_name"]." 的最高出價者',".time().")"); $DB_site->query("update wog_player set p_money=p_money+".$must_price." where p_id=".$temp["buyer_id"].""); } //Update 拍賣資料! if ($b_money != 0){ //Update每口價 $DB_site->query("update wog_sale set b_id='".$user_id."',bid_count=bid_count+1 ,s_money=s_money+".$b_money." where s_id='".$_POST["s_id"]."'"); }else{ $DB_site->query("update wog_sale set b_id='".$user_id."',bid_count=bid_count+1 ,s_money='".$_POST["buy_money"]."' where s_id='".$_POST["s_id"]."'"); } }else{ //搶先買! if ($temp["buyer_id"] != 0){ $DB_site->query("update wog_player set p_money=p_money+".$temp_price." where p_id=".$temp["buyer_id"].""); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$temp["buyer_id"].",'你想競投的 ".$temp["d_name"]." 已被 ".$have_price["p_name"]." 用 搶先買的方式 買走了 ',".time().")"); } $DB_site->query("update wog_player set p_money=p_money-".$must_price." where p_id=".$user_id.""); $DB_site->query("update wog_player set p_money=p_money+".$must_price." where p_id=".$temp["user_id"].""); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$temp["user_id"].",'您拍賣的 ".$temp["d_name"]." 被 ".$have_price["p_name"]." 買走',".time().")"); if($pack) { if($pack[0]=="N/A" || empty($pack[0])) { $pack[0]=$temp_add; }else { $pack[0].=",".$temp_add; } $DB_site->query("update wog_item set ".$a_id."='".$pack[0]."' where p_id=".$user_id.""); }else { $DB_site->query("insert into wog_item(".$a_id.",p_id)values('".$temp_add."',".$user_id.")"); } $DB_site->query("delete from wog_sale where s_id=".$_POST["s_id"].""); } unset($pack); unset($temp_add); unset($must_price); unset($have_price); unset($temp); unset($a_id); if ($_POST["f_buy"] != 1){ showscript("parent.job_end(12)");}else{showscript("parent.job_end(6)");}
}
wog_etc.php <修改Function sale_view> - 代碼: 選擇全部
function sale_view($userid) { global $DB_site,$_GET,$a_id; $ttime=time(); //派拍賣物品 $pack=$DB_site->query("select b.d_type,b.d_id,a.p_id,a.b_id,b.d_name,a.s_money from wog_sale a,wog_df b where a.dateline < ".$ttime." and a.d_id=b.d_id "); while($packs=$DB_site->fetch_array($pack)) { check_type($packs[0],1); if ($packs[3] != 0){ $sql="select ".$a_id." from wog_item where p_id=".$packs[3]." "; }else{ $sql="select ".$a_id." from wog_item where p_id=".$packs[2]." "; } $temp_pack=$DB_site->query_first($sql); if($temp_pack) { $temp_pack[0]=trim($temp_pack[0]); $temp_pack_check=split(",",$temp_pack[0]); if(count($temp_pack_check)+1 < 10) { if($temp_pack[0]=="N/A" || empty($temp_pack[0])) { $temp_pack[0]=$packs[1]; }else { $temp_pack[0].=",".$packs[1]; } if ($packs[3] != 0){ $DB_site->query("update wog_item set ".$a_id."='".$temp_pack[0]."' where p_id=".$packs[3].""); $DB_site->query("update wog_player set p_money=p_money+".$packs[5]." where p_id=".$packs[2].""); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$packs[3].",'您已獲得競投物品 ".$packs[4]." 可喜可賀~',".time().")"); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$packs[2].",'您拍賣的 ".$packs[4]." 已被買走',".time().")"); }else{ $DB_site->query("update wog_item set ".$a_id."='".$temp_pack[0]."' where p_id=".$packs[2].""); } } } } $DB_site->query("delete from wog_sale where dateline < ".$ttime." "); $DB_site->query("delete from wog_pet where pe_st=1 and pe_s_dateline < ".$ttime." ");
if(empty($_GET["type"]) || !is_numeric($_GET["type"])) { $_GET["type"]="0"; } if((int)$_GET["type"] < 7) { $sale_total=$DB_site->query_first("select count(a.s_id) as s_id from wog_sale a,wog_player b,wog_df c where a.p_id=b.p_id and a.d_id=c.d_id and c.d_type=".$_GET["type"].""); }else { $sale_total=$DB_site->query_first("select count(a.pe_id) as pe_id from wog_pet a,wog_player b where a.pe_p_id=b.p_id and a.pe_st=1"); } if(empty($_GET["page"]) || !is_numeric($_GET["page"])) { $_GET["page"]="1"; } $temp_s=""; $spage=((int)$_GET["page"]*8)-8; if((int)$_GET["type"] < 7) { $sale=$DB_site->query("select b.p_name,c.d_name,c.d_at,c.d_mat,c.d_df,c.d_mdf,c.d_agl,c.d_mstr,c.d_magl,c.d_msmart,c.d_money,a.s_id,a.s_money,a.dateline,a.bid_count,a.f_money,a.b_id,a.b_money from wog_sale a,wog_player b,wog_df c where a.p_id=b.p_id and a.d_id=c.d_id and c.d_type=".$_GET["type"]." ORDER BY a.s_id desc LIMIT ".$spage.",8 "); while($sales=$DB_site->fetch_array($sale)) { //Detect搶先買 if ($sales[15] != 0){ $temp_f_money = $sales[15]; }else{ $temp_f_money = "---"; } if ($sales[16] != 0){ $top_buyer = $sales[16]; $temp_tbuyer = $DB_site->query_first("select p_name from wog_player where p_id='".$top_buyer."'"); $top_buyer = $temp_tbuyer["p_name"]; }else{ $top_buyer = "---"; } if ($sales[17] != 0){ $b_money = $sales[17]; }else{ $b_money= "---"; } $temp_s.=";".$sales[0].",".$sales[1].",".$sales[2].",".$sales[3].",".$sales[4].",".$sales[5].",".$sales[6].",".$sales[7].",".$sales[8].",".$sales[9].",".$sales[10].",".$sales[11].",".$sales[12].",".date("Y-m-d h:i A",$sales[13]).",".$sales[14].",".$temp_f_money.",".$top_buyer.",".$b_money; } }else { $pet_age=3600*24*10; $sale=$DB_site->query("select b.p_name,a.pe_id,a.pe_name,a.pe_mname,a.pe_at,a.pe_mt,a.pe_def,a.pe_type,a.pe_b_dateline,a.pe_fi,a.pe_money,a.pe_s_dateline from wog_pet a,wog_player b where a.pe_p_id=b.p_id and a.pe_st=1 ORDER BY a.pe_s_dateline desc LIMIT ".$spage.",8 "); while($sales=$DB_site->fetch_array($sale)) { $temp_s.=";".$sales[0].",".$sales[1].",".$sales[2].",".$sales[3].",".$sales[4].",".$sales[5].",".$sales[6].",".$sales[7].",".round((time()-$sales[8])/$pet_age).",".$sales[9].",".$sales[10].",".date("Y-m-d",$sales[11]); } } $DB_site->free_result($sale); unset($sales); $temp_s=substr($temp_s,1,strlen($temp_s)); showscript("parent.sale_view($sale_total[0],".$_GET["page"].",'$temp_s',".$_GET["type"].")"); unset($temp_s); unset($sale_total); }
以上為參考Code... 看不懂就別問我...
參考連結
-
涅魂
-
- 文章: 4463
- 註冊時間: 2004-01-04 11:17 am
- 來自: Taiwan
- 性別: 男生
由 涅魂 » 2006-05-06 10:21 am
補上2.08版本的安裝方式(轉自精華區)
在您的資料庫中輸入下列語法
- 代碼: 選擇全部
ALTER TABLE `wog_sale` ADD `f_money` INT( 9 ) UNSIGNED DEFAULT '0' NOT NULL , ADD `b_money` INT( 9 ) UNSIGNED DEFAULT '0' NOT NULL , ADD `bid_count` INT( 11 ) DEFAULT '0' NOT NULL , ADD `b_id` INT( 11 ) DEFAULT '0' NOT NULL ; 開啟檔案wog/wog.js 尋找 - 代碼: 選擇全部
function sale_item(s) { .......... .......... .......... } function sale_view(saletotal,page,s,type) { .......... .......... .......... }
覆蓋為 - 代碼: 選擇全部
function sale_item(s) { var temp_s=""; if(s!=null) { if(s.length!=undefined) { for(var i=0;i<s.length;i++) { if(s[i].checked==true) { temp_s+=","+s[i].value; } } temp_s=temp_s.substr(1,temp_s.length); }else { temp_s=s.value; } } var s1=temp_s.split(","); message_cls(); var view_name=parent.wog_view; view_name.document.write('<form action="wog_act.php" method="post" target="mission">'); view_name.document.write(temp_table1); view_name.document.write('<tr><td colspan="5">拍賣商品</td></tr>'); view_name.document.write('<tr><td colspan="5">拍賣時間單位為天數,時間到期自動下架</td></tr>'); view_name.document.write('<tr><td>'+s1[1]+'</td><td>底價 <input type="text" name="money" size="9" maxlength="9">元<BR>(必須輸入)</td><td>搶先買價錢<input type="text" name="f_money" size="9" maxlength="9">元<BR>(如果關閉此功能請留空)</td><td>每口叫價<input type="text" name="b_money" size="9" maxlength="9">元<BR>(如果關閉此功能請留空)</td><td>拍賣時間 <input type="text" name="day" size="2" maxlength="2">天<BR>(必須輸入)</td></tr>'); view_name.document.write('<tr><td colspan="5"><input class="text" type="submit" value="開始拍賣"></td></tr>'); view_name.document.write('<tr><td colspan="5">拍賣時間不能超過10天,一人拍賣的商品不能超過5種</td></tr>'); view_name.document.write(temp_table2); view_name.document.write('<input type="hidden" name="f" value="sale">'); view_name.document.write('<input type="hidden" name="act" value="sale">'); view_name.document.write('<input type="hidden" name="item_id" value="'+s1[0]+'">'); view_name.document.write('</form>'); } function sale_view(saletotal,page,s,type) { message_cls(); var view_name=parent.wog_view; view_name.document.write('<form action="wog_etc.php" method="get" name="pageform" target="mission">'); pagesplit(saletotal,page); view_name.document.write('<input type="hidden" name="page" value="1">'); view_name.document.write('<input type="hidden" name="type" value="'+type+'">'); view_name.document.write('<input type="hidden" name="f" value="sale">'); view_name.document.write('<input type="hidden" name="act" value="view">'); view_name.document.write('</form>'); view_name.document.write('<form action="wog_act.php" method="post" target="mission" name=f1>'); view_name.document.write(temp_table1); view_name.document.write('<tr><td colspan="16"><a href=javascript:parent.sel_type("0");>武器</a> <a href=javascript:parent.sel_type("1");>頭部</a> <a href=javascript:parent.sel_type("2");>身體</a> <a href=javascript:parent.sel_type("3");>手套</a> <a href=javascript:parent.sel_type("4");>鞋子</a> <a href=javascript:parent.sel_type("5");>道具</a> <a href=javascript:parent.sel_type("8");>寵物</a></td></tr>'); view_name.document.write('<tr><td colspan="16">拍賣商品</td></tr>'); if(type < 7) { view_name.document.write('<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><td>競投次數</td><td>每口價</td><td>選擇</td></tr>'); if(s!="") { var s1=s.split(";"); for(var i=0;i<s1.length;i++) { var s2=s1[i].split(","); view_name.document.write('<tr><td>'+s2[0]+'</td><td>'+s2[16]+'</td><td>'+s2[1]+'</td><td>'+s2[2]+'</td><td>'+s2[3]+'</td><td>'+s2[4]+'</td><td>'+s2[5]+'</td><td>'+s2[6]+'</td><td>力:'+s2[7]+' 速:'+s2[8]+' 智:'+s2[9]+'</td><td>'+s2[12]+'</td><td>'+s2[15]+'</td><td>'+s2[10]+'</td><td>'+s2[13]+'</td><td>'+s2[14]+'</td><td>'+s2[17]+'</td><td><input type="radio" name="s_id" value="'+s2[11]+'"></td></tr>'); } } view_name.document.write('<input type="hidden" name="stype" value="0">'); view_name.document.write('<tr><td colspan="16">你的出價:<input class="text" name="buy_money" type="text" value=""> 搶先買:<input name="f_buy" type="checkbox" value="1"> <input class="text" type="submit" value="競投"></td></tr>'); }else { view_name.document.write('<tr><td>拍賣者</td><td>商品</td><td>AT</td><td>MT</td><td>DEF</td><td>個性</td><td>年紀</td><td>出擊值</td><td>金額</td><td>到期日</td><td></td></tr>'); if(s!="") { var s1=s.split(";"); for(var i=0;i<s1.length;i++) { var s2=s1[i].split(","); view_name.document.write('<tr><td>'+s2[0]+'</td><td>'+s2[2]+'-'+s2[3]+'</td><td>'+s2[4]+'</td><td>'+s2[5]+'</td><td>'+s2[6]+'</td><td>'+pet_type(s2[7])+'</td><td>'+s2[8]+'</td><td>'+s2[9]+'</td><td>'+s2[10]+'</td><td>'+s2[11]+'</td><td><input type="radio" name="s_id" value="'+s2[1]+'"></td></tr>'); } } view_name.document.write('<input type="hidden" name="stype" value="1">'); view_name.document.write('<tr><td colspan="12"><input class="text" type="submit" value="購買"></td></tr>'); } view_name.document.write(temp_table2); view_name.document.write('<input type="hidden" name="f" value="sale">'); view_name.document.write('<input type="hidden" name="act" value="buy">'); view_name.document.write('</form>'); }
尋找 - 代碼: 選擇全部
s[12]="";
覆蓋為 - 代碼: 選擇全部
s[12]="出價成功"; 開啟檔案wog/class/wog_act_bid.php 全部,覆蓋為 - 代碼: 選擇全部
<? /*===================================================== Copyright (C) ETERNAL<iqstar@ms24.hinet.net> Modify : 2005/01/01 URL : http://www.2233.idv.tw This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. ===================================================== */
class wog_act_bid{ function bid($user_id) { global $DB_site,$_POST,$a_id,$temp_ss,$wog_arry; $money=(int)$_POST["money"]; $f_money=(int)$_POST["f_money"]; $b_money=(int)$_POST["b_money"]; $day=(int)$_POST["day"]; if(empty($_POST["item_id"])) { alertWindowMsg("沒有選擇欲拍賣的裝備"); exit(); } if(empty($day) || empty($money)) { alertWindowMsg("沒有填入天數 或 拍賣金額"); exit(); } if($money<0 || $day<0 || !is_numeric($_POST["money"]) || !is_numeric($_POST["day"]) ) { alertWindowMsg("天數或金額不能為負數,或資料錯誤"); exit(); }
if($f_money != "" && !is_numeric($f_money) ) { alertWindowMsg("搶先買金額不能為負數,或資料錯誤"); exit(); } if($b_money != "" && !is_numeric($b_money) ) { alertWindowMsg("每口價金額不能為負數,或資料錯誤"); exit(); } if($f_money < $money and $f_money != ""){ alertWindowMsg("搶先買金額不能少於拍賣金額"); exit(); }
if($b_money > ($money/10) and $b_money != ""){ alertWindowMsg("每口價金額不能大於底價的10%"); exit(); } if($day>$wog_arry["sale_day"]) { alertWindowMsg("拍賣天數不能大於".$wog_arry["sale_day"]); exit(); } $total=$DB_site->query_first("select count(s_id) as s_id from wog_sale where p_id=".$user_id." "); if($total[0]>=5) { alertWindowMsg("拍賣的商品不能超過5樣"); exit(); } $s2=item_check($user_id,$_POST["item_id"]); if ($a_id == "d_ssk_id"){ alertWindowMsg("特殊技不能拍賣!"); exit(); } $DB_site->query("update wog_item set ".$a_id."='".$temp_ss."' where p_id=".$user_id." "); $DB_site->query("insert wog_sale(p_id,d_id,s_money,f_money,b_money,dateline)values(".$user_id.",".$_POST["item_id"].",".$money.",".$f_money.",".$b_money.",".(time()+($day*24*60*60)).")");
showscript("parent.arm_select()"); unset($d_money); unset($pay); unset($s2); unset($a_id); }
function sale_buy_item($user_id) { global $DB_site,$_POST,$a_id; $temp["money"]="d_money"; $temp["table"]="wog_df"; if(!isset($_POST["s_id"])) { alertWindowMsg($lang['wog_act_arm_noselect']); } $pack=$DB_site->query_first("select b.d_type,b.d_id,a.p_id,a.s_money,b.d_name,a.b_id,a.f_money,a.b_money from wog_sale a,wog_df b where a.s_id=".$_POST["s_id"]." and a.d_id=b.d_id "); if(!$pack) { alertWindowMsg($lang['wog_act_bid_buyed']); } check_type($pack[0],1); $temp_add=$pack[1]; $temp["user_id"]=$pack[2]; $temp["d_name"]=$pack[4]; $must_price=$pack[3]; $temp_price=$pack[3]; $temp["buyer_id"]=$pack[5]; $f_money = $pack[6]; $b_money = $pack[7]; if ( $_POST["f_buy"] != 1 and $b_money == 0){ if($_POST["buy_money"]<0 || !is_numeric($_POST["buy_money"])) { alertWindowMsg("出價金額不能為負數,或資料錯誤"); exit(); }} if ($_POST["f_buy"] == 1 and $f_money == 0){ alertWindowMsg("搶先買修件不合!"); exit(); } if($_POST["f_buy"] == 1){ $must_price=$pack[6]; }
if ($temp["buyer_id"] == $user_id and $_POST["f_buy"] != 1){ alertWindowMsg("你已是出價的最高者!"); exit(); } $sql="select ".$a_id." from wog_item where p_id=".$user_id." "; $pack=$DB_site->query_first($sql); $pack[0]=trim($pack[0]); $temp_pack=split(",",$pack[0]); if(count($temp_pack)+1 > 10) { alertWindowMsg($lang['wog_act_bid_full']); unset($temp_pack); exit(); } if(empty($temp_add)) { alertWindowMsg("沒有選擇欲購買的裝備"); exit(); } $have_price=$DB_site->query_first("select p_money,p_name from wog_player where p_id=".$user_id.""); if($must_price>$have_price[0] || $_POST["buy_money"]>$have_price[0]){ alertWindowMsg("金額不足"); exit(); }
if ($must_price >= $_POST["buy_money"] and $_POST["f_buy"] != 1 and $b_money == 0){ alertWindowMsg("你已不是最高出價者!"); exit(); } if ($_POST["f_buy"] != 1){ if ($b_money != 0){ //每口價 $DB_site->query("update wog_player set p_money=p_money-".($must_price + $b_money)." where p_id=".$user_id.""); }else{ //普通拍賣 $DB_site->query("update wog_player set p_money=p_money-".$_POST["buy_money"]." where p_id=".$user_id.""); } if ($temp["buyer_id"] != 0){ $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$temp["buyer_id"].",'您已不是 ".$temp["d_name"]." 的最高出價者',".time().")"); $DB_site->query("update wog_player set p_money=p_money+".$must_price." where p_id=".$temp["buyer_id"].""); } //Update 拍賣資料! if ($b_money != 0){ //Update每口價 $DB_site->query("update wog_sale set b_id='".$user_id."',bid_count=bid_count+1 ,s_money=s_money+".$b_money." where s_id='".$_POST["s_id"]."'"); }else{ $DB_site->query("update wog_sale set b_id='".$user_id."',bid_count=bid_count+1 ,s_money='".$_POST["buy_money"]."' where s_id='".$_POST["s_id"]."'"); } }else{ //搶先買! if ($temp["buyer_id"] != 0){ $DB_site->query("update wog_player set p_money=p_money+".$temp_price." where p_id=".$temp["buyer_id"].""); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$temp["buyer_id"].",'你想競投的 ".$temp["d_name"]." 已被 ".$have_price["p_name"]." 用 搶先買的方式 買走了 ',".time().")"); } $DB_site->query("update wog_player set p_money=p_money-".$must_price." where p_id=".$user_id.""); $DB_site->query("update wog_player set p_money=p_money+".$must_price." where p_id=".$temp["user_id"].""); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$temp["user_id"].",'您拍賣的 ".$temp["d_name"]." 被 ".$have_price["p_name"]." 買走',".time().")"); if($pack) { if($pack[0]=="N/A" || empty($pack[0])) { $pack[0]=$temp_add; }else { $pack[0].=",".$temp_add; } $DB_site->query("update wog_item set ".$a_id."='".$pack[0]."' where p_id=".$user_id.""); }else { $DB_site->query("insert into wog_item(".$a_id.",p_id)values('".$temp_add."',".$user_id.")"); } $DB_site->query("delete from wog_sale where s_id=".$_POST["s_id"].""); } unset($pack); unset($temp_add); unset($must_price); unset($have_price); unset($temp); unset($a_id); if ($_POST["f_buy"] != 1){ showscript("parent.job_end(12)");}else{showscript("parent.job_end(6)");}
}
function sale_buy_pet($user_id) { global $DB_site,$_POST,$lang; if(!isset($_POST["s_id"])) { alertWindowMsg($lang['wog_act_arm_noselect']); } $pack=$DB_site->query_first("select pe_money,pe_p_id,pe_name from wog_pet where pe_id=".$_POST["s_id"]." and pe_st=1 "); if(!$pack) { alertWindowMsg($lang['wog_act_bid_buyed']); } $temp["money"]=$pack["pe_money"]; $temp["user_id"]=$pack["pe_p_id"]; $temp["d_name"]=$pack["pe_name"]; $sql="select pe_id from wog_pet where pe_p_id=".$user_id." and pe_st=0 "; $pack=$DB_site->query_first($sql); if($pack) { alertWindowMsg($lang['wog_act_bid_one']); } $have_price=$DB_site->query_first("select p_money,p_name from wog_player where p_id=".$user_id.""); if($temp["money"]>$have_price[0]){ alertWindowMsg($lang['wog_act_nomoney']); } $DB_site->query("update wog_player set p_money=p_money-".$temp["money"]." where p_id=".$user_id); $DB_site->query("update wog_player set p_money=p_money+".$temp["money"]." where p_id=".$temp["user_id"]); $DB_site->query("update wog_pet set pe_p_id=".$user_id.",pe_st=0,pe_he=0 where pe_id=".$_POST["s_id"]); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$temp["user_id"].",'您拍賣的 ".$temp["d_name"]." 被 ".$have_price["p_name"]." 買走',".time().")"); unset($pack); unset($have_price); unset($temp); unset($a_id); showscript("parent.job_end(6)"); }
function bid_view() { global $DB_site,$_GET,$a_id; $ttime=time(); //派拍賣物品 $pack=$DB_site->query("select b.d_type,b.d_id,a.p_id,a.b_id,b.d_name,a.s_money from wog_sale a,wog_df b where a.dateline < ".$ttime." and a.d_id=b.d_id "); while($packs=$DB_site->fetch_array($pack)) { check_type($packs[0],1); if ($packs[3] != 0){ $sql="select ".$a_id." from wog_item where p_id=".$packs[3]." "; }else{ $sql="select ".$a_id." from wog_item where p_id=".$packs[2]." "; } $temp_pack=$DB_site->query_first($sql); if($temp_pack) { $temp_pack[0]=trim($temp_pack[0]); $temp_pack_check=split(",",$temp_pack[0]); if(count($temp_pack_check)+1 < 10) { if($temp_pack[0]=="N/A" || empty($temp_pack[0])) { $temp_pack[0]=$packs[1]; }else { $temp_pack[0].=",".$packs[1]; } if ($packs[3] != 0){ $DB_site->query("update wog_item set ".$a_id."='".$temp_pack[0]."' where p_id=".$packs[3].""); $DB_site->query("update wog_player set p_money=p_money+".$packs[5]." where p_id=".$packs[2].""); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$packs[3].",'您已獲得競投物品 ".$packs[4]." 可喜可賀~',".time().")"); $DB_site->query("insert into wog_message(p_id,title,dateline)values(".$packs[2].",'您拍賣的 ".$packs[4]." 已被買走',".time().")"); }else{ $DB_site->query("update wog_item set ".$a_id."='".$temp_pack[0]."' where p_id=".$packs[2].""); } } } } $DB_site->query("delete from wog_sale where dateline < ".$ttime." "); $DB_site->query("delete from wog_pet where pe_st=1 and pe_s_dateline < ".$ttime." ");
if(empty($_GET["type"]) || !is_numeric($_GET["type"])) { $_GET["type"]="0"; } if((int)$_GET["type"] < 7) { $sale_total=$DB_site->query_first("select count(a.s_id) as s_id from wog_sale a,wog_player b,wog_df c where a.p_id=b.p_id and a.d_id=c.d_id and c.d_type=".$_GET["type"].""); }else { $sale_total=$DB_site->query_first("select count(a.pe_id) as pe_id from wog_pet a,wog_player b where a.pe_p_id=b.p_id and a.pe_st=1"); } if(empty($_GET["page"]) || !is_numeric($_GET["page"])) { $_GET["page"]="1"; } $temp_s=""; $spage=((int)$_GET["page"]*8)-8; if((int)$_GET["type"] < 7) { $sale=$DB_site->query("select b.p_name,c.d_name,c.d_at,c.d_mat,c.d_df,c.d_mdf,c.d_agl,c.d_mstr,c.d_magl,c.d_msmart,c.d_money,a.s_id,a.s_money,a.dateline,a.bid_count,a.f_money,a.b_id,a.b_money from wog_sale a,wog_player b,wog_df c where a.p_id=b.p_id and a.d_id=c.d_id and c.d_type=".$_GET["type"]." ORDER BY a.s_id desc LIMIT ".$spage.",8 "); while($sales=$DB_site->fetch_array($sale)) { //Detect搶先買 if ($sales[15] != 0){ $temp_f_money = $sales[15]; }else{ $temp_f_money = "---"; } if ($sales[16] != 0){ $top_buyer = $sales[16]; $temp_tbuyer = $DB_site->query_first("select p_name from wog_player where p_id='".$top_buyer."'"); $top_buyer = $temp_tbuyer["p_name"]; }else{ $top_buyer = "---"; } if ($sales[17] != 0){ $b_money = $sales[17]; }else{ $b_money= "---"; } $temp_s.=";".$sales[0].",".$sales[1].",".$sales[2].",".$sales[3].",".$sales[4].",".$sales[5].",".$sales[6].",".$sales[7].",".$sales[8].",".$sales[9].",".$sales[10].",".$sales[11].",".$sales[12].",".date("Y-m-d h:i A",$sales[13]).",".$sales[14].",".$temp_f_money.",".$top_buyer.",".$b_money; } }else { $pet_age=3600*24*10; $sale=$DB_site->query("select b.p_name,a.pe_id,a.pe_name,a.pe_mname,a.pe_at,a.pe_mt,a.pe_def,a.pe_type,a.pe_b_dateline,a.pe_fi,a.pe_money,a.pe_s_dateline from wog_pet a,wog_player b where a.pe_p_id=b.p_id and a.pe_st=1 ORDER BY a.pe_s_dateline desc LIMIT ".$spage.",8 "); while($sales=$DB_site->fetch_array($sale)) { $temp_s.=";".$sales[0].",".$sales[1].",".$sales[2].",".$sales[3].",".$sales[4].",".$sales[5].",".$sales[6].",".$sales[7].",".round((time()-$sales[8])/$pet_age).",".$sales[9].",".$sales[10].",".date("Y-m-d",$sales[11]); } } $DB_site->free_result($sale); unset($sales); $temp_s=substr($temp_s,1,strlen($temp_s)); showscript("parent.sale_view($sale_total[0],".$_GET["page"].",'$temp_s',".$_GET["type"].")"); unset($temp_s); unset($sale_total); } } ?>
儲存,關閉所有檔案
完畢,有問題請提出。
|