?? admin_pettype.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 + -