/** * Increment or Decrement the value of an item in the cache. * * @param string $key * @param mixed $value * @param string $direction * @return integer */ private function incrementOrDecrement($key, $value, $direction = '+') { $target = $this->kvdb->get($this->prefix . $key); $direction == '-' ? $target -= $value : ($target += $value); $this->kvdb->set($this->prefix . $key, $target); return $target; }
function parse_img_urls($html) { $return_urls = array(); $re_patten = "<(?:content|src)=\"((?:https?://\\d+\\.media\\.tumblr\\.com)/(?:(\\w+)/)?(?:tumblr_\\w+_(1280|540|500|400|250)\\.(?:png|jpg|gif)))\">i"; if (preg_match_all($re_patten, $html, $matches)) { list(, $urls, $hashes, $sizes) = $matches; //find for the largest img $temp_container = array(); for ($i = 0, $length = sizeof($urls); $i < $length; $i++) { $url = $urls[$i]; $hash = $hashes[$i]; $size = $sizes[$i]; if (empty($temp_container[$hash]) || $temp_container[$hash]['size'] < $size) { $temp_container[$hash] = array('url' => $url, 'size' => $size); } } $kvdb = new SaeKV(); $kvdb->init(); foreach ($temp_container as $hash => $item) { $filename = basename($item['url']); $local_file = 'none'; if ($img_info = $kvdb->get($filename)) { if (in_array($img_info['remark'], array('unwanted', 'inaccessible'))) { continue; } $item['size'] <= $img_info['size'] && ($local_file = $filename); } $hash_size_mark = "{$hash}#{$item['size']}#{$local_file}"; $return_urls[$hash_size_mark] = $item['url']; } } return $return_urls; }
function kget($key) { if (has_saekv()) { $kv = new SaeKV(); $kv->init(); return $kv->get($key); } else { $keyfile = AROOT . '__lr3_kv' . DS . 'kv-' . md5($key); return @unserialize(@file_get_contents($keyfile)); } }
public function TbSign($cookieid, $tiebaname, $fid, $urlname, $signlistid) { $kv = new \SaeKV(); $kv->init(); $cookies = $kv->get('Cookie' . $cookieid); echo $cookies; // 记录数据 if ($va = sign($cookies, $tiebaname, $fid, urlencode($tiebaname))) { echo $va; $data = array('id' => $signlistid, 'issign' => 1); M('SignList')->save($data); } }
<? $kv = new SaeKV(); $ekv = new SaeKV(); $kv->init(); $ekv->init(); $d=date('Y-m-d H:i:s'); $mail = new SaeMail(); $smtp_user='******'; $smtp_pass='******'; $ret = $kv->pkrget('web_', 3); foreach($ret as $arr => $url){ $url='http://'.$url; $tags = @get_meta_tags( $url ); if($tags['saecheckweb'] == 'www.lijingquan.net'){ $ret=$ekv->get('fail_'.$url); if ($ret == '1'){ echo $ret; }else{ $mto=$kv->get('mail_'.$url); $mail->quickSend($mto,'网站恢复正常!','你的网站'.$url.'已经进入正常状态,并处于监控模式!更多功能,正在开发!欢迎访问我的博客:www.lijingquan.net',$smtp_user,$smtp_pass); $mail->clean(); $ekv->set('fail_'.$url, '1'); } }else{ $ret=$ekv->get('fail_'.$url); if ($ret == '0'){ echo $ret; }else{ $mto=$kv->get('mail_'.$url); $mail->quickSend($mto,'网站发现异常!','你的网站'.$url.'已经进入正常状态,并处于监控模式!更多功能,正在开发!欢迎访问我的博客:www.lijingquan.net',$smtp_user,$smtp_pass); $mail->clean();
To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates and open the template in the editor. --> <html> <head> <title>设置</title> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css"> </head> <body> <?php $kv = new SaeKV(); $ret = $kv->init(); $increaseRate = $kv->get('increaseRate'); if ($increaseRate === FALSE) { $increaseRate = 0.0; } $salesTarget = $kv->get('salesTarget'); if ($salesTarget === FALSE) { $salesTarget = 0.0; } $manTarget = $kv->get('manTarget'); if ($manTarget === FALSE) { $manTarget = 0.0; } $cosmeticsTarget = $kv->get('cosmeticsTarget'); if ($cosmeticsTarget === FALSE) { $cosmeticsTarget = 0.0; }
<?php $kv = new SaeKV(); // 初始化SaeKV对象 $ret = $kv->init(); $ret = $kv->get('THINKCMF_DYNAMIC_CONFIG'); $runtime_config = $ret ? unserialize($ret) : array(); $_msaestorage = new SaeStorage(); $sae = array('DB_TYPE' => 'mysql', 'DB_DEPLOY_TYPE' => 1, 'DB_RW_SEPARATE' => true, 'DB_HOST' => SAE_MYSQL_HOST_M, 'DB_NAME' => SAE_MYSQL_DB, 'DB_USER' => SAE_MYSQL_USER, 'DB_PWD' => SAE_MYSQL_PASS, 'DB_PORT' => SAE_MYSQL_PORT, 'DB_PREFIX' => 'sp_', "COOKIE_PREFIX" => 'U49dZ1_', 'FILE_UPLOAD_TYPE' => 'Sae', 'TMPL_PARSE_STRING' => array('__UPLOAD__' => $_msaestorage->getUrl('data', 'upload') . "/")); //print_r($runtime_config); die; return array_merge($sae, $runtime_config);
if ($official && $official % 10 == 0) { $oflen = strlen($official); for ($i = 0; $i < $oflen; $i += 10) { $addrport = substr($official, $i, 6); if ($val === $addrport) { die('0'); } } } //读取数据 $kv = new SaeKV(); if (!$kv->init()) { die('3'); } for ($i = 0; $i < 5; $i++) { $file = $kv->get('servers'); if ($file !== false) { break; } } if ($file !== false && strlen($file) % 10 == 0) { for ($i = 0; $i < strlen($file); $i += 10) { if (substr($file, $i, 6) === $val) { $needtest = false; break; } } } //检查外部端口是否开放 if (array_key_exists('r', $_GET)) { if ($_GET['r'] == '1') {
public function kv() { $k = new SaeKV(); $k->init(); $k->set('a', 'aaa'); //建立一条字符串数据 $ret = $k->get('a'); //获得a的值 dump($ret); $k->set('b', array('a', 'b', 'c')); //可存储数组或对象 $ret = $k->get("b"); //获得b的值 dump($ret); $k->delete("a"); //删除a }
<?php define("SUMMETA", "<!--this is the first view page created at " . date("Y-m-d H:i:s") . " by summer -->"); $kv = new SaeKV(); $kv->init(); $sitemap = $kv->get($_SERVER['SCRIPT_URI']); if ($sitemap) { header('Content-type:text/html; charset=utf-8'); echo $sitemap; } else { echo fetchUrl($_SERVER['SCRIPT_URI']) . SUMMETA; } function fetchUrl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_AUTOREFERER, 0); curl_setopt($ch, CURLOPT_REFERER, 'static'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ret = curl_exec($ch); curl_close($ch); if ($ret) { return $ret; } else { return false; } }
public function lp3() { // 首先获取所有表 if ($tables = get_table_list(db())) { $data['tables'] = $tables; } $data['actions'] = $actions = array('list', 'insert', 'remove', 'update'); $kv = new SaeKV(); $kv->init(); foreach ($tables as $table) { foreach ($actions as $action) { $data['in_code'][$table][$action] = $kv->get('iosetting_input_' . $table . '_' . $action); $data['out_code'][$table][$action] = $kv->get('iosetting_output_' . $table . '_' . $action); $data['ainfo'][$table][$action] = unserialize($kv->get('msetting_' . $table . '_' . $action)); $data['in_code'][$table][$action] = $kv->get('iosetting_input_' . $table . '_' . $action); $data['out_code'][$table][$action] = $kv->get('iosetting_output_' . $table . '_' . $action); $fields = get_fields($table); foreach ($fields as $field) { $finfo = unserialize($kv->get('msetting_' . $table . '_' . $action . '_' . $field)); if ($finfo['required'] == 1) { $data['requires'][$table][$action][] = $field; } if ($finfo['input'] == 1) { $data['inputs'][$table][$action][] = $field; } if ($finfo['output'] == 1) { $data['outputs'][$table][$action][] = $field; } if ($finfo['like'] == 1) { $data['likes'][$table][$action][] = $field; } if ($finfo['equal'] == 1) { $data['equals'][$table][$action][] = $field; } } } // 取得自定义接口 $data['my_actions'] = get_data("SELECT * FROM `__meta_code` WHERE `table` = '" . s($table) . "' ORDER BY `id` DESC"); } ob_start(); @extract($data); require AROOT . 'meta/api.sample.php'; $code = ob_get_contents(); ob_end_clean(); $code = "<?php \r\n" . $code . '?>'; include AROOT . 'function/phpbeautifier/PhpBeautifier.inc'; $beautify = new PhpBeautifier(); $beautify->tokenSpace = true; //put space between tokens $beautify->blockLine = true; //put empty lines between blocks of code (if, while etc) $beautify->optimize = false; //optimize strings (for now), if a double quoted string does not contain variables of special carachters transform it to a single quoted string to save parsing time if (v('read') == 1) { highlight_string($beautify->process($code)); } else { echo $beautify->process($code); } //echo $code; /* $smarty->assign( 'data' , $data ); echo $smarty->fetch( AROOT . 'meta/api.sample.php' ); */ //echo 'lp3'; }
public function fields_settings() { $settings = array(); $settings[] = array('text' => '入', 'value' => 'input', 'desp' => '作为输入参数'); $settings[] = array('text' => '返', 'value' => 'output', 'desp' => '作为返回值'); $settings[] = array('text' => '必', 'value' => 'required', 'desp' => '必填参数'); $settings[] = array('text' => '%', 'value' => 'like', 'desp' => 'Like匹配'); $settings[] = array('text' => '=', 'value' => 'equal', 'desp' => '相等匹配'); $data['settings'] = $settings; $data['table'] = z(t(v('table'))); $data['field'] = z(t(v('field'))); $data['action'] = z(t(v('action'))); $data['tdid'] = intval(v('tdid')); $data['title'] = '字段属性设置'; $kv = new SaeKV(); $kv->init(); $data['finfo'] = unserialize($kv->get('msetting_' . $data['table'] . '_' . $data['action'] . '_' . $data['field'])); return render($data, 'ajax'); }
<?php $kv = new SaeKV(); // 初始化SaeKV对象 $ret = $kv->init(); $ret = $kv->get('XIAOCAOCMS_DYNAMIC_CONFIG'); $runtime_config = $ret ? unserialize($ret) : array(); $sae = array('DB_TYPE' => 'mysql', 'DB_DEPLOY_TYPE' => 1, 'DB_RW_SEPARATE' => true, 'DB_HOST' => SAE_MYSQL_HOST_M, 'DB_NAME' => SAE_MYSQL_DB, 'DB_USER' => SAE_MYSQL_USER, 'DB_PWD' => SAE_MYSQL_PASS, 'DB_PORT' => SAE_MYSQL_PORT, 'DB_PREFIX' => 'sp_', "COOKIE_PREFIX" => 'U49dZ1_', 'TMPL_PARSE_STRING' => array('__UPLOAD__' => file_domain('data') . '/upload/')); //print_r($runtime_config); die; return array_merge($sae, $runtime_config);
<?php define("SUMMETA", "<!--this is the first view page created at " . date("Y-m-d H:i:s") . " by summer -->"); $kv = new SaeKV(); $kv->init(); if ($_GET['s']) { $url = $_SERVER['SCRIPT_URI'] . '?s=' . $_GET['s']; echo fetchUrl($url); exit; } $sitemap = $kv->get($_SERVER['SCRIPT_URI'] . 'index.html'); if ($sitemap) { header('Content-type:text/html; charset=utf-8'); echo $sitemap; } else { echo fetchUrl($_SERVER['SCRIPT_URI']) . SUMMETA; } function fetchUrl($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_AUTOREFERER, 0); curl_setopt($ch, CURLOPT_REFERER, 'staticindex'); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $ret = curl_exec($ch); curl_close($ch); if ($ret) { return $ret; } else { return false; }
public function index() { //print_r( $_REQUEST ); $table = z(t(v('_table'))); $action = z(t(v('_interface'))); if (strlen($table) < 1 || strlen($action) < 1) { return $this->send_error(LR_API_ARGS_ERROR, 'BAD ARGS'); } // user define code if ($my_code = get_var("SELECT `code` FROM `__meta_code` WHERE `table` = '" . s($table) . "' AND `action` = '" . s($action) . "' LIMIT 1")) { return eval($my_code); exit; } // check table $tables = get_table_list(db()); if (!in_array($table, $tables)) { return $this->send_error(LR_API_ARGS_ERROR, 'TABLE NOT EXISTS'); } if ($table == c('token_table_name') && $action == 'get_token') { return $this->get_token(); } $fields = get_fields($table); $kv = new SaeKV(); $kv->init(); $ainfo = unserialize($kv->get('msetting_' . $table . '_' . $action)); $in_code = $kv->get('iosetting_input_' . $table . '_' . $action); $out_code = $kv->get('iosetting_output_' . $table . '_' . $action); // run user defined input fliter if (strlen($in_code) > 0) { eval($in_code); } if ($ainfo['on'] != 1) { return $this->send_error(LR_API_ARGS_ERROR, 'API NOT AVAILABLE'); } if ($ainfo['public'] != 1) { $this->check_token(); } $requires = array(); $inputs = array(); $outs = array(); $likes = array(); $equal = array(); foreach ($fields as $field) { $finfo = unserialize($kv->get('msetting_' . $table . '_' . $action . '_' . $field)); if ($finfo['required'] == 1) { $requires[] = $field; } if ($finfo['input'] == 1) { $inputs[] = $field; } if ($finfo['output'] == 1) { $outputs[] = $field; } if ($finfo['like'] == 1) { $likes[] = $field; } if ($finfo['equal'] == 1) { $equals[] = $field; } } // check require if (count($requires) > 0) { foreach ($requires as $require) { if (strlen(v($require)) < 1) { return $this->send_error(LR_API_ARGS_ERROR, z(t($require)) . ' FIELD REQUIRED'); } } } // build sql switch ($action) { case 'insert': if (count($inputs) < 1) { $this->send_error(LR_API_ARGS_ERROR, 'INPUT MUST HAS 1 FIELD AT LEAST'); } if (count($outputs) < 1) { $this->send_error(LR_API_ARGS_ERROR, 'OUTPUT MUST HAS 1 FIELD AT LEAST'); } foreach ($inputs as $input) { $dsql[] = "'" . s(v($input)) . "'"; } $sql = "INSERT INTO `" . s($table) . "` ( " . rjoin(' , ', '`', $inputs) . " ) VALUES ( " . join(' , ', $dsql) . " )"; //echo $sql; run_sql($sql); if (mysql_errno() != 0) { $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } $lid = last_id(); if ($lid < 1) { $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } if (!($data = get_data("SELECT " . rjoin(' , ', '`', $outputs) . " FROM `" . s($table) . "` WHERE `id` = '" . intval($lid) . "'", db()))) { $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } else { if (strlen($out_code) > 0) { eval($out_code); } $this->send_result($data); } break; case 'update': if (count($inputs) < 1) { return $this->send_error(LR_API_ARGS_ERROR, 'INPUT MUST HAS 1 FIELD AT LEAST'); } if (count($requires) < 1) { return $this->send_error(LR_API_ARGS_ERROR, 'REQUIRE MUST HAS 1 FIELD AT LEAST'); } foreach ($inputs as $input) { if (!in_array($input, $likes) && !in_array($input, $equals)) { if (isset($_REQUEST[$input])) { $dsql[] = " `" . s($input) . "` = '" . s(v($input)) . "' "; } } else { if (in_array($input, $likes)) { $wsql[] = " `" . s($input) . "` LIKE '%" . s(v($input)) . "%' "; } else { $wsql[] = " `" . s($input) . "` = '" . s(v($input)) . "' "; } } } if (!isset($dsql) || !isset($wsql)) { return $this->send_error(LR_API_ARGS_ERROR, 'INPUT AND LIKE/EQUALS MUST HAS 1 FIELD AT LEAST'); } $sql = "UPDATE `" . s($table) . "` SET " . join(' , ', $dsql) . ' WHERE ' . join(' AND ', $wsql); //echo $sql ; run_sql($sql); if (mysql_errno() != 0) { $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } $lid = intval(v('id')); if ($lid < 1) { $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } if (!($data = get_data("SELECT " . rjoin(' , ', '`', $outputs) . " FROM `" . s($table) . "` WHERE `id` = '" . intval($lid) . "'"))) { $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } else { if (strlen($out_code) > 0) { eval($out_code); } $this->send_result($data); } break; case 'remove': if (count($inputs) < 1) { return $this->send_error(LR_API_ARGS_ERROR, 'INPUT MUST HAS 1 FIELD AT LEAST'); } if (count($requires) < 1) { return $this->send_error(LR_API_ARGS_ERROR, 'REQUIRE MUST HAS 1 FIELD AT LEAST'); } foreach ($inputs as $input) { if (in_array($input, $likes)) { $wsql[] = " `" . s($input) . "` LIKE '%" . s(v($input)) . "%' "; } elseif (in_array($input, $equals)) { $wsql[] = " `" . s($input) . "` = '" . s(v($input)) . "' "; } } if (!isset($wsql)) { return $this->send_error(LR_API_ARGS_ERROR, 'INPUT AND LIKE/EQUALS MUST HAS 1 FIELD AT LEAST'); } if (count($outputs) > 0) { $sql = "SELECT " . rjoin(',', '`', $outputs) . " FROM `" . s($table) . "` WHERE " . join(' AND ', $wsql); $data = get_line($sql); if (mysql_errno() != 0) { return $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } } $sql = "DELETE FROM `" . s($table) . "` WHERE " . join(' AND ', $wsql); run_sql($sql); if (mysql_errno() != 0) { $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } else { if (count($outputs) < 1) { return $this->send_result(array('msg' => 'ok')); } else { if (strlen($out_code) > 0) { eval($out_code); } return $this->send_result($data); } } break; case 'list': default: $since_id = intval(v('since_id')); $max_id = intval(v('max_id')); $count = intval(v('count')); $order = strtolower(z(t(v('ord')))); $by = strtolower(z(t(v('by')))); if ($order == 'asc') { $ord = ' ASC '; } else { $ord = ' DESC '; } if (strlen($by) > 0) { $osql = ' ORDER BY `' . s($by) . '` ' . $ord . ' '; } else { $osql = ''; } if ($count < 1) { $count = 10; } if ($count > 100) { $count = 100; } if (count($outputs) < 1) { $this->send_error(LR_API_ARGS_ERROR, 'OUTPUT MUST HAS 1 FIELD AT LEAST'); } $sql = "SELECT " . rjoin(',', '`', $outputs) . " FROM `" . s($table) . "` WHERE 1 "; if ($since_id > 0) { $wsql = " AND `id` > '" . intval($since_id) . "' "; } elseif ($max_id > 0) { $wsql = " AND `id` < '" . intval($max_id) . "' "; } if (count($inputs) > 0 && count($likes) + count($equals) > 0) { // AND `xxx` == $xxx if (count($likes) > 0) { foreach ($likes as $like) { if (z(t(v($like))) != '') { $wwsql[] = " AND `" . s($like) . "` LIKE '%" . s(v($like)) . "%' "; } } } if (count($equals) > 0) { foreach ($equals as $equal) { if (z(t(v($equal))) != '') { $wwsql[] = " AND `" . s($equal) . "` = '" . s(v($equal)) . "' "; } } } if (isset($wwsql)) { $wsql = $wsql . join(' ', $wwsql); } } $sql = $sql . $wsql . $osql . " LIMIT " . $count; //echo $sql; if ($idata = get_data($sql)) { $first = reset($idata); $max_id = $first['id']; $min_id = $first['id']; foreach ($idata as $item) { if ($item['id'] > $max_id) { $max_id = $item['id']; } if ($item['id'] < $min_id) { $min_id = $item['id']; } } $data = array('items' => $idata, 'max_id' => $max_id, 'min_id' => $min_id); } else { $data = $idata; } if (mysql_errno() != 0) { return $this->send_error(LR_API_DB_ERROR, 'DATABASE ERROR ' . mysql_error()); } else { if (strlen($out_code) > 0) { eval($out_code); } return $this->send_result($data); } } //return $this->send_error( LR_API_ARGS_ERROR , 'FIELD NOT EXISTS' ); }
function sp_set_dynamic_config($data) { if (sp_is_sae()) { $kv = new SaeKV(); $ret = $kv->init(); $configs = $kv->get("THINKCMF_DYNAMIC_CONFIG"); $configs = empty($configs) ? array() : unserialize($configs); $configs = array_merge($configs, $data); $result = $kv->set('THINKCMF_DYNAMIC_CONFIG', serialize($configs)); } elseif (defined('IS_BAE') && IS_BAE) { $bae_mc = new BaeMemcache(); $configs = $bae_mc->get("THINKCMF_DYNAMIC_CONFIG"); $configs = empty($configs) ? array() : unserialize($configs); $configs = array_merge($configs, $data); $result = $bae_mc->set("THINKCMF_DYNAMIC_CONFIG", serialize($configs), MEMCACHE_COMPRESSED, 0); } else { $config_file = "./data/conf/config.php"; if (file_exists($config_file)) { $configs = (include $config_file); } else { $configs = array(); } $configs = array_merge($configs, $data); $result = file_put_contents($config_file, "<?php\treturn " . var_export($configs, true) . ";?>"); } sp_clear_cache(); return $result; }
function do_cos_html_cache_action() { if ($_POST['indexHtmlCacheDelbt']) { $kv = new SaeKV(); $kv->init(); $ret = $kv->get(CosSiteHome . '/index.html'); if ($ret) { if ($kv->delete(CosSiteHome . '/index.html')) { $msg = __('Index Caches were deleted successfully', 'cosbeta'); } else { $msg = '存在首页缓存,但是删除失败'; } } else { $msg = '不存在首页缓存'; } } if (!empty($_POST['htmlCacheDelbt'])) { // @rename(CosBlogPath."index.html",CosBlogPath."index.bak"); // @chmod( CosBlogPath."index.bak", 0666 ); $kv = new SaeKV(); $kv->init(); $ret = $kv->get(CosSiteHome . '/index.html'); if ($ret) { //$kv->set(CosBlogPath.'index.bak',$ret); $kv->delete(CosSiteHome . '/index.html'); } global $wpdb; if ($_POST['cache_id'] * 1 > 0) { //delete cache by id DelCacheByUrl(get_permalink($_POST['cache_id'])); $msg = __('the post cache was deleted successfully: ID=', 'cosbeta') . $_POST['cache_id']; } else { if (strlen($_POST['cache_id']) > 2) { $postRes = $wpdb->get_results("SELECT `ID` FROM `" . $wpdb->posts . "` WHERE post_title like '%" . $_POST['cache_id'] . "%' LIMIT 0,1 "); DelCacheByUrl(get_permalink($postRes[0]->ID)); $msg = __('the post cache was deleted successfully: Title=', 'cosbeta') . $_POST['cache_id']; } else { $postRes = $wpdb->get_results("SELECT `ID` FROM `" . $wpdb->posts . "` WHERE post_status = 'publish' AND ( post_type='post' OR post_type='page' ) ORDER BY post_modified DESC "); foreach ($postRes as $post) { DelCacheByUrl(get_permalink($post->ID)); } $msg = __('HTML Caches were deleted successfully', 'cosbeta'); } } } if ($msg) { echo '<div class="updated"><strong><p>' . $msg . '</p></strong></div>'; } }
private function getAnalysedRepory($reports) { $kv = new SaeKV(); $kv->init(); $maxDaysOfMonth = $kv->get('maxDaysOfMonth'); $increaseRate = $kv->get('increaseRate'); $salesTarget = $kv->get('salesTarget'); $manTarget = $kv->get('manTarget'); $cosmeticsTarget = $kv->get('cosmeticsTarget'); $mysql = new SaeMysql(); $month = $reports[0][1]; $day = $reports[0][2]; $sql = "SELECT SUM(`dailySales`) FROM `sales_amount` WHERE `date` = '2016-" . $month . "-" . $day . "'"; $data = $mysql->getData($sql); $lastYearDailySales = $data[0]['SUM(`dailySales`)']; $sql = "SELECT SUM(`monthlySales`) FROM `sales_amount` WHERE `date` = '2016-" . $month . "-" . $day . "'"; $data = $mysql->getData($sql); $lastYearMonthlySales = $data[0]['SUM(`monthlySales`)']; $dailyTarget = $this->sum($reports, 3); $realSales = $this->sum($reports, 4); $totalSales = $this->sum($reports, 6); $cosmeticsSales = $this->sum($reports, 7); $manSales = $this->sum($reports, 8); $line1 = "华东大区," . $month . "月" . $day . "日,时间进度" . round($day / $maxDaysOfMonth * 100) . "%,当月目标增长率" . $increaseRate . "%\r\n"; $line2 = "1)当日指标:" . $dailyTarget . ",实际销量:" . $realSales . ",当日达成率:" . round($realSales / $dailyTarget * 100, 1) . "%,同比增长:" . round(($realSales / $lastYearDailySales - 1) * 100, 1) . "%;\r\n"; $line3 = "2)当月指标:" . $salesTarget . ",累计销售:" . $totalSales . ",累计达成率:" . round($totalSales / $salesTarget * 100, 1) . "%,同比增长:" . round(($totalSales / $lastYearMonthlySales - 1) * 100, 1) . "%;\r\n"; $line4 = "3)重点品:男士销售:" . $manSales . "元,男士指标达成:" . round($manSales / $manTarget * 100, 1) . "%;彩妆销售:" . $cosmeticsSales . "元,彩妆指标达成:" . round($cosmeticsSales / $cosmeticsTarget * 100, 1) . "%;\r\n"; $line5 = "4)执行反馈:无"; return $line1 . $line2 . $line3 . $line4 . $line5; }
echo '<form action="?a=login" method="post">密码:' . "<input type='passwd' name='passwd' value='' /><br /><input type='submit' name='submit' value='登录' /><br /></form>"; } else { if ($a == 'login') { $passwd = isset($_POST['passwd']) ? $_POST['passwd'] : ''; if ($passwd == $pass) { $_SESSION['admin'] = 1; } echo "<script>window.location.href='saekv.php?a=allkv'</script>"; } else { if ($a == 'set') { check_login(); if (!empty($k) && !empty($v)) { $kv->set($k, $v); echo "<p>设置成功:{$k} => {$v}</p>"; } else { $v = $kv->get($k); ?> <form action="saekv.php?a=set" name="setform" method="post"> <p> Key:<input type="text" name="k" value="<?php echo $k; ?> " /></p> <p>Value:<textarea rows="8" name="v"><?php echo $v; ?> </textarea> <p> <input type="submit" value="设置" /></p> </form> <?php } } else {