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

📄 admin_pettype.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=='edit'){	$act='editsave';	$show='编辑宠物种类';	$id=intval($id);	$petinfo=$db->get_one("SELECT * FROM {$tablepre}wxpettype where id='$id'");	if(!$petinfo){showmessage("未定义操作");}}elseif($action=='add'){	$show='增加宠物种类';	$petinfo=array();	$petinfo['requirejob']=0;	$act='addsave';}elseif($action=='del'){	$id=intval($id);	$petinfo=$db->get_one("SELECT newpetclass FROM {$tablepre}wxpettype where id='$id'");	if(!$petinfo){showmessage("未定义操作");}	$newpetclass=$petinfo['newpetclass'];	showmessage("删除此宠物种类注意事项:请勿删除<font color=red> images/pet/pet/".$newpetclass." </font>此文件夹里的宠物图片!<br>否则将影响购买此类型宠物会员宠物图片显示!<BR><BR><a href='pet.php?index=admin&adminindex=pettype'>宠物种类设置</a> || <A href='pet.php?index=admin&adminindex=pettype&id=$id&action=delsave'>确定删除</a>");	}elseif($action=='delsave'){	$id=intval($id);	$petinfo=$db->get_one("SELECT * FROM {$tablepre}wxpettype where id='$id'");	if(!$petinfo){showmessage("未定义操作");}	$db->query("delete from {$tablepre}wxpettype where id='$id'");	showmessage("删除宠物种类成功!<BR><BR><a href=pet.php?index=admin&adminindex=pettype>宠物种类设置</a>");}elseif($action=='addsave'){	$strarr=array(" ","\\'","\'","'","%",";","\\","\"");	$pet=str_replace($strarr,"",$pet);	$pettxt=str_replace($strarr,"",$pettxt);	$newpetclass=str_replace($strarr,"",$newpetclass);	if($pettype!=2) $pettype=1;	if($petsex!=2 && $petsex!=1) $petsex=0;	$eggmoney=intval($eggmoney);	$atk=intval($atk);	$def=intval($def);   	if($pet=='' or cnstrlen($pet)>15){showmessage("宠物名称不能为空,或者太长了!","javascript:history.back()");}	$query=$db->get_one("SELECT * FROM {$tablepre}wxpettype where  pet='$pet'");	if($query){showmessage("宠物名称已经存在,请填写另外一个名字!","javascript:history.back()");}		if($pettype==2){		$requirejob=intval($requirejob);	}else{		$requirejob=0;	}		if(!preg_match("/^[a-zA-Z]{1,8}$/", $newpetclass)){showmessage("图片目录只能为英文字符!","javascript:history.back()");}	$query=$db->get_one("SELECT * FROM {$tablepre}wxpettype where  newpetclass='$newpetclass'");	if($query){showmessage("图片目录名称已经存在,请填写另外一个名称!","javascript:history.back()");}   	if(!in_array($petsx,array('金','木','水','火','土','光','暗'))){showmessage("宠物属性有误,请输入【金、木、水、火、土、光、暗】的一种!","javascript:history.back()");}	if($pettype==2 && ($eggmoney==0 || $atk==0 || $def==0)){showmessage("当前宠物种类为转生所,宠物基本防御、基本攻击和宠物价格不能设置为0!","javascript:history.back()");}	if($pettxt=='' or cnstrlen($pettxt)>50){showmessage("宠物说明不能为空,或者太长了!","javascript:history.back()");}			$db->query("insert into {$tablepre}wxpettype (pet,pettxt,newpetclass,petsx,atk,def,eggmoney,pettype,petsex,requirejob) values ('$pet','$pettxt','$newpetclass','$petsx','$atk','$def','$eggmoney','$pettype','$petsex','$requirejob')");	showmessage("宠物种类增加完成,请确认图片是否已经上传到论坛服务器!<BR><BR><a href=pet.php?index=admin&adminindex=pettype>宠物种类设置</a>");}elseif($action=='editsave'){	$strarr=array(" ","\\'","\'","'","%",";","\\","\"");	$id=intval($id);	$petinfo=$db->get_one("SELECT * FROM {$tablepre}wxpettype where id='$id'");	if(!$petinfo){showmessage("宠物种类数据不存在!<BR><BR><a href=pet.php?index=admin&adminindex=pettype>宠物种类设置</a>");}  	$pet=str_replace($strarr,"",$pet);	$pettxt=str_replace($strarr,"",$pettxt);	$newpetclass=str_replace($strarr,"",$newpetclass);	if($pettype!=2) $pettype=1;	if($petsex!=2 && $petsex!=1) $petsex=0;	$eggmoney=intval($eggmoney);	$atk=intval($atk);	$def=intval($def);   	if($pet=='' or cnstrlen($pet)>15){showmessage("宠物名称不能为空,或者太长了!","javascript:history.back()");}	$query=$db->get_one("SELECT * FROM {$tablepre}wxpettype where id<>'$id' and pet='$pet'");	if($query){showmessage("宠物名称已经存在,请填写另外一个名字!","javascript:history.back()");}		if($pettype==2){		$requirejob=intval($requirejob);	}else{		$requirejob=0;	}		if(!preg_match("/^[a-zA-Z]{1,8}$/", $newpetclass)){showmessage("图片目录只能为英文字符!","javascript:history.back()");}	$query=$db->get_one("SELECT * FROM {$tablepre}wxpettype where id<>'$id' and newpetclass='$newpetclass'");	if($query){showmessage("图片目录名称已经存在,请填写另外一个名称!","javascript:history.back()");}   	if(!in_array($petsx,array('金','木','水','火','土','光','暗'))){showmessage("宠物属性有误,请输入【金、木、水、火、土、光、暗】的一种!","javascript:history.back()");}	if($pettype==2 && ($eggmoney==0 || $atk==0 || $def==0)){showmessage("当前宠物种类为转生所,宠物基本防御、基本攻击和宠物价格不能设置为0!","javascript:history.back()");}	if($pettxt=='' or cnstrlen($pettxt)>50){showmessage("宠物说明不能为空,或者太长了!","javascript:history.back()");}		$db->query("update {$tablepre}wxpettype set requirejob='$requirejob', pet='$pet',pettxt='$pettxt',newpetclass='$newpetclass',petsx='$petsx',atk='$atk',def='$def',eggmoney='$eggmoney',pettype='$pettype',petsex='$petsex' where id='$id'");	showmessage("宠物种类修改完成!<BR><BR><a href=pet.php?index=admin&adminindex=pettype>宠物种类设置</a>");}else{	$action='show';	$petlist=array(); 	$query = $db->query("SELECT * FROM {$tablepre}wxpettype  ORDER BY id");	while($petinfo = $db->fetch_array($query)) {		if($petinfo['pettype']==1){			$petinfo['other']='<font color=green>宠物商店</font>';		}else{			$petinfo['other']='<font color=red>转生所</font>';		}		$petlist[]=$petinfo;	}}include template('admin_pettype',9938,'wxpet/templates');?>

⌨️ 快捷键说明

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