/** * 写配置 * * @param array * @return none * @throws none */ public static function set_configs($configs = array()) { foreach ($configs as $current_key => $current_value) { if (false === strpos($current_key, 'fl_')) { $current_key = 'fl_' . $current_key; } pm_db::query("replace `pm_config` set `fl_value` = '" . $current_value . "', `fl_name` = '" . $current_key . "'"); } }
public static function get_menu_list() { $data = array(); $query = pm_db::query("SELECT * FROM pm_menu WHERE parent_id=0 AND level=1 AND status=1 ORDER BY sort ASC"); while ($row = pm_db::fetch_one($query)) { $data[] = $row; $secondquery = pm_db::query("SELECT * FROM pm_menu WHERE parent_id='{$row['menu_id']}' AND level=2 ORDER BY sort ASC"); while ($second = pm_db::fetch_one($secondquery)) { if (!$second) { continue; } else { $data[] = $second; $query1 = pm_db::query("SELECT * FROM pm_menu WHERE parent_id='{$second['menu_id']}' AND level=3 AND status=1 ORDER BY sort ASC"); while ($row1 = pm_db::fetch_one($query1)) { $data[] = $row1; } } } } return $data; }
/** * 系统信息 * */ public static function system_info() { define("YES", "<span class='resYes'>YES</span>"); define("NO", "<span class='resNo'>NO</span>"); // 系统基本信息 $serverapi = strtoupper(php_sapi_name()); $phpversion = PHP_VERSION; $systemversion = explode(" ", php_uname()); $sysReShow = 'none'; switch (PHP_OS) { case "Linux": $sysReShow = false !== ($sysInfo = self::sys_linux()) ? "show" : "none"; $sysinfo = $systemversion[0] . ' ' . $systemversion[2]; break; case "FreeBSD": $sysReShow = false !== ($sysInfo = self::sys_freebsd()) ? "show" : "none"; $sysinfo = $systemversion[0] . ' ' . $systemversion[2]; break; default: $sysinfo = $systemversion[0] . ' ' . $systemversion[1] . ' ' . $systemversion[3] . $systemversion[4] . $systemversion[5]; break; } if ($sysReShow == 'show') { $pmemory = '共' . $sysInfo['memTotal'] . 'M, 已使用' . $sysInfo['memUsed'] . 'M, 空闲' . $sysInfo['memFree'] . 'M, 使用率' . $sysInfo['memPercent'] . '%'; $pmemorybar = $sysInfo['memPercent']; $swapmomory = '共' . $sysInfo['swapTotal'] . 'M, 已使用' . $sysInfo['swapUsed'] . 'M, 空闲' . $sysInfo['swapFree'] . 'M, 使用率' . $sysInfo['swapPercent'] . '%'; $swapmemorybar = $sysInfo['swapPercent']; $syslaodavg = $sysInfo['loadAvg']; } pm_db::query("SELECT VERSION() AS dbversion"); $mysql = pm_db::fetch_one(); $mysql = $mysql['dbversion']; $phpsafe = self::getcon("safe_mode"); $dispalyerror = self::getcon("display_errors"); $allowurlopen = self::getcon("allow_url_fopen"); $registerglobal = self::getcon("register_globals"); $maxpostsize = self::getcon("post_max_size"); $maxupsize = self::getcon("upload_max_filesize"); $maxexectime = self::getcon("max_execution_time") . 's'; $mqqsp = get_magic_quotes_gpc() === 1 ? YES : NO; $mprsp = get_magic_quotes_runtime() === 1 ? YES : NO; $zendoptsp = get_cfg_var("zend_optimizer.optimization_level") || get_cfg_var("zend_extension_manager.optimizer_ts") || get_cfg_var("zend_extension_ts") ? YES : NO; $iconvsp = self::isfun('iconv'); $curlsp = self::isfun('curl_init'); $gdsp = self::isfun('gd_info'); $zlibsp = self::isfun('gzclose'); $eaccsp = self::isfun('eaccelerator_info'); $xcachesp = extension_loaded('XCache') ? YES : NO; $sessionsp = self::isfun("session_start"); $cookiesp = isset($_COOKIE) ? YES : NO; $serverip = @gethostbyname($_SERVER['SERVER_NAME']); $serverip = $serverip == '' ? '' : " ({$serverip})"; $systime = gmdate("Y年n月j日 H:i:s", time() + 8 * 3600); $phpversionsp = $phpversion > '5.0' ? YES : NO; $mysqlversionsp = $mysql['dbversion'] > '4.1' ? YES : NO; $dbasp = extension_loaded('dba') ? YES : NO; // 数据库大小 $databasesize = 0; pm_db::query("SHOW TABLE STATUS"); while ($rs = pm_db::fetch_one()) { $databasesize += $rs['Data_length'] + $rs['Index_length']; } $databasesize = bytes_to_string($databasesize); //站点统计 pm_db::query("SELECT count(*) as sum FROM gh_ghinfo"); $rt = pm_db::fetch_one(); $ghsum = $rt['sum']; //系统日志大小超过限制提示 $noticemsg = ''; if (@filesize(PATH_DATA . '/log/admin_log.php') > 409600) { $noticemsg = '后台记录日志'; } if (@filesize(PATH_DATA . '/log/php_error.log') > 409600) { $data['noticemsg'] = 'PHP错误日志'; } if (@filesize(PATH_DATA . '/log/mysql_error.php') > 409600) { $data['noticemsg'] = 'mysql日志'; } $data['serverip'] = $serverip; $data['systime'] = $systime; $data['sysinfo'] = $sysinfo; $data['phpversion'] = $phpversion; $data['dbversion'] = $mysql; $data['dispalyerror'] = $dispalyerror; $data['serverapi'] = $serverapi; $data['phpsafe'] = $phpsafe; $data['sessionsp'] = $sessionsp; $data['cookiesp'] = $cookiesp; $data['phpsafe'] = $phpsafe; $data['zendoptsp'] = $zendoptsp; $data['eaccsp'] = $eaccsp; $data['xcachesp'] = $xcachesp; $data['registerglobal'] = $registerglobal; $data['mqqsp'] = $mqqsp; $data['mprsp'] = $mprsp; $data['maxupsize'] = $maxupsize; $data['maxpostsize'] = $maxpostsize; $data['maxexectime'] = $maxexectime; $data['allowurlopen'] = $allowurlopen; $data['curlsp'] = $curlsp; $data['iconvsp'] = $iconvsp; $data['zlibsp'] = $zlibsp; $data['gdsp'] = $gdsp; $data['dbasp'] = $dbasp; $data['datasize'] = $databasesize; $data['ghsum'] = $ghsum; return $data; }
public function testaa() { $aa = pm_db::fetch_all(pm_db::query("select * from gamebi_giving_item")); echo "<pre>"; print_r($aa); //echo pm_db::query("insert into gamebi_giving_item set itemid='14190001',name='炼武破片',type='2',gameid='100087'"); // // //echo pm_db::query("insert into gamebi_giving_item set itemid='14190002',name='防具碎片',type='2',gameid='100087'"); //echo pm_db::query("insert into gamebi_giving_item set itemid='14190003',name='饰品碎片',type='2',gameid='100087'"); //echo pm_db::query("insert into gamebi_giving_item set itemid='14191001',name='上古残枪',type='2',gameid='100087'"); //echo pm_db::query("insert into gamebi_giving_item set itemid='14191002',name='上古残扇',type='2',gameid='100087'"); //echo pm_db::query("insert into gamebi_giving_item set itemid='14191003',name='上古残剑',type='2',gameid='100087'"); }
private function getparents($list) { foreach ($list as $val) { $p[] = $val['parent_id']; } $sql_2 = "SELECT * FROM iosadm_menu where menu_id in (" . implode(',', array_unique($p)) . ")"; $parentlist = pm_db::fetch_all(pm_db::query($sql_2)); foreach ($parentlist as $value) { $parent[$value['menu_id']] = $value['menu_name']; } foreach ($parent as $key => $value) { $menu[$key]['label'] = $value; foreach ($list as $val) { if ($val['parent_id'] == $key) { $menu[$key]['children'][$val['menu_id']]['label'] = $val['menu_name']; $menu[$key]['children'][$val['menu_id']]['action'] = $val['act_url']; } } } return $menu; }
public static function sendmsg($data) { pm_db::insert('gamebi_usermsg', $data); }
public function export() { $where = stripcslashes($_GET['query']); $sql = "SELECT * from crm_question WHERE `exists`= '1' {$where} order by create_time desc"; $list = pm_db::fetch_all_result($sql); $plist = mod_product::getcrmproduct(); $tlist = mod_crmmanage::getqtype(); $slist = mod_crmmanage::getserverlist(); foreach ($list as &$value) { foreach ($slist as $val) { if ($value['server_id'] == $val['id']) { $value['server'] = $val['server_name']; } } foreach ($plist as $val) { if ($value['game_id'] == $val['pid']) { $value['game'] = $val['pname']; } } foreach ($tlist as $val) { if ($value['qtype_id'] == $val['id']) { $value['qtype'] = $val['name']; } } if ($value['status'] == 'untreated') { $value['status_info'] = "未处理"; } elseif ($value['status'] == 'processed') { $value['status_info'] = "已处理"; } else { $value['status_info'] = "已关闭"; } if ($value['operation'] == 1) { $value['status_info'] .= "--运营处理中"; } if ($value['operation'] == 2) { $value['status_info'] .= "--运营已回复"; } } $line = "<tr>"; foreach ($list as $value) { $line .= "<td>" . $value['question_id'] . "</td>"; $line .= "<td>" . $value['title'] . "</td>"; $line .= "<td>" . $value['content'] . "</td>"; $line .= "<td>" . $value['game'] . "</td>"; $line .= "<td>" . $value['server'] . "</td>"; $line .= "<td>" . $value['channel'] . "</td>"; $line .= "<td>" . $value['account'] . "</td>"; $line .= "<td>" . $value['nick'] . "</td>"; $line .= "<td>" . $value['role_id'] . "</td>"; $line .= "<td>" . $value['occurs_time'] . "</td>"; $line .= "<td>" . $value['qtype'] . "</td>"; $line .= "<td>" . $value['create_time'] . "</td>"; $line .= "<td>" . $value['status_info'] . "</td>"; $line .= "<td>" . $value['qq'] . "</td>"; $line .= "<td>" . $value['mobile'] . "</td>"; $line .= "<td>" . $value['email'] . "</td></tr><tr>"; } $content = substr($line, 0, -4); $template = file_get_contents("template.html"); $html = str_replace("[content]", $content, $template); echo $html; }
public function ajaxser() { $data['sort'] = $_GET['sort']; $id = $_GET['id']; pm_db::update('crm_serverlist', $data, "id = '{$id}'"); }
public static function as_channel_data($channel, $starttime = '', $endtime = '') { $sql = "SELECT SUM(charge) AS c,SUM(registernum) AS rn, SUM(chargenum) AS cn FROM pm_ghzcdata WHERE channelid='{$channel}'"; if ($starttime) { $sql .= " AND thedate>='{$starttime}'"; } if ($endtime) { $sql .= " AND thedate<='{$endtime}'"; } return pm_db::fetch_result($sql); }
public static function get_rows_num($table, $condition) { try { if (empty($table) || empty($condition)) { throw new Exception('查询记录数的表名,字段,条件不能为空', 444); } self::$sql = "SELECT count(*) AS total FROM {$table} WHERE {$condition}"; $result = self::query(self::$sql); $tmp = self::fetch_one(); return empty($tmp) ? false : $tmp['total']; } catch (Exception $e) { if (!defined('DEBUG_LEVEL') || !DEBUG_LEVEL) { } else { echo $e->getMessage(), '<br/>'; echo '<pre>', $e->getTraceAsString(), '</pre>'; echo '<strong>Query: </strong>[rows_num] ' . !empty(self::$sql) && self::$sql; } self::log($e->getMessage()); exit; } }
public static function get_soplog($start, $opuser = false, $ctrl = false, $act = false, $aday = false, $stime = false, $etime = false) { $data = array(); $condition = ''; if ($keyword && $cols) { $condition1 = " WHERE {$cols}='{$keyword}'"; } if ($start > -1 && $page > 0) { $condition2 = " ORDER BY timestamp DESC LIMIT {$start}, {$page}"; } $condition = $condition1 . $condition2; $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM pm_oplog {$condition}"; //debug($sql); $query = pm_db::query($sql); while ($row = pm_db::fetch_one($query)) { $data[$row['oplid']] = $row; } if ($data) { $output = array(); $total = pm_db::query('SELECT FOUND_ROWS() AS rows'); $total = pm_db::fetch_one(); $output['total'] = $total['rows']; $output['data'] = $data; return $output; } else { return false; } }
public static function get_logslist($start, $username, $ctr_new, $act_new, $start_dategsh, $end_dategsh, $perpage = 20) { $where = ''; if (!empty($username)) { $where .= " AND username = '******' "; } if (!empty($ctr_new)) { $where .= " AND ctrl = 'c={$ctr_new}' "; } if (!empty($act_new)) { $where .= " AND act = 'a={$act_new}' "; } if (!empty($start_dategsh)) { $where .= " AND aday >= {$start_dategsh} "; } if (!empty($end_dategsh)) { $where .= " AND aday <= {$end_dategsh} "; } if ($start > -1 && $perpage > 0) { $where .= " ORDER BY timestamp DESC LIMIT {$start}, {$perpage} "; } $sql = "SELECT SQL_CALC_FOUND_ROWS * FROM iosadm_oplog WHERE 1=1 {$where} "; $query = pm_db::query($sql); $data = pm_db::fetch_all($query); $total = pm_db::result_first(" SELECT FOUND_ROWS() AS rows "); if ($data) { $output = array(); $output['data'] = $data; $output['total'] = $total; return $output; } else { return null; } }