/** * 服务器信息 */ public function systemInfo() { $sysinfo = \Admin\Plugin\SysinfoPlugin::getinfo(); $os = explode(' ', php_uname()); //网络使用状况 $net_state = null; if ($sysinfo['sysReShow'] == 'show' && false !== ($strs = @file("/proc/net/dev"))) { for ($i = 2; $i < count($strs); $i++) { preg_match_all("/([^\\s]+):[\\s]{0,}(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)/", $strs[$i], $info); $net_state .= "{$info[1][0]} : 已接收 : <font color=\"#CC0000\"><span id=\"NetInput{$i}\">" . $sysinfo['NetInput' . $i] . "</span></font> GB 已发送 : <font color=\"#CC0000\"><span id=\"NetOut{$i}\">" . $sysinfo['NetOut' . $i] . "</span></font> GB <br />"; } } $this->assign('sysinfo', $sysinfo); $this->assign('os', $os); $this->assign('net_state', $net_state); $this->display("systeminfo"); }
/** * 后台欢迎页 */ public function public_main() { $admin_db = D('Admin'); $userid = session('userid'); $userInfo = $admin_db->getUserInfo($userid); //获取用户基本信息 $sysinfo = \Admin\Plugin\SysinfoPlugin::getinfo(); $os = explode(' ', php_uname()); //网络使用状况 $net_state = null; if ($sysinfo['sysReShow'] == 'show' && false !== ($strs = @file("/proc/net/dev"))) { for ($i = 2; $i < count($strs); $i++) { preg_match_all("/([^\\s]+):[\\s]{0,}(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)/", $strs[$i], $info); $net_state .= "{$info[1][0]} : 已接收 : <font color=\"#CC0000\"><span id=\"NetInput{$i}\">" . $sysinfo['NetInput' . $i] . "</span></font> GB 已发送 : <font color=\"#CC0000\"><span id=\"NetOut{$i}\">" . $sysinfo['NetOut' . $i] . "</span></font> GB <br />"; } } $changFile = SITE_DIR . DS . 'change.log'; $changeList = array(); if (file_exists($changFile)) { $changeList = file($changFile); } $this->assign('changeList', $changeList); $this->assign('userInfo', $userInfo); $this->assign('sysinfo', $sysinfo); $this->assign('os', $os); $this->assign('net_state', $net_state); $this->display('main'); }