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

📄 common_functions.php

📁 这是一个可以显示localhost 的系统信息的php 生成网页
💻 PHP
📖 第 1 页 / 共 2 页
字号:
// it returns a formated number string, with unit identifier.function format_bytesize ($intKbytes, $intDecplaces = 2) {	global $text;	$strSpacer = '&nbsp;';		if( $intKbytes > 1048576 ) {		$strResult = sprintf( '%.' . $intDecplaces . 'f', $intKbytes / 1048576 );		$strResult .= $strSpacer . $text['gb'];	} elseif( $intKbytes > 1024 ) {		$strResult = sprintf( '%.' . $intDecplaces . 'f', $intKbytes / 1024);		$strResult .= $strSpacer . $text['mb'];	} else {		$strResult = sprintf( '%.' . $intDecplaces . 'f', $intKbytes );		$strResult .= $strSpacer . $text['kb'];	}		return $strResult;}function format_speed( $intHz ) {	$strResult = "";		if( $intHz < 1000 ) {		$strResult = $intHz . " Mhz";	} else {		$strResult = round( $intHz / 1000, 2 ) . " GHz";	}		return $strResult;}function get_gif_image_height( $image ) { 	// gives the height of the given GIF image, by reading it's LSD (Logical Screen Discriptor)	// by Edwin Meester aka MillenniumV3	// Header:	//3bytes		Discription	// 3bytes		Version	// LSD:	//2bytes		Logical Screen Width	// 2bytes		Logical Screen Height	// 1bit		Global Color Table Flag	// 3bits		Color Resolution	// 1bit		Sort Flag	// 3bits		Size of Global Color Table	// 1byte		Background Color Index	// 1byte		Pixel Aspect Ratio	// Open Image	$fp = fopen( $image, 'rb' ); 	// read Header + LSD	$strHeaderandlsd = fread( $fp, 13 );	fclose( $fp ); 	// calc Height from Logical Screen Height bytes	$intResult = ord( $strHeaderandlsd{8} ) + ord( $strHeaderandlsd{9} ) * 255;		return $intResult;} // Check if a string exist in the global $hide_mounts.// Return true if this is the case.function hide_mount( $strMount ) {	global $hide_mounts;		if( isset( $hide_mounts ) && is_array( $hide_mounts ) && in_array( $strMount, $hide_mounts ) ) {		return true;	} else {		return false;	}}// Check if a string exist in the global $hide_fstypes.// Return true if this is the case.function hide_fstype( $strFSType ) {	global $hide_fstypes;		if( isset( $hide_fstypes ) && is_array( $hide_fstypes ) && in_array( $strFSType, $hide_fstypes ) ) {		return true;	} else {		return false;	}}function uptime( $intTimestamp ) {	global $text;	$strUptime = '';    	$intMin = $intTimestamp / 60;	$intHours = $intMin / 60;	$intDays = floor( $intHours / 24 );	$intHours = floor( $intHours - ( $intDays * 24 ) );	$intMin = floor( $intMin - ( $intDays * 60 * 24 ) - ( $intHours * 60 ) );		if( $intDays != 0 ) {		$strUptime .= $intDays. "&nbsp;" . $text['days'] . "&nbsp;";	}	if( $intHours != 0 ) {		$strUptime .= $intHours . "&nbsp;" . $text['hours'] . "&nbsp;";	}	$strUptime .= $intMin . "&nbsp;" . $text['minutes'];		return $strUptime;}//Replace some chars which are not valid in xml with iso-8859-1 encodingfunction replace_specialchars( &$strXml ) {	$arrSearch = array( chr(174), chr(169), chr(228), chr(246), chr(252), chr(214), chr(220), chr(196) );	$arrReplace = array( "(R)", "(C)", "ae", "oe", "ue", "Oe", "Ue", "Ae" );	$strXml = str_replace( $arrSearch, $arrReplace, $strXml );}// find duplicate entrys and count them, show this value befor the duplicated namefunction finddups( $arrInput ) {	$arrResult = array();		if( is_array( $arrInput ) ) {		$arrBuffer = array_count_values( $arrInput );		foreach( $arrBuffer as $strKey => $intValue) {			if( $intValue > 1 ) {				$arrResult[] = "(" . $intValue . "x) " . $strKey;			} else {				$arrResult[] = $strKey;			}		}	}		return $arrResult;}function rfts( $strFileName, $intLines = 0, $intBytes = 4096, $booErrorRep = true ) {	global $error;	$strFile = "";	$intCurLine = 1;  	if( file_exists( $strFileName ) ) {		if( $fd = fopen( $strFileName, 'r' ) ) {			while( !feof( $fd ) ) {				$strFile .= fgets( $fd, $intBytes );				if( $intLines <= $intCurLine && $intLines != 0 ) {					break;				} else {					$intCurLine++;				}			}			fclose( $fd );		} else {			if( $booErrorRep ) {				$error->addError( 'fopen(' . $strFileName . ')', 'file can not read by phpsysinfo', __LINE__, __FILE__ );			}			return "ERROR";		}	} else {		if( $booErrorRep ) {			$error->addError( 'file_exists(' . $strFileName . ')', 'the file does not exist on your machine', __LINE__, __FILE__ );		}		return "ERROR";	}		return $strFile;}function gdc( $strPath, $booErrorRep = true ) {	global $error;	$arrDirectoryContent = array();		if( is_dir( $strPath ) ) {		if( $handle = opendir( $strPath ) ) {			while( ( $strFile = readdir( $handle ) ) !== false ) {				if( $strFile != "." && $strFile != ".." && $strFile != "CVS" ) {					$arrDirectoryContent[] = $strFile;				}			}			closedir( $handle );		} else {			if( $booErrorRep ) {				$error->addError( 'opendir(' . $strPath . ')', 'directory can not be read by phpsysinfo', __LINE__, __FILE__ );			}		}	} else {		if( $booErrorRep ) {			$error->addError( 'is_dir(' . $strPath . ')', 'directory does not exist on your machine', __LINE__, __FILE__ );		}	}		return $arrDirectoryContent;}function temperature( $floatTempC ) {    global $temperatureformat, $text, $error;    $strResult = "&nbsp;";        switch( strtoupper( $temperatureformat ) ) {	case "F":	    $floatFahrenheit = $floatTempC * 1.8 + 32;	    $strResult .= round( $floatFahrenheit ) . $text['degreeF'];	    break;	case "C":	    $strResult .= round( $floatTempC ) . $text['degreeC'];	    break;	case "F-C":	    $floatFahrenheit = $floatTempC * 1.8 + 32;	    $strResult .= round( $floatFahrenheit ) . $text['degreeF'];	    $strResult .= "&nbsp;(";	    $strResult .= round( $floatTempC ) . $text['degreeC'];	    $strResult .= ")";	    break;	case "C-F":	    $floatFahrenheit = $floatTempC * 1.8 + 32;	    $strResult .= round( $floatTempC ) . $text['degreeC'];	    $strResult .= "&nbsp;(";	    $strResult .= round( $floatFahrenheit ) . $text['degreeF'];	    $strResult .= ")";	    break;	default:	    $error->addError( 'temperature(' . $floatTempC . ')', 'wrong or unspecified temperature format', __LINE__, __FILE__ );	    break;    }	    return $strResult;}?>

⌨️ 快捷键说明

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