?? admin_map.php
字號:
<?php
if(!defined('IN_DISCUZ')){exit('Access Denied');}
if($gm==0){exit('無效的越權(quán)訪問!');}
$strarr=array(" ","\\'","\'","'","%",";","\\","\"","<",">");
if($action=='edit'){
$act='editsave';
$show='編輯地圖';
$mapid=intval($mapid);
$mapinfo=$db->get_one("SELECT * FROM {$tablepre}wxmap where mapid='$mapid'");
if(!$mapinfo){
showmessage("無效操作",'pet.php?index=admin&adminindex=map');
}
}elseif($action=='add'){
$show='增加地圖';
$mapinfo=array();
$act='addsave';
}elseif($action=='del'){
$mapid=intval($mapid);
showmessage("刪除此地圖將刪除此地圖的所有怪物,確定刪除嗎?<BR><BR><a href='pet.php?index=admin&adminindex=map'>地圖設(shè)置</a> || <A href='pet.php?index=admin&adminindex=map&mapid=$mapid&action=delsave'>確定刪除</a>");
}elseif($action=='delsave'){
$mapid=intval($mapid);
$db->query("delete from {$tablepre}wxmap where mapid='$mapid'");
$db->query("delete from {$tablepre}wxnpcdata where mapid='$mapid'");
showmessage("刪除地圖成功!<BR><BR><a href=pet.php?index=admin&adminindex=map>地圖設(shè)置</a>");
}elseif($action=='addsave'){
$mapname=str_replace($strarr,"",$mapname);
$moretxt=str_replace($strarr,"",$moretxt);
$username=str_replace($strarr,"",$username);
$query=$db->get_one("SELECT * FROM {$tablepre}wxmap where mapname='$mapname'");
if($query){
showmessage("地圖名稱已經(jīng)存在,請?zhí)顚懥硗庖粋€名字!","javascript:history.back()");
}elseif($mapname=='' or cnstrlen($mapname)>10){
showmessage("請正確輸入地圖的名稱!","javascript:history.back()");
}elseif($moretxt=='' or cnstrlen($moretxt)>20){
showmessage("請正確輸入地圖的說明!","javascript:history.back()");
}else{
$maxlevel=intval($maxlevel);
$maxjob=intval($maxjob);
$minlevel=intval($minlevel);
$requirejob=intval($requirejob);
$maxpeople=intval($maxpeople);
$fyl=intval($fyl);
$db->query("insert into {$tablepre}wxmap (mapname,moretxt,maxlevel,requirejob,maxpeople,maxjob,fyl,minlevel,username) values ('$mapname','$moretxt','$maxlevel','$requirejob','$maxpeople','$maxjob','$fyl','$minlevel','$username')");
showmessage("地圖增加完成,請到怪物設(shè)置頁面添加怪物數(shù)據(jù)!<BR><BR><a href=pet.php?index=admin&adminindex=map>地圖設(shè)置</a>");
}
}elseif($action=='editsave'){
$mapid=intval($mapid);
$mapname=str_replace($strarr,"",$mapname);
$moretxt=str_replace($strarr,"",$moretxt);
$username=str_replace($strarr,"",$username);
$mapinfo=$db->get_one("SELECT * FROM {$tablepre}wxmap where mapid='$mapid'");
if(!$mapinfo){
showmessage("無效操作",'pet.php?index=admin&adminindex=map');
}elseif($mapname=='' or cnstrlen($mapname)>10){
showmessage("請正確輸入地圖的名稱!","javascript:history.back()");
}elseif($moretxt=='' or cnstrlen($moretxt)>20){
showmessage("請正確輸入地圖的說明!","javascript:history.back()");
}else{
$query=$db->get_one("SELECT * FROM {$tablepre}wxmap where mapid<>'$mapid' and mapname='$mapname'");
if($query){
showmessage("地圖名稱已經(jīng)存在,請?zhí)顚懥硗庖粋€名字!","javascript:history.back()");
}else{
$maxlevel=intval($maxlevel);
$maxjob=intval($maxjob);
$minlevel=intval($minlevel);
$requirejob=intval($requirejob);
$maxpeople=intval($maxpeople);
$fyl=intval($fyl);
$db->query("update {$tablepre}wxmap set mapname='$mapname',moretxt='$moretxt',maxjob='$maxjob',minlevel='$minlevel',maxlevel='$maxlevel',requirejob='$requirejob',fyl='$fyl',maxpeople='$maxpeople',username='$username' where mapid='$mapid'");
showmessage("地圖設(shè)置完成!<BR><BR><a href=pet.php?index=admin&adminindex=map>地圖設(shè)置</a>");
}
}
}elseif($action=='export'){
$mapid=intval($mapid);
$mapinfo=$db->get_one("SELECT * FROM {$tablepre}wxmap where mapid='$mapid'");
if(!$mapinfo){
showmessage("無效操作",'pet.php?index=admin&adminindex=map');
}else{
$mapname=$mapinfo[mapname];
$npctxt="怪物名稱 \t怪物圖片\t怪物等級\t怪物血量\t怪物經(jīng)驗\t怪物攻擊\t怪物防御\t怪物屬性\t怪物說話\n";
$query = $db->query("SELECT * FROM {$tablepre}wxnpcdata where mapid='$mapid' order by npcid");
while($npcinfo = $db->fetch_array($query)) {
$npctxt.="$npcinfo[npcname]\t$npcinfo[npcpic]\t$npcinfo[npclevel]\t$npcinfo[npcmaxhp]\t$npcinfo[npcexp]\t$npcinfo[npcatk]\t$npcinfo[npcdef]\t$npcinfo[npcsx]\t$npcinfo[npctalk]\n";
}
header("Cache-Control: no-cache, must-revalidate");
header("Content-type: text/plain;charset=GBK");
header('Content-Disposition: attachment; filename="'.$mapname.'.txt"');
echo $npctxt;
exit;
//text/plain
}
}else{
$action='show';
$maplist=array();
$query = $db->query("SELECT * FROM {$tablepre}wxmap ORDER BY requirejob,mapid");
while($mapinfo = $db->fetch_array($query)) {
$maplist[]=$mapinfo;
}
}
include template('admin_map',9938,'wxpet/templates');
?>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -