⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 admin_compose.php

📁 天使宠物 V6 Final版 天使宠物 V6 Final版目前支持Discuz!6.0 和 Discuz!6.1论坛
💻 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>宠物系统合成物品设置</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>宠物系统合成物品设置</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("请输入正确的物品数量配置","javascript:history.back()");	}	$itemarray=explode(',',$itemarr);	$itemnumarray=explode(',',$itemnumarr);	if(count($itemarray)!=count($itemnumarray)){		showmessage("请输入正确的物品数量清单","javascript:history.back()");	}	for($i=0;$i<count($itemnumarray);$i++){		if(intval($itemnumarray[$i])<0){			showmessage("请输入正确的物品数量清单","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("合成物品设置修改完成!<BR><BR><a href=pet.php?index=admin&adminindex=compose>宠物系统合成物品设置</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("请输入正确的物品数量配置","javascript:history.back()");	}		$itemarray=explode(',',$itemarr);	$itemnumarray=explode(',',$itemnumarr);	if(count($itemarray)!=count($itemnumarray)){		showmessage("请输入正确的物品数量清单","javascript:history.back()");	}	for($i=0;$i<count($itemnumarray);$i++){		if(intval($itemnumarray[$i])<0){			showmessage("请输入正确的物品数量配置","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>宠物系统合成物品设置</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');?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -