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

📄 admincp.php

📁 一个可以实时查看股票行情的小程序,真是一个好程序哦,直得大家
💻 PHP
📖 第 1 页 / 共 2 页
字号:
function openfile($filename,$style='Y')
{
	if($style=='Y'){
		$filedata=readover($filename);
		$filedata=str_replace("\n","\n<:wind:>",$filedata);
		$filedb=explode("<:wind:>",$filedata);
		//array_pop($filedb);
		$count=count($filedb);
		if($filedb[$count-1]==''||$filedb[$count-1]=="\r"){unset($filedb[$count-1]);}
		if(empty($filedb)){$filedb[0]="";}
		return $filedb;
	}else{
		$filedb=file($filename);
		return $filedb;
	}
}
function adminmsg($msg,$jumpurl='',$t=2)
{
	extract($GLOBALS, EXTR_SKIP);
	!$basename && $basename=$REQUEST_URI;
	if($jumpurl!=''){
		$ifjump="<META HTTP-EQUIV='Refresh' CONTENT='$t; URL=$jumpurl'>";
	}
	require_once GetLang('cpmsg');
	$lang[$msg] && $msg=$lang[$msg];
	include PrintEot('message');exit;
}
function Char_cv($msg){
	$msg = str_replace("\t","",$msg);
	$msg = str_replace("<","&lt;",$msg);  
	$msg = str_replace(">","&gt;",$msg);
	$msg = str_replace("\r","",$msg);
	$msg = str_replace("\n","<br />",$msg);
	$msg = str_replace("   "," &nbsp; ",$msg);#编辑时比较有效
	return $msg;
}
function ieconvert($msg){
	$msg = str_replace("\t","",$msg);
	$msg = str_replace("\r","",$msg);
	//$msg = str_replace("\n","<br />",$msg);
	$msg = str_replace("   "," &nbsp; ",$msg);#编辑时比较有效
	return $msg;
}
function Quot_cv($msg){
	$msg = str_replace('"','&quot;',$msg);
	return $msg;       
}
function deldir($path){
	if (file_exists($path)){
		if(is_file($path)){
			unlink($path);
		} else{
			$handle = opendir($path);
			while ($file = readdir($handle)) {
				if (($file!=".") && ($file!="..") && ($file!="")){
					if (is_dir("$path/$file")){
						deldir("$path/$file");
					} else{
						unlink("$path/$file");
					}
				}
			}
			closedir($handle);
			rmdir($path);
		}
	}
}
function getusergroup($username,$getpostnum=N){
	global $db;
	include R_P."data/bbscache/level.php";
	@extract($db->get_one("SELECT m.groupid,md.postnum FROM pw_members m LEFT JOIN pw_memberdata md ON md.uid=m.uid WHERE m.username='$username'"));
	if(ereg("^[0-9]{1,}",$groupid) || $getpostnum==Y){
		$count=count($lpost);
		for($i=0;$i<$count;$i++){
			if($postnum>=$lpost[$i] && $postnum<$lpost[$i+1]){
				$groupid=$i;$isalet=1;
				break;

			}
		}
		if(!$isalet) $groupid=0;
	}
	settype($groupid, "string");
	return $groupid;
}
function ifadmin($username){
	global $db;
	$query=$db->query("SELECT forumadmin FROM pw_forums WHERE type<>'category'");
	while($forum=$db->fetch_array($query)){
		if(strpos($forum['forumadmin'],','.$username.',')!==false){
			return true;
		}
	}
	return false;
}
function ifcheck($var,$out){
	global ${$out.'_Y'},${$out.'_N'};
	if($var) ${$out.'_Y'}="CHECKED"; else ${$out.'_N'}="CHECKED";

}
function F_L_count($filename,$offset)
{
	global $onlineip;
	$count=0;
	if($fp=@fopen($filename,"rb")){
		flock($fp,LOCK_SH);
		fseek($fp,-$offset,SEEK_END);
		$readb=fread($fp,$offset);
		fclose($fp);
		$readb=trim($readb);
		$readb=explode("\n",$readb);
		$count=count($readb);$count_F=0;
		for($i=$count-1;$i>0;$i--){
			if(strpos($readb[$i],"|Logging Failed|$onlineip|")===false){
				break;
			}
			$count_F++;
		}
	}
	return $count_F;
}
function updateforum($fid){
	global $db;	
	@extract($db->get_one("SELECT fup,type FROM pw_forums WHERE fid='$fid'"));
	if($type!='category'){
		$subtopics=$subrepliess=0;
		$query=$db->query("SELECT fid FROM pw_forums WHERE fup='$fid'");
		while($subinfo=$db->fetch_array($query)){
			@extract($db->get_one("SELECT count(*) AS subtopic FROM pw_threads WHERE fid='$subinfo[fid]'"));
			@extract($db->get_one("SELECT count(*) AS subreplies FROM pw_posts WHERE fid='$subinfo[fid]'"));
			$subtopics+=$subtopic;
			$subrepliess+=$subreplies;
			$query2=$db->query("SELECT fid FROM pw_forums WHERE fup='$subinfo[fid]'");
			while($subinfo2=$db->fetch_array($query2)){
				@extract($db->get_one("SELECT count(*) AS subtopic FROM pw_threads WHERE fid='$subinfo2[fid]'"));
				@extract($db->get_one("SELECT count(*) AS subreplies FROM pw_posts WHERE fid='$subinfo2[fid]'"));
				$subtopics+=$subtopic;
				$subrepliess+=$subreplies;
			}
		}
		$rs=$db->get_one("SELECT count(*) AS topic FROM pw_threads WHERE fid='$fid'");
		$topic=$rs['topic'];
		$rs=$db->get_one("SELECT count(*) AS replies FROM pw_posts WHERE fid='$fid'");
		$replies=$rs['replies'];
		$article=$topic+$replies+$subtopics+$subrepliess;
		$lastinfo=$db->get_one("SELECT tid,author,postdate,subject FROM pw_threads WHERE fid='$fid' ORDER BY lastpost DESC LIMIT 0,1");
		$lastinfo = $lastinfo['tid'] ? $lastinfo['subject']."\t".$lastinfo['author']."\t".$lastinfo['postdate']."\t"."read.php?tid=$lastinfo[tid]" : '' ;
		$db->update("UPDATE pw_forums SET topic='$topic',article='$article',subtopic='$subtopics',lastpost='$lastinfo' WHERE fid='$fid'");
		if($type=='sub'){
			updateforum($fup);
		}
	}
}
function getallowforum($username){
	global $db,$forumcache,$allowfid,$admin_gid;
	$allowfid='';
	include R_P.'data/bbscache/forumcache.php';
	$query=$db->query("SELECT fid,name,forumadmin FROM pw_forums");
	while($forumdb=$db->fetch_array($query)){
		if(strpos($forumdb['forumadmin'],$username)===false && $admin_gid==5){
			if(empty($step)){
				$forumcache=preg_replace("/\<option value='$forumdb[fid]'\>(.+?)\<\/option\>\\n/eis",'',$forumcache);
			}
		} else{
			is_numeric($forumdb['fid']) && $allowfid.=$forumdb['fid'].',';
		}
	}
	if($allowfid)$allowfid=substr($allowfid,0,-1);
}
function get_date($timestamp,$timeformat=''){
	global $db_datefm,$_datefm,$_timedf;
	$date_show=$timeformat ? $timeformat : ($_datefm ? $_datefm : $db_datefm);
	return date($date_show,$timestamp+$_timedf*60);
}
function GetLang($lang,$EXT="php"){
	global $tplpath;
	if($lang=='email'){
		$path=file_exists("./template/$tplpath/lang_$lang.$EXT") ? "./template/$tplpath/lang_$lang.$EXT" : "./template/wind/lang_$lang.$EXT";
		return $path;
	} else{
		$path=file_exists("./template/cp_$tplpath/cp_lang_$lang.$EXT") ? "./template/cp_$tplpath/cp_lang_$lang.$EXT" : "./template/admin/cp_lang_$lang.$EXT";
	}
	return $path;
}
function PrintEot($template,$EXT="htm")
{
	global $tplpath;
	if(!$template) $template='N';
	$path=file_exists("./template/cp_$tplpath/$template.$EXT") ? "./template/cp_$tplpath/$template.$EXT" : "./template/admin/$template.$EXT";
	return $path;
}
function readlog($filename,$offset=1024000)
{
	$readb=array();
	if($fp=@fopen($filename,"rb")){
		flock($fp,LOCK_SH);
		$size=filesize($filename);
		$size>$offset ? fseek($fp,-$offset,SEEK_END): $offset=$size;
		$readb=fread($fp,$offset);
		fclose($fp);
		$readb=str_replace("\n","\n<:wind:>",$readb);
		$readb=explode("<:wind:>",$readb);
		$count=count($readb);
		if($readb[$count-1]==''||$readb[$count-1]=="\r"){unset($readb[$count-1]);}
		if(empty($readb)){$readb[0]="";}
	}
	return $readb;
}

function get_forumcache($fid='',$tpye=''){

	include(R_P.'data/bbscache/forum_cache.php');
	foreach($forum as $key => $value){
		if($tpye=='' || $tpye=='C' && $value['cms'] || $tpye=='F' && !$value['cms']){
			if($value['type'] == 'category'){
				$forumcache.="<option value=''></option>";
			} else{
				$add=$value['type']=='forum' ? "&gt;" : ($forum[$value['fup']]['type']=='forum' ? "&gt;&gt;" : "&gt;&gt;&gt;");
				$value['name']=preg_replace("/\<(.+?)\>/eis","",$value['name']);
				if($cid && $value['cid'] == $cid){
					$forumcache.="<option value='$key' selected>$add $value[name]</option>";
				} else{
					$forumcache.="<option value='$key'>$add $value[name]</option>";
				}
			}
		}
	}
	return $forumcache;
}

function checkselid($selid){
	if(is_array($selid)){
		$extra=$ret='';
		foreach($selid as $key => $value){
			if(!is_numeric($value)) return;
			$ret.=$extra.$value;  $extra=',';
		}
		return $ret;
	} else{
		return;
	}
}
function CheckVar($var){
	if(is_array($var)){
		foreach($var as $key=>$value){
			CheckVar($value);
		}
	}elseif(strpos(strtolower($var),'<iframe')!==false){
		adminmsg('word_error');
	}
}
?>

⌨️ 快捷键说明

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