?? admin_compose.php
字號:
<?phpif(!defined('IN_DISCUZ')){ exit('Access Denied');} if($gm==0){exit('Access Denied');}if($action=='add'){ $act='addsave'; $show='增加合成配置'; $id=intval($id); $composeinfo=array();}elseif($action=='edit'){ $act='editsave'; $show='編輯合成物品'; $id=intval($id); $composeinfo=$db->get_one("SELECT * FROM {$tablepre}wxcompose where id='$id'"); if(!$composeinfo){showmessage("未定義操作");} }elseif($action=='del'){ $id=intval($id); $db->query("delete FROM {$tablepre}wxcompose where id='$id'"); showmessage("合成物品信息刪除完畢!<BR><BR><a href=pet.php?index=admin&adminindex=compose>寵物系統(tǒng)合成物品設(shè)置</a>"); }elseif($action=='editsave'){ $id=intval($id); $composeinfo=$db->get_one("SELECT * FROM {$tablepre}wxcompose where id='$id'"); if(!$composeinfo){showmessage("合成物品信息不存在!<BR><BR><a href=pet.php?index=admin&adminindex=compose>寵物系統(tǒng)合成物品設(shè)置</a>");} $randnum=intval($randnum); $costcwb=intval($costcwb); if(!preg_match("/^[a-zA-Z0-9_]{3,15}$/", $composeitem) ){ showmessage("請輸入正確的合成物品英文名!","javascript:history.back()"); } if($randnum>100 || $randnum<1){ showmessage("請正確輸入合成概率!","javascript:history.back()"); } if(!preg_match("/^[a-z0-9_,]{3,60}$/", $itemarr)){ showmessage("請輸入正確的物品配置清單","javascript:history.back()"); } if(!preg_match("/^[0-9,]{1,60}$/", $itemnumarr)){ showmessage("請輸入正確的物品數(shù)量配置","javascript:history.back()"); } $itemarray=explode(',',$itemarr); $itemnumarray=explode(',',$itemnumarr); if(count($itemarray)!=count($itemnumarray)){ showmessage("請輸入正確的物品數(shù)量清單","javascript:history.back()"); } for($i=0;$i<count($itemnumarray);$i++){ if(intval($itemnumarray[$i])<0){ showmessage("請輸入正確的物品數(shù)量清單","javascript:history.back()"); } } $query = $db->get_one("select count(*) as nums from {$tablepre}wxitem where itemname in ('".str_replace(",","','",$itemarr)."')"); if($query[nums]!=count($itemarray)){ showmessage("請輸入正確的物品配置清單","javascript:history.back()"); } $query = $db->get_one("select itemname from {$tablepre}wxitem where itemname='$composeitem'"); if(!$query){ showmessage("請輸入正確的合成物品英文名","javascript:history.back()"); } $db->query("update {$tablepre}wxcompose set composeitem='$composeitem',itemarr='$itemarr',itemnumarr='$itemnumarr',randnum='$randnum',costcwb='$costcwb' where id='$id'"); showmessage("合成物品設(shè)置修改完成!<BR><BR><a href=pet.php?index=admin&adminindex=compose>寵物系統(tǒng)合成物品設(shè)置</a>");}elseif($action=='addsave'){ $randnum=intval($randnum); $costcwb=intval($costcwb); if(!preg_match("/^[a-zA-Z0-9_]{3,15}$/", $composeitem) ){ showmessage("請輸入正確的合成物品英文名!","javascript:history.back()"); } if($randnum>100 || $randnum<1){ showmessage("請正確輸入合成概率!","javascript:history.back()"); } if(!preg_match("/^[a-z0-9_,]{3,60}$/", $itemarr)){ showmessage("請輸入正確的物品配置清單","javascript:history.back()"); } if(!preg_match("/^[0-9,]{1,60}$/", $itemnumarr)){ showmessage("請輸入正確的物品數(shù)量配置","javascript:history.back()"); } $itemarray=explode(',',$itemarr); $itemnumarray=explode(',',$itemnumarr); if(count($itemarray)!=count($itemnumarray)){ showmessage("請輸入正確的物品數(shù)量清單","javascript:history.back()"); } for($i=0;$i<count($itemnumarray);$i++){ if(intval($itemnumarray[$i])<0){ showmessage("請輸入正確的物品數(shù)量配置","javascript:history.back()"); } } $query = $db->get_one("select count(*) as nums from {$tablepre}wxitem where itemname in ('".str_replace(",","','",$itemarr)."')"); if($query[nums]!=count($itemarray)){ showmessage("請輸入正確的物品配置清單","javascript:history.back()"); } $query = $db->get_one("select itemname from {$tablepre}wxitem where itemname='$composeitem'"); if(!$query){ showmessage("請輸入正確的合成物品英文名","javascript:history.back()"); }else{ $composeitem=$query['itemname']; } $db->query("insert into {$tablepre}wxcompose (itemarr,itemnumarr,composeitem,randnum,costcwb) values ('$itemarr','$itemnumarr','$composeitem','$randnum','$costcwb')"); showmessage("合成物品信息添加成功!<BR><BR><a href=pet.php?index=admin&adminindex=compose>寵物系統(tǒng)合成物品設(shè)置</a>"); }else{ $action='show'; $itemtypelist='<a href=pet.php?index=admin&adminindex=compose&action=show&itemtype=0>所有</a> |'; foreach($typecname as $typeid => $values) { $itemtypelist.=" <a href=pet.php?index=admin&adminindex=compose&action=show&itemtype=$typeid>$values</a> |"; } $itemtype=intval($itemtype)>=0?intval($itemtype):0; if($itemtype==0){ $sqlaa="select count(*) as num from {$tablepre}wxcompose"; $sqlbb=""; }else{ $sqlaa="select count(*) from {$tablepre}wxcompose a, {$tablepre}wxitem b where a.composeitem=b.itemname and b.itemtype='$itemtype'"; $sqlbb=" and b.itemtype='$itemtype' "; } $perpage = 10; $page=intval($page)?intval($page):1; $num = $db->result($db->query($sqlaa),0); $page=($page>ceil($num/$perpage))?ceil($num/$perpage):$page; $mpurl = "pet.php?index=admin&adminindex=compose&action=show&itemtype=$itemtype"; $mulpage=multi($num, $perpage, $page, $mpurl); $star = $num==0?0:($page * $perpage - $perpage); $itemlist=array(); $query = $db->query("select a.*,b.maxjob,b.career,b.selltag,b.addname,b.upitemname,b.itemtype,b.cname,b.moretxt,b.cwb,b.pic,b.requirejob,b.requirelevel,b.addnum,b.itemsex,b.str,b.vit,b.dex,b.kno,b.agi,b.maxhp,b.maxmp,b.usetag from {$tablepre}wxcompose a,{$tablepre}wxitem b where a.composeitem=b.itemname $sqlbb order by b.itemtype LIMIT $star,$perpage"); while($iteminfo = $db->fetch_array($query)) { $itemname=$iteminfo['composeitem']; $itemtype=$iteminfo['itemtype']; $iteminfo['moretxt']=moretxt($iteminfo); $iteminfo['typename']=$typecname[$itemtype]; $itemlist[] = $iteminfo; } }include template('admin_compose',9938,'wxpet/templates');?>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -