Пример #1
0
 function save($data)
 {
     //如果缓存目录不存在则创建
     if (!$this->is_exist(false)) {
         file::folder($this->save_dir);
     }
     if ($this->ext == 'php') {
         $data = '<?php' . "\r\n" . 'return ' . var_export($data, true) . ';';
     }
     if ($this->ext == 'js') {
         $data = json_encode($data);
     }
     if ($this->ext == 'ini') {
         $data = fun::arr_ini($data);
     }
     if ($this->ext == 'xml') {
         $data = fun::xml($data);
     }
     if (is_array($data) && $this->ext == 'txt') {
         $data = serialize($data);
     }
     return file::save($this->file_name, $data);
 }
Пример #2
0
 static function socket($url, $data)
 {
     //解析url
     if (!is_array($url)) {
         $url = parse_url($url);
     }
     if (!isset($url["port"])) {
         $url['port'] = 80;
     }
     //打开socket
     $fp = fsockopen($url['host'], $url['port'], $error_no, $error_info, 30);
     if (!$fp) {
         return 'error:(' . $error_no . ')' . $error_info;
     }
     //组装发送数据
     if (is_array($data)) {
         $data = fun::arr_str($data);
     }
     $data = trim($data);
     //构造头部信息
     $head = 'POST ' . $url['path'] . " HTTP/1.0\r\n";
     $head .= 'Host: ' . $url['host'] . "\r\n";
     $head .= 'Referer: http://' . $url['host'] . $url['path'] . "\r\n";
     $head .= "Content-type: application/x-www-form-urlencoded\r\n";
     $head .= 'Content-Length: ' . strlen($data) . "\r\n\r\n";
     $head .= $data;
     //接收并返回结果
     $write = fputs($fp, $head);
     while (!feof($fp)) {
         $info = fgets($fp);
     }
     return json_decode($info, true);
 }
Пример #3
0
    echo "<b>您选择的模版是:&nbsp;&nbsp;</b>{$modelPathShow}<br/>";
    //打开模版文件
    $fopen = fopen($modelPath, 'rb');
    $line = "";
    //读出的一行
    ?>
		<div>
			<form id="codeForm" name="codeForm" method="post" action="preView.php" target="_preView">
			
			<input id="btnPreView" type="submit" value="预览"/>  
			
			<input id="btnCopyCode" type="button" value="复制代码"/> 
			
			<!-- begin textarea -->		
			 <textarea rows="50" cols="170" id="txtcode" name="txtcode" readonly="readonly"><?php 
    $fun = new fun();
    //创建fun对象
    $onPattern = "/\\<\\!--(\\ )*on(\\ )*--\\>/xi";
    //开始的标志
    $arrFunPattern = fun::$arrFunPattern;
    //获取所有函数的开始/结束标签
    /*****循环开始*********/
    while (!feof($fopen)) {
        //当文件没结束
        $line = fgets($fopen);
        //读取一行
        if (preg_match($onPattern, $line)) {
            $strMain = $fun->getMainStrViaONOFF($line, $fopen);
            // echo $strMain;	//die;
            $arrSPONOFF = $fun->splitMainStrToArr($strMain);
            // print_r($arrSPONOFF);	//die;
Пример #4
0
<?php

header("Content-Type: image/jpeg");
require_once '../jpgraph/jpgraph.php';
require_once '../jpgraph/jpgraph_line.php';
require_once "login.php";
require_once "config.php";
require_once "curl.php";
require_once "function.php";
if (isset($_GET["itemid"])) {
    $itemid = $_GET["itemid"];
    $key = $_GET["key"];
    $table = $_GET['table'];
    $fun = new fun();
    $result = $fun->getHistoryBySql($itemid, 100, $table);
    for ($i = 0; $i < count($result['clock']); $i++) {
        $result['clock'][$i] = date("H:i:s", $result['clock'][$i]);
    }
    showimg($result['value'], $result['clock'], $key);
} else {
    echo "<script>window.location.href='zabbix.php'</script>";
    exit;
}
function showimg($value, $clock, $key)
{
    $datay1 = $value;
    $graph = new Graph(1000, 400);
    $graph->SetScale("textlin");
    //设置图片外边距(左,右,上,下)
    $graph->img->SetMargin(100, 20, 20, 60);
    $graph->title->Set($key);
Пример #5
0
<?php

require_once "php/login.php";
require_once "php/config.php";
require_once "php/curl.php";
require_once "php/function.php";
$table = array("history", "history_log", "history_str", "history_text", "history_uint");
if (isset($_GET['hostid'])) {
    $hostid = $_GET['hostid'];
    $hostname = $_GET['hostname'];
} else {
    echo "<script>window.location.href='simplelist.php'</script>";
}
$token = login();
$fun = new fun();
$list = $fun->getItem($token, $hostid);
//return json
$list = $list->result;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>监控列表</title>
<link href="css/monitor_list.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="father">
	<div id="monitor">
   	  <div id="mon_top">
Пример #6
0
	font-size:14px;
}
</style>
</head>

<body>
	<div>
		<br /><br />
		<!-- upload excel file -->
		<div>
			<form action="code.php" method="post" id="frmUploadFile" enctype="multipart/form-data" target="_code">
			<label for="modelSelect"><b>(1)选择您要用的模版   :</b></label> 
			<select id="modelSelect" name="modelSelect">
			<?php 
//动态获取所有的模版文件
$arrModelDir = fun::getModelDirArr();
foreach ($arrModelDir as $val) {
    $val = iconv("gb2312", "UTF-8", $val);
    echo "<option id='{$val}' value='{$val}'>{$val}</option>";
}
?>
			</select>
			<br />
			<br />
				<input type="hidden" name="MAX_FILE_SIZE" value="5000000"/> 
				<label for="excelFile"><b>(2)上传您的excel文件:</b></label>
				<input id="excelFile" type="file" name="excelFile" /> <a href="./excels/model.xlsx">示例excel模版下载</a>&nbsp;&nbsp;&nbsp;&nbsp;<span><font color="red">!Hello!</font>&nbsp;新增:1.自定义轮播海报图功能(SUK-uk-AUG,SUK-uk模版可以试用)  2.添加视频链接功能(暂无模版可以试用) 请下载新excel模版来试用,谢谢大家!2015-10-08 </span><br /><br />
				<label for="sub"><b>(3)点&nbsp;击&nbsp;此&nbsp;按&nbsp;钮&nbsp;:</b></label>
				<!--<input id="sub" type="submit" name="sub" value="提交/刷新/预览" onclick="submitAct();f5()"/>--><!--为兼容IE9使用button替代input-->
				<button id="sub" name="sub" onclick="submitAct();f5()" >提交/刷新/预览</button>
				<span style="font-size:12px; color:gray">Tips:若刷新不出来,或预览不出来,可以再次点击此按钮</span>
Пример #7
0
if (isset($_GET['hostid'])) {
    $hostid = $_GET['hostid'];
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>

<body>
<?php 
//登录zabbix获取token
$token = login();
$fun = new fun();
$fun->token = $token;
//getHost返回带有name、hostid的二维数组
$host = $fun->getHost($fun->token);
$count = count($host['name']);
echo "共监控" . $count . "台主机<br />";
for ($i = 0; $i < $count; $i++) {
    echo "hostid:<a href='zabbix.php?hostid=" . $host['hostid'][$i] . "'>" . $host['hostid'][$i] . "</a> , name:" . $host['name'][$i] . "<br />";
}
//获取主机Item
//先获取itemid才可以获取指定数据的历史内容
if (isset($hostid)) {
    $result = $fun->getItem($fun->token, $hostid);
    $result = $result->result;
    echo "<br><br>";
    echo "hostid为" . $hostid . "的有效Item有以下几个:<br />";
Пример #8
0
<?php

require_once "php/login.php";
require_once "php/config.php";
require_once "php/curl.php";
require_once "php/function.php";
$fun = new fun();
$fun->token = login();
$host = $fun->getHost($fun->token);
//return Array(name[],hostid[])
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>simplelist</title>
<link href="css/simplelist.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="add">&nbsp;
<span >添加内容</span>
</div>
<div class="host_list" id="windows_host">
	<div class="host_list_title">目前监控的主机</div>
    <div class="host_list_show">
      <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" id="host_list">
      
        <tr>
        <?php 
for ($i = 0; $i < count($host['name']); $i++) {