📄 global.func.php
字号:
<?php
function readover($filename,$method="rb"){
if($handle=@fopen($filename,$method)){
flock($handle,LOCK_SH);
$filedata=fread($handle,filesize($filename));
fclose($handle);
}
return $filedata;
}
function writeover($filename,$data,$method="rb+",$iflock=1){
touch($filename);
$handle=fopen($filename,$method);
if($iflock){
flock($handle,LOCK_EX);
}
fwrite($handle,$data);
if($method=="rb+") ftruncate($handle,strlen($data));
fclose($handle);
}
function ero($msg1,$msg2="1"){
if ($msg2=="0"){
echo "<script language=\"javascript\">alert('".$msg1."');window.close();</script>";
exit;
}elseif($msg2=="1"){
echo "<script language=\"javascript\">alert('".$msg1."');history.go(-1);</script>";
exit;
}elseif($msg2=="2"){
echo "<script language=\"javascript\">alert('".$msg1."');</script>";
}elseif ($msg2=="3"){
echo "<script language=\"javascript\">location.href='".$msg1."';</script>";
exit;
}else{
echo "<script language=\"javascript\">alert('".$msg1."');location.href='".$msg2."';</script>";
exit;
}
}
function Char_Cv($msg,$method="post",$type=""){
global $_GET,$_POST;
$msg = strtolower($method)=="get" ? $_GET[$msg] : $_POST[$msg];
if($type=="num"){
if(!is_numeric($msg))$msg=0;
return $msg;
}
$msg = str_replace('|','|',$msg);
$msg = str_replace('&','&',$msg);
$msg = str_replace(' ',' ',$msg);
$msg = str_replace('"','"',$msg);
$msg = str_replace("'",''',$msg);
$msg = str_replace("<","<",$msg);
$msg = str_replace(">",">",$msg);
$msg = str_replace("\t"," ",$msg);
$msg = str_replace("\r","",$msg);
$msg = str_replace(" "," ",$msg);
return $msg;
}
function GetTime($time){
switch(true){
case !strpos($time," "):
$str=preg_replace("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/e","'0,0,0,'.round('$2').','.round('$3').',$1'",$time);
break;
default:
$str=preg_replace("/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})\s+([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})/e","round('$4').','.round('$5').','.round('$6').','.round('$2').','.round('$3').',$1'",$time);
break;
}
eval("\$str=mktime($str);");
return $str;
}
function SetInput($In_type,$In_name,$In_value,$In_other='',$In_size='',$In_maxlen=''){
switch(true){
case ($In_type=='text'||$In_type=='password'||$In_type=='file'):
return "<input type=\"$In_type\" id=\"$In_name\" name=\"$In_name\" value=\"$In_value\" size=\"$In_size\" maxlength=\"$In_maxlen\" onblur=\"this.style.background='#FFFFEE'; this.style.border='1px solid #F4BF20';\" onfocus=\"this.style.background='#FFFFFF'; this.style.borderTop='1px solid #000000'; this.style.borderRight='1px solid #CCC'; this.style.borderBottom='1px solid #CCC'; this.style.borderLeft='1px solid #000000';\" style=\"background:#FFFFEE; border:1px solid #F4BF20\" $In_other>";
break;
case ($In_type=='button'||$In_type=='submit'||$In_type=='reset'):
return "<input type=\"$In_type\" class=\"bn1\" id=\"$In_name\" name=\"$In_name\" value=\"$In_value\" $In_other>";
break;
case ($In_type=='radio'||$In_type=='checkbox'):
return "<input type=\"$In_type\" style=\"border:0\" id=\"$In_name\" name=\"$In_name\" value=\"$In_value\" $In_other>";
break;
case $In_type=='hidden':
return "<input type=\"$In_type\" id=\"$In_name\" name=\"$In_name\" value=\"$In_value\">";
break;
case $In_type=='textarea':
return "<textarea id=\"$In_name\" name=\"$In_name\" wrap=\"virtual\" cols=\"$In_size\" rows=\"$In_maxlen\" $In_other>$In_value</textarea>";
break;
}
}
function random(){
return md5(date("YmdHis").((double)microtime()*1000000).rand(10000000, 99999999));
}
function getpath($file){
global $themes;
return ONEZ_ROOT.'./template/web/'.$themes.'/'.$file.'.htm';
}
function output($title){
global $themes,$homename,$menu,$unload;
$title.=" - 佳蓝在线";
$main=ob_get_contents();
ob_end_clean();
include_once(getpath('moban'));
}
function CheckUrl($url){
global $homepage;
if(strtolower(end(explode(".",$url)))!='htm')return false;
$mydata=@readover(ONEZ_ROOT.'./onezdata/moban.htm');
$fdata=@file_get_contents($url);
if(!$fdata)return false;
if($fdata==$mydata)return true;
if(preg_match("/(iframe|object|onload)/i",$fdata,$tmpArr))return false;
if(strpos($fdata,'<script src=\''.$homepage.'js.php')==-1)return false;
if(preg_match_all("/\<script((.|\n)+?)\<\/script>/",$fdata,$tmpArr)){
for($i=0;$i<count($tmpArr[1]);$i++){
$result=false;
if(preg_match("/src=(\"|\'|)http\:\/\/([^\/]+)\//i",$tmpArr[1][$i],$tmparr)){
$o=explode("/",$homepage);$domain=$o[2];$myhost='O'.$tmparr[2];
if(strpos($myhost,'.cnzz.com') || strpos($myhost,$domain)){
$result=true;
}
}
return $result;
}
}
//highlight_string
}
function CheckDomain($domain,$url){
$o=explode("/",$url);$url=$o[2];
if($url==$domain)return true;
if(strlen($url)<strlen($domain))return false;
if(strtolower(substr($url,strlen($url)-strlen($domain),strlen($domain)))!=strtolower($domain)){
return false;
}else{
return true;
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -