PHP トロイの木馬バックドアの調査
七字铺
七字铺 2021-03-26 09:34:51
0
3
921

知識が足りないのでソースコードを入手したのですが、Webシェルのバックドアがあることが分かりました。それが何のコードなのか特定できません。どなたかアドバイスをいただけないでしょうか。

0 && @$val['ifshownav'])) { $newchannel[]=$val; $count ; } if($count==$num) { $newchannel を返します。 } } $newchannel を返します。 } } foreach($channel as $val) { if($fid==$val['fid']) { if($shownav==0 || ($shownav>0 && $val['ifshownav'])) { if($kind==0) { $newchannel[]=$val; $count ; $newchannel[count($newchannel)-1]['key']=$count; }elseif($val['ckind']==$kind) { $newchannel[]=$val; $count ; $newchannel[count($newchannel)-1]['key']=$count; } } } if($count==$num) { 壊す; } } $fidarray=@cnav(cid,1); foreach($newchannel as $key=>$val) { $newchannel[$key]['onstyle']=''; foreach($fidarray as $fidkey=>$fidval) { if($val['cid']==$fidval['cid']) { $newchannel[$key]['onstyle']='on'; 壊す; } } } $newchannel を返します。 } function b($cid='',$return=false,$linktag=' > ',$homepage=SystemDir) { Return cnav($cid,$return,$linktag,$homepage); } function i($kind='',$cid=0) { if($cid===0) { if(!define('cid')) {Return false;} $cid=cid; } $channel=getchannelcache($cid); if(!$channel) { false を返します。 } if(empty($kind)) { $channel を返します。 }elseif($kind=='name' && isset($channel['cname'])) { $channel['cname'] を返します。 }elseif($kind=='topfid') { $breadcrumb=b($channel['cid'],1); if(isset($breadcrumb[0]['cid'])) { $breadcrumb[0]['cid']; を返します。 } }elseif($kind=='url') { Return u($channel['cid']); }elseif($kind=='ドメイン') { Return @$channel['csetting']['channel_domain']; }それ以外 { if(isset($channel[$kind])) { $channel[$kind] を返します。 } } false を返します。 } 関数 uri($uri) { $uri=ltrim($uri,'/'); if(URLRewrite) { SystemDir.$uri を返します。 }それ以外 { SystemDir.IndexFile.'/'.$uri; を返します。 } } 関数 f($file) { require(SystemRoot.TemplateDir.DIRECTORY_SEPARATOR.$file); } function t($file='',$echo=1) { if($echo==1) { echo(SystemDir.TemplateDir.'/'.$file); } SystemDir.TemplateDir.'/'.$file を返します。 } function alist($where='') { if(isset($where['page']) &&!is_numeric($where['page'])) { if(isset($_GET[$where['page']]) && $_GET[$where['page']]>0) { $where['page']=intval($_GET[$where['page']]); }それ以外 { $where['ページ']=1; } } $nullarticle=array('list'=>array(),'pagecount'=>0,'pagesize'=>1,'page'=>1,); if(!isset($where['cid']) &&!defined('cid') &&!isset($where['tablename']) &&!isset($where['cids'])) {Return $nullarticle ;} if(!isset($where['tablename']) && !isset($where['cid']) &&!isset($where['cids']) && define('cid')) {$where[' cid']=cid;} if(!isset($where['cid'])) {$where['cid']=0;} if(is_numeric($where['cid'])) {$where['cid']=intval($where['cid']);} if(SiteCache && isset($where['cache']) && $where['cache']>0) { $キャッシュ場所=$場所; $cachehash=md5(json_encode($where)); $res =cacheget($cachehash,$where['cache'],'alist'); if ($res) {return json_decode($res,1);} } $sql=''; if($where['cid']!==0) { $thischannelcache=getchannelcache($where['cid']); if(!$thischannelcache) {Return $nullarticle;} $where['cid']=$thischannelcache['cid']; } if(!isset($where['tablename'])) {$where['tablename']='';} if(!isset($where['all']) || $where['all']==1) { if(!isset($where['cids'])) {$where['cids']='';} $clistsetting=alist_getson($where['cid'],$where['tablename'],$where['cids']); if(!isset($clistsetting['sql'])) {Return $nullarticle;}$where['cidsql']=$clistsetting['sql']; $where['テーブル名']=$clistsetting['テーブル名']; $defaultsetting=getchannelcache($clistsetting['default']); if(!isset($where['pageurl']) && !isset($clistsetting['pageurl'])) { unset($defaultsetting['csetting']['channel_pageurl']); } }それ以外 { if(!isset($where['cidsql'])) { $where['cidsql']=" and (cid='".$where['cid']."')"; } if($where['cid']) { $defaultsetting=getchannelcache($where['cid']); if(empty($where['tablename']) && isset($defaultsetting['csetting']['articletable'])) { $where['tablename']=$defaultsetting['csetting']['articletable']; } } } $sql.=$where['cidsql']; if(!isset($where['pagesize'])) { if(isset($defaultsetting['csetting']['temppage_size']) && !empty($defaultsetting['csetting']['temppage_size'])) { $where['pagesize']=$defaultsetting['csetting']['temppage_size']; } } if(!isset($where['order'])) { if(isset($defaultsetting['csetting']['temppage_order']) && !empty($defaultsetting['csetting']['temppage_order'])) { $where['order']=$defaultsetting['csetting']['temppage_order']; } } isset($where['addslashes']) ? $ifaddslashes=$where['addslashes']:$ifaddslashes=1; isset($where['テーブル名']) ? $where['テーブル名']=$where['テーブル名']:die('テーブル名なし'); isset($where['pagesize']) ? $where['pagesize']=intval($where['pagesize']):$where['pagesize']=9; isset($where['order']) ? $where['order']='order by '.$where['order']:$where['order']='order by id desc'; isset($where['start']) ? $where['start']=intval($where['start']):$where['start']=0; isset($where['column']) ? $where['column']=$where['column']:$where['column']='*'; isset($where['rowidstyle']) &&!isset($where['rowidname']) ? $where['rowidname']='id' :''; isset($where['linktime']) ? 1==1 : $where['linktime']='posttime'; isset($where['link']) ? 1==1 : $where['link']=''; isset($where['ドメイン']) ? 1==1 : $where['ドメイン']=''; if(trim($where['column'])<>'*') {$where['column'].=',cid';}if(isset($where['where'])) { if(is_array($where['where'])) { foreach($where['where'] as $key=>$val) { $key=addslashes_str($key,$ifaddslashes); if(is_array($val) && count($val)>0) { $sql.=" and ("; foreach($val as $value) { $sql.=$key."='".addslashes_str($value,$ifaddslashes)."' または "; } $sql=substr($sql,0,strlen($sql)-4); $sql.=")"; }それ以外 { $sql.=" and ".$key."='".addslashes_str($val,$ifaddslashes)."'"; } } }それ以外 { $sql.=" and ".$where['where']; } } if(isset($where['inwhere'])) { foreach($where['inwhere'] as $key=>$val) { if(!is_array($val)) { $val=配列(); $val[]=$where['inwhere'][$key]; } $key=addslashes_str($key,$ifaddslashes); foreach($val as $val1) { if(is_numeric($val1) && $val1>0) { $sql.=" and (".$key."='[".$val1."]' または ".$key." like '%,".$val1.",%' または ".$key. " like '[".$val1.",%' または ".$key." like '%,".$val1."]')"; }それ以外 { unset($where['inwhere'][$key]); } } } } if(isset($where['nowhere'])) { foreach($where['nowhere'] as $key=>$val) { $key=addslashes_str($key,$ifaddslashes); if(is_array($val) && count($val)>0) { foreach($val as $value) { $sql.=" and ".$key."<>'".addslashes_str($value,$ifaddslashes).'\''; } }それ以外 { $sql.=" and ".$key."<>'".addslashes_str($val,$ifaddslashes)."'"; } } } if(isset($where['other']) &&!empty($where['other'])) { $sql.=" and ".$where['other']; } if(isset($where['keyword']) && !empty($where['keyword'])) { if(!isset($where['searchcolumn'])) {$where['searchcolumn']='title';} if(!is_array($where['searchcolumn'])) {$where['searchcolumn']=explode(',',$where['searchcolumn']);} if(!is_array($where['keyword'])) {$where['keyword']=explode('|',$where['keyword']);} $sql.=" and ("; foreach($where['searchcolumn'] as $key=>$searchcolumn) { foreach($where['keyword'] as $keywordkey=>$keywordval) { if($key==0 && $keywordkey==0) { $sql.="$searchcolumn like '%".addslashes_str($keywordval,$ifaddslashes)."%'"; }それ以外 { $sql.=" または $searchcolumn like '%".addslashes_str($keywordval,$ifaddslashes)."%'"; } } } $sql.=" )"; } if(!empty($sql)) { $sql='where '.ltrim($sql,'and '); } if(isset($where['page'])) { $where['page']=intval($where['page']); $where['pagecount'] = $GLOBALS['db'] -> fetchcount("SELECT count(id) FROM ".$where['tablename']."$sql"); $where['articlecount']=$where['pagecount']; $where['start']=($where['page']-1)*$where['pagesize']; if($where['articlecount']%$where['pagesize']==0) { $where['pages']=($where['articlecount']/$where['pagesize']); }それ以外 { $where['pages']=intval($where['articlecount']/$where['pagesize']) 1; } if(isset($defaultsetting['csetting']['channel_pageurl']) &&!empty($defaultsetting['csetting']['channel_pageurl']) &&!isset($where['pageurl'])) { $allpageurl=explode(';',$defaultsetting['csetting']['channel_pageurl']); if(URLRewrite) { $where['pageurl']=$allpageurl[0]; }それ以外 { $where['pageurl']=SystemDir.IndexFile.$allpageurl[0]; } } } if(!isset($where['sql'])) { $where['sql_id']='SELECT id FROM '.$where['tablename'].' 「.$sql」 '.$where['order'].'制限 '.$where['start'].','.$where['pagesize']; $idquery =$GLOBALS['db'] ->クエリ($where['sql_id']); $ids = $GLOBALS['db'] -> fetchall($idquery); $sql='id in('; if(count($ids)>0) { foreach($ids as $key=>$val) { $sql.=$val[0].','; } }それ以外 { $sql.='0,'; } $sql=rtrim($sql,','); $sql.=')'; $where['sql']='SELECT '.$where['column'].' FROM 「.$where['テーブル名'].」ここで、「.$sql」 '.$where['order']; } $query = $GLOBALS['db'] ->クエリ($where['sql']); $articles = $GLOBALS['db'] -> fetchall($query); $i=0; foreach ($articles を $value として) { $i ; $value['key']=$i; if(isset($where['stepstyle'])) { foreach($where['stepstyle'] as $key=>$val) {if($i%$key==0) {$value['stepstyle']=$where['stepstyle'][$key] ;}} if(!isset($value['stepstyle'])) {$value['stepstyle']='';} }if(isset($where['rowstyle'])) { foreach($where['rowstyle'] as $key=>$val) {if($i==$key) {$value['rowstyle']=$where['rowstyle'][$key];} } if(!isset($value['rowstyle'])) {$value['rowstyle']='';} } if(isset($where['rowidstyle'])) { foreach($where['rowidstyle'] as $key=>$val) { if($value[$where['rowidname']]==$key) { $value['rowidstyle']=$val; } } if(!isset($value['rowidstyle'])) {$value['rowidstyle']='';} } if(!isset($value[$where['linktime']])) {$value[$where['linktime']]=0;} $value['link']=aurl($value,$where['link'],$value[$where['linktime']],$where['domain']); $where['list'][]=$value; } if(!isset($where['list'])) {$where['list']=array();} if(SiteCache && isset($where['cache']) && $where['cache']>0) { キャッシュセット($cachehash,json_encode($where),$where['cache'],'alist'); } $where を返します。 } function getkinds($cid,$fid) { $fid=intval($fid); $kindsarray=配列($fid); if(is_numeric($cid)) { $thichannelcache=getchannelcache($cid); $defaultsetting=$thichannelcache['csetting']; if(isset($defaultsetting['articletable']) && !empty($defaultsetting['articletable'])) { $kindtable=$defaultsetting['articletable']; }else {$kindsarray を返す;} }それ以外 { $kindtable=$cid; } $query = $GLOBALS['db'] -> query("SELECT id FROM $kindtable where fid='$fid';"); $link = $GLOBALS['db'] -> fetchall($query); foreach ($link を $value として) { $thisallkinds=getkinds($kindtable,$value['id']); foreach ($thisallkinds として $thisvalue) { $kindsarray[]=$thisvalue; } } $kindsarray を返します。 } function alist_getson($cid,$tablename,$cids,$first=1) { if($cid==0 && empty($tablename)) { $tablename=記事テーブル; } $配列=配列(); $array['list']=array(); $channels=getchannelscache(); if($first) { if(!is_array($cids)) {$cids=explode(';',$cids);} $thischannel=getchannelcache($cid); if($thischannel && @$thischannel['ckind']==2 && (in_array($cid,$cids) || empty($cids[0]))) { if(isset($thischannel['csetting']['articletable']) &&!empty($thischannel['csetting']['articletable']) && empty($tablename)) { $tablename=$thischannel['csetting']['articletable']; }if($tablename==$thischannel['csetting']['articletable']) { $array['list'][]=$thischannel; if(isset($thischannel['csetting']['channel_pageurl']) &&!empty($thischannel['csetting']['channel_pageurl'])) { $array['pageurl']=$thischannel['csetting']['channel_pageurl']; } } } $array['テーブル名']=$テーブル名; } foreach($channels as $key=>$val) { if($val['fid']==$cid) { $thischannel=getchannelcache($val['cid']); if(empty($tablename)) { if($thischannel['ckind']==2 && isset($thischannel['csetting']['articletable']) &&(in_array($val['cid'],$cids) || empty($cids[ 0]))) { $array['list'][]=$val; $tablename=$thischannel['csetting']['articletable']; $array['テーブル名']=$テーブル名; } }それ以外 { if($thischannel['ckind']==2 && isset($thischannel['csetting']['articletable']) && $thischannel['csetting']['articletable']==$tablename && (in_array($ val['cid'],$cids) || empty($cids[0]))) { $array['list'][]=$val; } } $sonarray=alist_getson($val['cid'],$tablename,$cids,0); foreach($sonarray['list'] as $key1=>$val1) { $array['list'][]=$val1; } } } if($first) { $cids=array(); $sql=''; foreach($array['list'] as $key=>$val) { if($key==0) { $sql.=" and (cid='".$val['cid']."'"; }elseif($key==(count($array['list'])-1)) { $sql.=" または cid='".$val['cid']."'"; }それ以外 { $sql.=" または cid='".$val['cid']."'"; } } if(count($array['list'])>0) {$array['sql']=$sql.')';} if(isset($array['list'][0])) { $array['default']=$array['list'][0]['cid']; }それ以外 { $array['デフォルト']=0; } $array を返します。 }それ以外 { $array を返します。 } } function aurl($value,$rowurl,$rowurltime,$domain='') { $thissetting=getchannelcache($value['cid']); if(空($ドメイン)) { if(isset($thissetting['csetting']['channel_domain']) && !empty($thissetting['csetting']['channel_domain'])) { $domains=explode(';',$thissetting['csetting']['channel_domain']); $ドメイン=$ドメイン[0]; foreach($domains as $key) { if($key==server_name()) { $ドメイン=ヌル; 壊す; } } } } if(empty($rowurl)) { if(empty($thissetting['csetting']['channel_articleurl'])) { 戻る ''; } $rowurl=$thissetting['csetting']['channel_articleurl']; }if(!empty($where['domain'])) { $domains=explode(';',$where['ドメイン']); $where['ドメイン']=$ドメイン[0]; foreach($domains as $domain) { if($domain==server_name()) { $where['ドメイン']=null; 壊す; } } } unset($thissetting); $rowurls=explode(';',$rowurl); $rowurl=$rowurls[0]; preg_match_all("/{(.*)}|\[(.*)\]|\((.*)\)/isU",$rowurl,$match); if(count($match[0])>0) { foreach($match[0] as $key=>$val) { if($rowurltime>0 && ($val=='(y)' || $val=='(m)' || $val=='(d)')) { isset($value['y']) ? 1==1 : $value['y']=date('Y',$rowurltime); isset($value['m']) ? 1==1 : $value['m']=date('m',$rowurltime); isset($value['d']) ? 1==1 : $value['d']=date('d',$rowurltime); } if(isset($value[$match[1][$key]])) { if(is_numeric($value[$match[1][$key]])) {$rowurl=str_replace($val,$value[$match[1][$key]],$rowurl);}else {$ rowurl=str_replace($val,urlencode($value[$match[1][$key]]),$rowurl);} } if(isset($value[$match[2][$key]])) { if(is_numeric($value[$match[2][$key]])) {$rowurl=str_replace($val,$value[$match[2][$key]],$rowurl); }else {$rowurl=str_replace($val,urlencode($value[$match[2][$key]]),$rowurl); } } if(isset($value[$match[3][$key]])) { if(is_numeric($value[$match[3][$key]])) {$rowurl=str_replace($val,$value[$match[3][$key]],$rowurl); }else {$rowurl=str_replace($val,urlencode($value[$match[3][$key]]),$rowurl); } } } } if(!empty($domain)) { $domain='//'.$domain.server_port(); } if(URLRewrite) { $rowurl=$domain.$rowurl; }それ以外 { $rowurl=$domain.SystemDir.IndexFile.$rowurl; } $rowurl を返します。 } function all_list($where=array(),$pagesize=10,$cid='') { if(!isset($where['cache'])) {$where['cache']=3600;} $cachehash=md5(json_encode($where).$pagesize.json_encode($cid)); $res =cacheget($cachehash,$where['cache'],'alist'); if ($res) {return json_decode($res,1);} if(空($cid)) { $cid=配列(); $allchannels=getchannelscache(); foreach($allchannels as $channel) { if($channel['ckind']==2) { $cid[]=$チャンネル['cid']; } } }elseif(is_numeric($cid)) { $cid=配列($cid); } $articles=array(); foreach($cid as $thiscid) { $where['cid']=$thiscid; $where['pagesize']=$pagesize; $where['all']=0; $thisarticles=alist($where); foreach($thisarticles['list'] as $thisarticle) { $articles[]=$thisarticle; } } $posttime=array(); foreach ($articles as $article) { $posttime[] = $article['posttime']; }$orderarticles=array_multisort($posttime, SORT_DESC, $articles); $returnarticles=array(); $i=0; foreach($articles as $key=>$val) { $i ; $val['key']=$i; $returnarticles[]=$val; if($key==($pagesize-1)) { 壊す; } } if(SiteCache && $where['cache']>0) { キャッシュセット($cachehash,json_encode($returnarticles),$where['cache'],'alist'); } $returnarticles を返します。 } function ainsert($article,$setting='') { if(!is_array($article)) {Return false;} if(empty($setting)) {$setting=array();} if(!isset($setting['cid']) && !isset($article['cid'])) { if(定義('cid')) { $setting['cid']=cid; }それ以外 { 「cid を設定しない」を返します。 } } if(!isset($setting['addslashes'])) {$setting['addslashes']=1;} if(!isset($setting['default'])) {$setting['default']=1;} if(!isset($setting['check'])) {$setting['check']=1;} if(!isset($setting['cid'])) {$setting['cid']=$article['cid'];} if(isset($article['cid'])) {unset($article['cid']);} $channel = getchannelcache($setting['cid']); if(!$channel) {Return 'チャンネルが存在しません';} $setting['cid']=$channel['cid']; $csetting=$channel['csetting']; if(!isset($setting['tablename']) || empty($setting['tablename'])) {$setting['tablename']=$csetting['articletable'];} if(count($article)==0) { 「どこの記事列」を返します。 } foreach($article as $key=>$val) { $article[$key]=addslashes_str($article[$key],$setting['addslashes']); } if($setting['check']) { $columns = $GLOBALS['db'] -> all("select mname,mkind,ifonly,strdefault,msetting from ".tableex('moudle')." where cid=".$setting['cid']." order by morder asc;"); foreach($columns as $thiscolumn) { $key=$thiscolumn['mname']; if(!isset($article[$key]) && $setting['default']) { $article[$key]=$thiscolumn['strdefault']; if($thiscolumn['mkind']==9) { if($thiscolumn['strdefault']=='now') { $article[$key]=時間(); }それ以外{ $thiscolumn['strdefault']=@strtotime($thiscolumn['strdefault']); if($thiscolumn['strdefault']) { $article[$key]=$thiscolumn['strdefault']; }それ以外 { $article[$key]=0; } } } }if(isset($article[$key])) { $thismsetting=json_decode($thiscolumn['msetting'],1); $thisismsetting['ifonly']=$thiscolumn['ifonly']; $thisismsetting['テーブル名']=$setting['テーブル名']; $thismoudlevalue=$article[$key]; if($thismsetting['filterhtml']==1) { require_once(SystemRoot.AdminDir.'/input/kses.php'); $thismoudlevalue= kses($thismoudlevalue); }elseif($thismsetting['filterhtml']==2) { $thismoudlevalue=htmlspecialchars($thismoudlevalue); } $acheck=acheck($key,$thismoudlevalue,$setting['cid'],$thismsetting); if($acheck==='error') {Return $key.'エラー';} if($acheck==='short') {$key を返します。'短い';} if($acheck==='long') {Return $key.'長さ';} if($acheck==='exist') {Return $key.'存在する';} $article[$key]=$thismoudlevalue; } } } $article['cid']=$setting['cid']; if(!isset($article['posttime'])) {$article['posttime']=time();} if(!isset($article['adminuid'])) {$article['adminuid']=0;} $result = $GLOBALS['db'] -> insert($setting['テーブル名'],$article); if($result) {Return $result;}else {Return false;} } function aedit($article,$setting='') { if(!isset($article['id']) || !is_numeric($article['id']) || $article['id']<1) { 「IDエラー」を返します。 } $id=$article['id']; unset($article['id']); if(!is_array($article)) {Return false;} if(empty($setting)) {$setting=array();} if(!isset($setting['cid']) && !isset($article['cid'])) { if(定義('cid')) { $setting['cid']=cid; }それ以外 { 「cid を設定しない」を返します。 } } if(!isset($setting['addslashes'])) {$setting['addslashes']=1;} if(!isset($setting['check'])) {$setting['check']=1;} if(!isset($setting['cid'])) {$setting['cid']=$article['cid'];} if(isset($article['cid'])) {unset($article['cid']);} $channel = getchannelcache($setting['cid']); if(!$channel) {Return 'チャンネルが存在しません';} $setting['cid']=$channel['cid']; $csetting=$channel['csetting']; if(!isset($setting['tablename']) || empty($setting['tablename'])) {$setting['tablename']=$csetting['articletable'];} if(count($article)==0) { 「どこの記事列」を返します。 } foreach($article as $key=>$val) { $article[$key]=addslashes_str($article[$key],$setting['addslashes']); }if($setting['check']) { $columns = $GLOBALS['db'] -> all("select mname,ifonly,strdefault,msetting from ".tableex('moudle')." where cid=".$setting['cid']." order by morder asc;"); foreach($columns as $thiscolumn) { $key=$thiscolumn['mname']; if(isset($article[$key])) { $thismsetting=json_decode($thiscolumn['msetting'],1); $thisismsetting['ifonly']=$thiscolumn['ifonly']; $thisismsetting['テーブル名']=$setting['テーブル名']; $thismoudlevalue=$article[$key]; if($thismsetting['filterhtml']==1) { require_once(SystemRoot.AdminDir.'/input/kses.php'); $thismoudlevalue= kses($thismoudlevalue); }elseif($thismsetting['filterhtml']==2) { $thismoudlevalue=htmlspecialchars($thismoudlevalue); } $acheck=acheck($key,$thismoudlevalue,$setting['cid'],$thismsetting,$id); if($acheck==='error') {Return $key.'エラー';} if($acheck==='short') {$key を返します。'短い';} if($acheck==='long') {Return $key.'長さ';} if($acheck==='exist') {Return $key.'存在する';} $article[$key]=$thismoudlevalue; } } } $result = $GLOBALS['db'] -> update($setting['テーブル名'],"id='$id'",$article); if($result) {Return true;}else {Return false;} } function adel($cid,$id,$tablename='') { if(empty($cid) && empty($tablename)) { if(定義('cid')) { $cid=cid; }それ以外 { 「no cid」を返します。 } } if(empty($id)) {Return 'no id';}else {$id=intval($id);} if(empty($tablename)) { $channel = getchannelcache($cid); if(!$channel) {Return 'チャンネルが存在しません';} $cid=$チャンネル['cid']; $csetting=$channel['csetting']; $tablename=$csetting['articletable']; } $query = $GLOBALS['db'] -> query("delete from `$tablename` WHERE id='$id'"); if($query) { true を返します。 }それ以外 { false を返します。 } } function acheck($mname,$value,$cid='',$thismsetting='',$id=0) { if($cid=='') { if(定義('cid')) { $cid=cid; }それ以外 { 「no cid」を返します。 } }if($thisismsetting=='') { $column = $GLOBALS['db'] -> one("select mname,ifonly,msetting from ".tableex('moudle')." where cid='".$cid." and mname='".$mname."' limit 1;"); $thismsetting=json_decode($column['msetting'],1); $thisismsetting['ifonly']=$column['ifonly']; } if(isset($thismsetting['normal']) && strlen($thismsetting['normal'])>3 &&!empty($value)) { if(!preg_match($thismsetting['レギュラー'],$value)){ 「エラー」を返します。 } } if(isset($thismsetting['lenmin']) && is_numeric($thismsetting['lenmin']) && $thismsetting['lenmin']>0) { if(strlen($value)<$thismsetting['lenmin']) { 「短い」を返します。 } } if(isset($thismsetting['lenmax']) && is_numeric($thismsetting['lenmax']) && $thismsetting['lenmax']>0) { if(strlen($value)>$thismsetting['lenmax']) { 「長い」を返します。 } } if($thisismsetting['ifonly']==1) { if(!isset($thismsetting['tablename'])) { $channel = getchannelcache($cid); $thismsetting['tablename']=$channel['csetting']['articletable']; } if($id>0) { $pagecount = $GLOBALS['db'] -> fetchcount("SELECT id FROM ".$thismsetting['tablename']." where $mname='$value' and cid='".$cid."' and id<>'$id' limit 1;") ; }それ以外 { $pagecount = $GLOBALS['db'] -> fetchcount("SELECT id FROM ".$thismsetting['tablename']." where $mname='$value' and cid='".$cid."' limit 1;"); } if($pagecount) { 「存在する」を返します。 } } true を返します。 } function addslashes_str($val,$addslashes) { if($addslashes) { dbstr($val) を返します。 }それ以外 { $val を返します。 } } 関数ページリスト($alist,$url='',$returnarray=0) { if(!isset($alist['pagecount']) || !isset($alist['page'])) { false を返します。 } $recordcount=$alist['ページカウント']; $pagesize=$alist['ページサイズ']; $curpage=$alist['ページ']; $pages=isset($alist['showpages']) ? $alist['showpages'] :3 ; if(empty($url) && isset($alist['pageurl']) &&!empty($alist['pageurl'])) { $url=$alist['pageurl']; if(isset($alist['cid'])) { $url=str_replace('(cid)',$alist['cid'],$url); } }それ以外 { if ( URLRewrite ) { $url=$_SERVER['REQUEST_URI']; }それ以外 { $url=$_SERVER['SCRIPT_NAME'].$_SERVER['REQUEST_URI']; } } if(ストライプ($url,'page=')===false) { if(ストライプ($url,'?')===false) { $url=$url."?page=(ページ)"; }それ以外 { $url=$url."&page=(ページ)"; } } } } $url = preg_replace("/page=([0-9] )/is", "page=(page)", $url); } } if($pagesize<1) { $ページサイズ=1; } } $ページ配列=配列(); $totalpage = max(ceil($recordcount/$pagesize),1); if($curpage<0 || $curpage>$totalpage) $curpage=1; $outhtml = ""; $pageno = $curpage; if($page<0 || $page>$totalpage) $page=1; if($pageno==1) { $pagearray[]=array('url'=>str_replace('(page)','1',$url),'title'=>'<<','class'=>'無効'); }それ以外 { $pagearray[]=array('url'=>str_replace('(page)','1',$url),'title'=>'<<','class'=>' ) ; } } if($pages>$totalpage){ $ スタートページ = 1 ; $endpage=min($startpage $pages,$totalpage); }それ以外{ $startpage=max($totalpage-$pages,1); $startpage=min($startpage,$curpage); $endpage=min($startpage $pages,$totalpage); } } if($page>1){ $pagearray[]=array('url'=>str_replace('(page)',$pageno-1,$url),'title'=>'<','class'=>'') ; }それ以外{ $pagearray[]=array('url'=>str_replace('(page)',1,$url),'title'=>'<','class'=>'disabled'); } } for($i=$startpage;$i<=$endpage;$i) { if($curpage==$i){ $pagearray[]=array('url'=>str_replace('(page)',$i,$url),'title'=>$i,'class'=>'on'); }それ以外{ $pagearray[]=array('url'=>str_replace('(page)',$i,$url),'title'=>$i,'class'=>''); } } } } if($pageno<$totalpage){ $pagearray[]=array('url'=>str_replace('(page)',$pageno1,$url),'title'=>'>','class'=>''); }それ以外{ $pagearray[]=array('url'=>str_replace('(page)',$totalpage,$url),'title'=>'>','class'=>'disabled'); } } if($page==$totalpage) { $pagearray[]=array('url'=>str_replace('(page)',$totalpage,$url),'title'=>'>>','class'=>'無効' ); }それ以外 { $pagearray[]=array('url'=>str_replace('(page)',$totalpages,$url),'title'=>'>>','class'=>'') ; } } if($returnray) { $pagearray を返します。 } }それ以外 { $outhtml=''; foreach($pagesarray as $val) { if(!empty($val['class'])) { $val['class']=' class="'.$val['class'].'"'; } $outhtml.=''.$val['title'] .''; } } エコー$outhtml; } function nav($where=0) { $channelarray=array(); if(!is_array($where)) { $thiscid=$where; $where=array(); $where['cid']=$thiscid; } if(!isset($where['cid'])) { $where['cid']=0; } $cid=$where['cid']; if(!isset($where['oncid'])) { if(定義('cid')) { $where['oncid']=cid; }それ以外 { $where['oncid']=0; } //取得したすべてのid } if(!isset($where['onstyle'])) { $where['onstyle']=' class="on"'; } if(!isset($where['bro'])) {$where['bro']=1;} if(!isset($where['papa'])) {$where['papa']=1;} if($where['cid']==0) { if(!isset($where['ホームページ'])) { $where['ホームページ']['名前']='首页'; $where['homepage']['url']=gethomeurl(); $where['ホームページ']['ターゲット']=''; }それ以外 { if(is_array($where['ホームページ'])) { if(!isset($where['ホームページ']['名前'])) { $where['ホームページ']['名前']='首页'; } if(!isset($where['ホームページ']['url'])) { $where['homepage']['url']=gethomeurl(); } if(!isset($where['ホームページ']['ターゲット'])) { $where['ホームページ']['ターゲット']=''; } } } if(is_array($where['ホームページ'])) { $channelarray[]=array('cid'=>'0','fid'=>'0','name'=>$where['homepage']['name'],'url'= >$where['homepage']['url'],'target'=>$where['homepage']['target']); } } $allchannels=getchannelscache(); $チャンネル=配列(); foreach($allchannels as $val) { if($val['ifshowav']==1) { $チャンネル[]=$val; } } $カウント=0; $myfid=0; $papaid=0; foreach($channels as $channel) { if(is_numeric($cid)) { if($channel['cid']==$cid) { $myfid=$channel['fid']; if($cid>0 && $where['パパ']==1) { $channelarray['papa']=$myfid;//显示父栏目 $papaid=$myfid; } } if($channel['fid']==$cid) { $カウント=1; $channelarray[]=$channel; } }elseif(is_array($cid)) { if(in_array($channel['cid'],$cid)) { $カウント=1; $channelarray[]=$channel; } } }if($count>0 && is_numeric($cid) && $cid>0 && $where['papa']==1) { $channelarray['パパ']=$cid; } if($count==0) { $noonpapaid=$myfid; }それ以外 { $noonpapaid=false; } if(isset($channelarray['papa']) && $channelarray['papa']>0) { foreach($channels as $channel) { if($channel['cid']==$channelarray['papa']) { $channelarray['パパ']=$チャンネル; } } }それ以外 { unset($channelarray['papa']); } if(isset($where['bro']) && $where['bro']==1 && $count==0 && is_numeric($cid)) { //显示兄弟栏目 if(isset($myfid) && $myfid>0) { foreach($channels as $key=>$channel) { if($channel['fid']==$myfid) {$channelarray[]=$channel;} } }elseif(isset($myfid) && $myfid==0) { foreach($channels as $key=>$channel) { if($channel['cid']==$cid) {$channelarray[]=$channel;} } } } $onarray=配列(); if(定義('cid')) { $thiscid=cid; while(1<2) { $ifin=false; foreach($channels as $channel) { if($channel['cid']==$thiscid && $channel['cid']!=$noonpapaid) { $onarray[]=$channel['cid']; $thiscid=$channel['fid']; $ifin=true; 壊す; } } if($ifin===false || $thiscid==0) { 壊す; } } } $returnarray=array(); $returnstr=''; if(!isset($where['html'])) { $where['html']='{name}'; } if(isset($GLOBALS['nav'][$cid])) { if(is_array($GLOBALS['nav'][$cid])) { $channelarray=$GLOBALS['nav'][$cid]; }elseif(function_exists($GLOBALS['nav'][$cid])){ $channelarray=$GLOBALS['nav'][$cid]($cid); } } foreach($channelarray as $key=>$channel) { $thisstr=$where['html']; if(!isset($channel['onstyle']) || empty($channel['onstyle'])) { if(in_array($channel['cid'],$onarray)) { $channel['onstyle']=$where['onstyle']; }それ以外 { $channel['onstyle']=''; } } if(define('cid') && cid==0 && $channel['cid']==0) {//ホームページ $channel['onstyle']=$where['onstyle']; } $returnarray[]=$チャンネル; if(!isset($where['returnarray']) || $where['returnarray']==0) { $thisstr=str_replace('{url}',@$channel['url'],$thisstr); $thisstr=str_replace('{target}',@$channel['target'],$thisstr); $thisstr=str_replace('{name}',@$channel['name'],$thisstr); $thisstr=str_replace('{onstyle}',@$channel['onstyle'],$thisstr); $returnstr.=$thisstr."\r\n"; } } if(!isset($where['returnarray']) || $where['returnarray']==0) { $returnstr; を返します。 }それ以外{ $returnarray を返します。 } } function cnav($cid='',$returnarray=false,$linktag=' > ',$homepage=SystemDir) { if(空($cid)) { if(定義('cid')){ $cid=cid; }それ以外 { $cid=0; } } $channels=getchannelscache(); $ブレッドクラム=''; $breadcrumbarray=array(); while(1<2) { $thischannel=false; foreach($channels as $channel) { if($channel['cid']==$cid) { $thischannel=$channel; } } if($thischannel==false) { if($ブレッドクラム=='') { $breadcrumb='首页'; }それ以外 { $breadcrumb='首页'.$linktag.$breadcrumb; } if($returnarray) { return array_reverse($breadcrumbarray); }それ以外 { $ブレッドクラムを返します。 } }それ以外 { if($ブレッドクラム=='') { $breadcrumb=''.$thischannel['name'].''; }それ以外 { $breadcrumb=''.$thischannel['name'].''.$linktag.$breadcrumb; } $breadcrumbarray[]=$thischannel; $cid=$thischannel['fid']; } } } 関数 getallchannelscache() { if(isset($GLOBALS['allchannelscache'])) { $GLOBALS['allchannelscache']; を返します。 } $channelcachekeyname='allchannelscache'; $channelcache=cacheget($channelcachekeyname,604800,'channel'); if($channelcache) { $channels=json_decode($channelcache,1); }それ以外 { $channelslist=$GLOBALS['db']->all("SELECT cid,fid,ifshownav,cname,ckind,cvalue,newwindow,csetting FROM ".tableex('channel')." where ckind<>'4 ' コーダー順に並べる (昇順)」); if($channelslist) { $チャンネル=配列(); foreach($channelslist as $val) { unset($thischannel); $thischannel=array(); $thischannel['cid']=$val['cid']; $thischannel['fid']=$val['fid']; $thischannel['ckind']=$val['ckind']; $thischannel['ifshowav']=$val['ifshownav']; $thischannel['name']=$val['cname']; if($val['newwindow']==1) { $thischannel['target']=' target="_blank" '; }それ以外 { $thischannel['ターゲット']=''; } $thischannel['url']=getchannelurl($val); if(empty($thischannel['url'])) { $thischannel['url']='#'; $thischannel['ターゲット']=''; }$チャンネル[]=$このチャンネル; } キャッシュセット($channelcachekeyname,json_encode($channels),604800,'channel'); }それ以外 { array() を返します。 } } $GLOBALS['allchannelscache']=$チャンネル; $channels を返します。 } 関数 getchannelscache() { if(isset($GLOBALS['channelscache'])) { $GLOBALS['channelscache'] を返します。 } $channelcachekeyname='channelscache'; $channelcache=cacheget($channelcachekeyname,604800,'channel'); if($channelcache) { $channels=json_decode($channelcache,1); }それ以外 { $channelslist=$GLOBALS['db']->all("SELECT cid,fid,ifshownav,cname,ckind,cvalue,newwindow,csetting FROM ".tableex('channel')." where ckind<>'4 ' および ifshow=1 order by corder asc"); if($channelslist) { $チャンネル=配列(); foreach($channelslist as $val) { unset($thischannel); $thischannel=array(); $thischannel['cid']=$val['cid']; $thischannel['fid']=$val['fid']; $thischannel['ckind']=$val['ckind']; $thischannel['ifshowav']=$val['ifshownav']; $thischannel['name']=$val['cname']; if($val['newwindow']==1) { $thischannel['target']=' target="_blank" '; }それ以外 { $thischannel['ターゲット']=''; } $thischannel['url']=getchannelurl($val); if(empty($thischannel['url'])) { $thischannel['url']='#'; $thischannel['ターゲット']=''; } $チャンネル[]=$このチャンネル; } キャッシュセット($channelcachekeyname,json_encode($channels),604800,'channel'); }それ以外 { array() を返します。 } } $GLOBALS['channelscache']=$channels; $channels を返します。 } 関数 getchannelcache($cid) { if(isset($GLOBALS['channelcache'][$cid])) { $GLOBALS['channelcache'][$cid] を返します。 } $channelcachekeyname='channelcache_'.$cid; $channelcache=cacheget($channelcachekeyname,604800,'channel'); if($channelcache) { $channelcache=json_decode($channelcache,1); }それ以外 { if(is_numeric($cid)) { $channelcache=$GLOBALS['db']->one("SELECT * FROM ".tableex('channel')." where cid='$cid' limit 1"); }それ以外 { $channelcache=$GLOBALS['db']->one("SELECT * FROM ".tableex('channel')." where cname='$cid' limit 1"); } if($channelcache) { $channelcache['csetting']=json_decode($channelcache['csetting'],1); キャッシュセット($channelcachekeyname,json_encode($channelcache),604800,'channel'); }それ以外 { false を返します。 } } $GLOBALS['チャンネルキャッシュ'][$cid]=$チャンネルキャッシュ; $channelcache を返します。 }関数 getchannelurl($cid) { if(!is_array($cid)) { $cid=getchannelcache($cid); if(!$cid) {Return false;} $csetting=$cid['csetting']; }それ以外 { $csetting=json_decode($cid['csetting'],1); } $チャンネル=$cid; if($channel['ckind']==3 || $channel['ckind']==4 || $channel['ckind']==5) { $channel['cvalue'] を返します。 }elseif($channel['ckind']==1 || $channel['ckind']==2) { if(isset($csetting['template']) && empty($csetting['template'])) { 戻る ''; } } if(!isset($csetting['channel_url'])) {Return '';} $channelurls=explode(';',$csetting['channel_url']); $channelurl=str_replace("(cid)",$cid['cid'],$channelurls[0]); if(empty($channelurl)) { 戻る ''; } if(!isset($csetting['channel_domain']) || empty($csetting['channel_domain'])) { $csetting['channel_domain']=システムドメイン; } if(isset($csetting['channel_domain']) && $csetting['channel_domain']<>'') { $channel_domains=explode(';',$csetting['channel_domain']); $csetting['チャンネル_ドメイン']=$チャンネル_ドメイン[0]; foreach($channel_domains as $channel_domain) { if(stripos($channel_domain,'*')===false) { $csetting['チャンネル_ドメイン']=$チャンネル_ドメイン; 壊す; } } foreach($channel_domains as $channel_domain) { if(server_name()==$channel_domain) { $csetting['チャンネルドメイン']=''; 壊す; } } } if(URLRewrite) { if(empty($csetting['channel_domain'])) { $thisurl=$チャンネルurl; }それ以外 { $thisurl='//'.$csetting['channel_domain'].server_port().$channelurl; } }それ以外 { if(empty($csetting['channel_domain'])) { $thisurl=SystemDir.IndexFile.$channelurl; }それ以外 { $thisurl='//'.$csetting['channel_domain'].server_port().SystemDir.IndexFile.$channelurl; } } $thisurl を返します。 } 関数 gethomeurl() { if(isset($GLOBALS['homeurl'])) { $GLOBALS['homeurl'] を返します。 } if(!URLRewrite) { $indexfile=インデックスファイル; }それ以外 { $indexfile=''; } $domains=explode(';',SystemDomain); foreach($domains as $domain) { $domain=trim($domain); if($domain==server_name()) { $GLOBALS['homeurl']=システムディレクトリ.$インデックスファイル; $GLOBALS['homeurl'] を返します。 } } if(SystemDomain=='') {$GLOBALS['homeurl']=SystemDir.$indexfile;Return&
七字铺
七字铺

全員に返信 (2)
欧阳

ファイルはすべてメソッドであり、データベースを使用する必要があります。どう思いますか?

その場合、一度に 1 つの方法しか試せません。データベースをインポートし、挿入されたデータベースがあるかどうかを確認します。

いいねを押す+0
  • 返事 そうですね、私はまだ初心者レベルです、アドバイスありがとうございます。
    七字铺 著者 2021-03-28 14:20:30
七字铺

投稿は再編集できません。コードが長すぎるため、表示が不完全なようです。ここではネットワークディスクを使用してファイルをアップロードします。

ダウンロード: https://wwa .lanzous.com/iTtK9nbjdja パスワード: f2p0

いいねを押す+0
    最新のダウンロード
    詳細>
    ウェブエフェクト
    公式サイト
    サイト素材
    フロントエンドテンプレート
    私たちについて 免責事項 Sitemap
    PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!