public function tminiget($pos = '') { global $_M; $pos = $pos ? $pos : '0'; $posw = $pos == 'all' ? '' : " and pos='{$pos}' "; $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$this->no}' {$posw} AND lang='{$this->lang}' order by no_order,id "; $this->inc = DB::get_all($query); return $this->inc; }
function dolidb() { global $_M; $file = $_M['form']['met_skin_user'] ? $_M['form']['met_skin_user'] : $_M['config']['met_skin_user']; $this->checktem($file); $tmpincfile = PATH_WEB . "templates/{$_M[form][met_skin_user]}/metinfo.inc.php"; if (file_exists($tmpincfile)) { require $tmpincfile; } //列表页设置 $m_now_time = time(); $met_timetype[0] = array(1 => 'Y-m-d H:i:s', 2 => date('Y-m-d H:i:s', $m_now_time)); $met_timetype[1] = array(1 => 'Y-m-d', 2 => date('Y-m-d', $m_now_time)); $met_timetype[2] = array(1 => 'Y/m/d', 2 => date('Y/m/d', $m_now_time)); $met_timetype[3] = array(1 => 'Ymd', 2 => date('Ymd', $m_now_time)); $met_timetype[4] = array(1 => 'Y-m', 2 => date('Y-m', $m_now_time)); $met_timetype[5] = array(1 => 'Y/m', 2 => date('Y/m', $m_now_time)); $met_timetype[6] = array(1 => 'Ym', 2 => date('Ym', $m_now_time)); $met_timetype[6] = array(1 => 'm-d', 2 => date('m-d', $m_now_time)); $met_timetype[7] = array(1 => 'm/d', 2 => date('m/d', $m_now_time)); $met_timetype[8] = array(1 => 'md', 2 => date('md', $m_now_time)); $selecthtml = ''; for ($i = 0; $i < 9; $i++) { $selecthtml .= "<option value=\"{$met_timetype[$i][1]}\">{$met_timetype[$i][2]}</option>"; } switch ($_M['form']['listdb']) { case 2: //全局 $inilist = $this->iniclass->tminiment(0); $temname = $_M[form][mobile] ? 'mobile_overall' : 'oldoverall'; break; case 3: //首页 $wap_ok = $_M[form][mobile] ? 1 : 0; if ($_M[form][mobile]) { $set = DB::get_one("select * from {$_M[table][config]} where name='flash_10001' and lang='{$_M[lang]}'"); $_M['config']['flash_10001'] = $set['mobile_value']; } $bannerlist = DB::get_all("select * from {$_M[table][flash]} where wap_ok='{$wap_ok}' and (module like '%,10001,%' or module = 'metinfo') and lang='{$_M[lang]}' and img_path!='' order by no_order "); $inbaset = explode('|', $_M['config']['flash_10001']); $inilist = $this->iniclass->tminiment(1); $temname = $_M[form][mobile] ? 'mobile_home' : 'oldhome'; break; case 4: //列表页 $inilist = $this->iniclass->tminiment(2); $temname = $_M[form][mobile] ? 'mobile_page' : 'oldpage'; break; case 5: //详情页 $inilist = $this->iniclass->tminiment(3); $temname = $_M[form][mobile] ? 'mobile_details' : 'olddetails'; break; } require $this->template('tem/' . $temname); }
/** * 获取当前会员信息; * @return array $user 返回记录当前会员信息的数组 */ function member_information() { global $_M; $metinfo_member_name = get_met_cookie('metinfo_member_name'); $user = load::sys_class('user', 'new')->get_user_by_username($metinfo_member_name); $user['usertype'] = $user['groupid']; $user['admin_id'] = $user['username']; $user['admin_pass'] = $user['password']; $query = "SELECT id,name FROM {$_M['table']['column']} WHERE access <= '{$user['groupid']}' AND lang = '{$_M['lang']}'"; $column = DB::get_all($query); $user['column'] = $column; return $user; }
public function json_user_list() { global $_M; $groupid = $_M['form']['groupid']; $keyword = $_M['form']['keyword']; $search = $groupid ? "and groupid = '{$groupid}'" : ''; $search .= $keyword ? "and (username like '%{$keyword}%' || email like '%{$keyword}%' || tel like '%{$keyword}%')" : ''; $table = load::sys_class('tabledata', 'new'); $order = "login_time DESC,register_time DESC"; $where = "lang='{$_M['lang']}' {$search}"; $userlist = $table->getdata($_M['table']['user'], '*', $where, $order); $user_group = array(); $group = DB::get_all("SELECT * FROM {$_M[table][user_group]} WHERE lang = '{$_M[form][lang]}'"); foreach ($group as $key => $val) { $user_group[$val['id']] = $val['name']; } foreach ($userlist as $key => $val) { switch ($val['source']) { case 'weixin': $val['source'] = '微信登录'; break; case 'weibo': $val['source'] = '微博登录'; break; case 'qq': $val['source'] = 'QQ登录'; break; default: $val['source'] = '注册'; break; } if (!$val['login_time']) { $val['login_time'] = $val['register_time']; } $list = array(); $list[] = "<input name=\"id\" type=\"checkbox\" value=\"{$val[id]}\">"; $list[] = $val['username']; $list[] = $user_group[$val['groupid']]; $list[] = timeFormat($val['register_time']); $list[] = timeFormat($val['login_time']); $list[] = $val['login_count']; $list[] = $val['valid'] ? '已激活' : '未激活'; $list[] = $val['source']; $list[] = "<a href=\"{$_M[url][own_form]}a=doeditor&id={$val['id']}\" class=\"edit\">编辑</a><span class=\"line\">|</span><a href=\"{$_M[url][own_form]}a=dodellist&allid={$val['id']}\" class=\"delet\" data-confirm='{$_M[word][js7]}'>删除</a>"; $rarray[] = $list; } $table->rdata($rarray); }
/** * 获取表查询数据 * @param string $table 表名 * @param string $field 表字段 * @param string $where where条件 * @param string $order order by条件 * @return array 查询数据 */ public function getdata($table, $field = '*', $where = '', $order = '') { global $_M; /*获取表格ajax传递的参数*/ $length = $_M['form']['length']; //每页显示数量 $start = $_M['form']['start']; //读取数据的起点 $draw = $_M['form']['draw']; //累计执行次数,无作用但必须回传 if ($_M['form']['tablepage'] && $start == 0 & $draw == 1) { $cook = explode("|", $_M['form']['tablepage']); $u = "{$_M['form']['n']},{$_M['form']['c']},{$_M['form']['a']}"; if ($cook[1] == $u) { $start = $cook[0] * $_M['form']['length']; } } /*查询表*/ if ($where) { $conds .= " WHERE {$where} "; } if ($order) { $conds .= " ORDER BY {$order} "; } //整理查询条件 $query = "SELECT {$field} FROM {$table} {$conds} LIMIT {$start},{$length}"; //mysql语句 $array = DB::get_all($query); //执行查询,获得数组 $error = DB::error(); if ($error) { $this->error = $query . "<br />" . $error; } else { $this->error = ''; } $total = DB::counter($table, $conds, '*'); //获取总数量,计算总页数 /*回传数组处理*/ $this->rarray = array(); $this->rarray['draw'] = $draw; //回传执行次数 $this->rarray['recordsTotal'] = $total; //回传总数量 $this->rarray['recordsFiltered'] = $total; //回传筛选过的总数量,暂无作用,但必须回传 return $array; }
/** * 获取前台模板的语言参数配置,存放在$_M['word']中,系统语言参数数组。 */ protected function load_template_lang() { global $_M; //模板文件 $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M[config][met_skin_user]}' AND lang='{$_M['lang']}' order by no_order "; $inc = DB::get_all($query); $tmpincfile = PATH_WEB . "templates/{$_M[config][met_skin_user]}/metinfo.inc.php"; require $tmpincfile; $_M['config']['metinfover'] = $metinfover; foreach ($inc as $key => $val) { $name = $val['name']; if ($val[type] == 7 && strstr($val['value'], "../upload/") && $index == 'index' && $metinfover == 'v1') { $val['value'] = explode("../", $val['value']); $val['value'] = $val['value'][1]; } $_M['word'][$name] = trim($val['value']); } }
/** * 初始化 */ public function __construct() { global $_M; parent::__construct(); $this->check(); $this->userclass = load::sys_class('user', 'new'); $query = "SELECT * FROM {$_M['table']['column']} WHERE module='10' AND lang='{$_M['lang']}'"; $member = DB::get_one($query); if ($_M['config']['met_title_type'] == 0) { $_M['tem_data']['title'] = $member['name']; } else { if ($_M['config']['met_title_type'] == 1) { $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords']; } else { if ($_M['config']['met_title_type'] == 2) { $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_webname']; } else { if ($_M['config']['met_title_type'] == 3) { $_M['tem_data']['title'] = $member['name'] . '-' . $_M['config']['met_keywords'] . '-' . $_M['config']['met_webname']; } } } } $query = "SELECT * FROM {$_M['table']['ifmember_left']}"; $navigation = DB::get_all($query); foreach ($navigation as $key => $val) { if ($val[columnid]) { //$column = $class_list[$val[columnid]]; $query = "SELECT * FROM {$_M['table']['column']} WHERE id = '{$val[columnid]}'"; $column = DB::get_one($query); $val['foldername'] = $val['foldername'] ? $val['foldername'] : $column['foldername']; $val['filename'] = $val['filename'] ? $val['filename'] : 'index.php'; $list['url'] = "../{$val['foldername']}/{$val['filename']}"; $list['title'] = $column['name']; } else { $list['url'] = "../{$val['foldername']}/{$val['filename']}"; $list['title'] = $val['title']; } $_M['html']['app_sidebar'][] = $list; } }
//$_SESSION['username'] = "******"; //$_SESSION['password'] = md5("sys"); //$_SESSION['usrDuty'] = 1; //$_SESSION['usrcname'] = "管理员"; //$_SESSION['personshihao'] = ""; echo "管理员"; } else { echo "fail"; } } else { echo "fail"; } } } if ($type == "getInterviewList") { $result = $dbop->get_all("select interviewid, personshihao, interviewdate, shequname, xiaoquname, loufanghao, interviewrecord.loufangid from interviewrecord, shequ, xiaoqu, loufang where interviewrecord.interviewstatus='待走访' and interviewrecord.loufangid=loufang.loufangid and loufang.xiaoquid=xiaoqu.xiaoquid and shequ.shequid=xiaoqu.shequid order by interviewdate"); $count = count($result); echo "<div class='panel-heading'><span class='badge' style='float:right'>{$count}</span>待走访一览</div>\n <ul class='list-group'>"; if ($count > 0) { $curDay = date("Y-m-d"); foreach ($result as $i => $value) { // 获取地址 $interviewid = $result[$i]['interviewid']; $shequname = $result[$i]['shequname']; $xiaoquname = $result[$i]['xiaoquname']; $loufanghao = $result[$i]['loufanghao']; $personshihao = $result[$i]['personshihao']; $addr = $shequname . " > " . $xiaoquname . " > " . $loufanghao . " > " . $personshihao; // 获取访问日期及访问日期与当前日期之差 $interviewdate = $result[$i]['interviewdate']; $dis = ceil((strtotime($interviewdate) - strtotime($curDay)) / 86400);
public function export($fileName, $fileFormat, $table) { $content = ""; $content = "catName\n"; $db = new DB(); $result = $db->get_all($table); while ($row = mysql_fetch_array($result)) { $content .= $row['catName'] . "\n"; } if ($fileFormat == 'csv') { header("Content-Type: application/csv"); header("content-Disposition: attachment; filename=" . $fileName); } return $content; }
public function dopos() { global $_M; $metinfo['citylist'][0]['p']['name'] = '全局'; $metinfo['citylist'][0]['p']['value'] = 0; $metinfo['citylist'][0]['c'][0]['n']['name'] = '首项'; $metinfo['citylist'][0]['c'][0]['n']['value'] = 0; $metinfo['citylist'][1]['p']['name'] = '首页'; $metinfo['citylist'][1]['p']['value'] = 1; $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND pos = '0' ORDER BY no_order DESC,id DESC "; $max_order = DB::get_one($query); $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0; $metinfo['citylist'][1]['c'][0]['n']['name'] = '首项'; $metinfo['citylist'][1]['c'][0]['n']['value'] = $max_order['id']; $metinfo['citylist'][2]['p']['name'] = '列表页'; $metinfo['citylist'][2]['p']['value'] = 2; $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1') ORDER BY no_order DESC,id DESC "; $max_order = DB::get_one($query); $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0; $metinfo['citylist'][2]['c'][0]['n']['name'] = '首项'; $metinfo['citylist'][2]['c'][0]['n']['value'] = $max_order['id']; $metinfo['citylist'][3]['p']['name'] = '详细页'; $metinfo['citylist'][3]['p']['value'] = 3; $query = "SELECT * FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' AND (pos='0' OR pos='1' OR pos='2') ORDER BY no_order DESC,id DESC "; $max_order = DB::get_one($query); $max_order['id'] = $max_order['id'] ? $max_order['id'] : 0; $metinfo['citylist'][3]['c'][0]['n']['name'] = '首项'; $metinfo['citylist'][3]['c'][0]['n']['value'] = $max_order['id']; $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id"; $tems = DB::get_all($query); foreach ($tems as $key => $val) { $val['pos'] = $val['pos']; $tem = array(); $tem['n']['name'] = $val['valueinfo']; $tem['n']['value'] = $val['id']; $metinfo['citylist'][$val['pos']]['c'][] = $tem; } echo jsonencode($metinfo); }
/** * return all possible results for a DB query for specified tables and fields */ protected function all_field_query($tables, $columns, $where, $fields) { $db_query = DB::get_all('SELECT ' . $columns . ' FROM ' . $tables . ' WHERE ' . $where, $fields); return $db_query; }
function dousercsv() { global $_M; $groupid = $_M['form']['groupid']; $keyword = $_M['form']['keyword']; $search = $groupid ? "and groupid = '{$groupid}'" : ''; $search .= $keyword ? "and (username like '%{$keyword}%' || email like '%{$keyword}%' || tel like '%{$keyword}%')" : ''; /*查询表*/ $query = "SELECT * FROM {$_M['table']['user']} WHERE lang='{$_M['lang']}' {$search} ORDER BY login_time DESC,register_time DESC"; //mysql语句 $array = DB::get_all($query); $paralist = $this->paraclass->get_para_list(10); foreach ($array as $key => $val) { switch ($val['source']) { case 'weixin': $val['source'] = '微信登录'; break; case 'weibo': $val['source'] = '微博登录'; break; case 'qq': $val['source'] = 'QQ登录'; break; default: $val['source'] = '注册'; break; } if (!$val['login_time']) { $val['login_time'] = $val['register_time']; } $list = array(); $list[] = $val['username']; $list[] = $user_group[$val['groupid']]; $list[] = date('Y-m-d H:i:s', $val['register_time']); $list[] = date('Y-m-d H:i:s', $val['login_time']); $list[] = $val['login_count']; $list[] = $val['valid'] ? '已激活' : '未激活'; $list[] = $val['source']; $list[] = $val['email']; $list[] = $val['tel']; if ($paralist) { $para = $this->paraclass->get_para($val['id'], 10); foreach ($paralist as $vals) { $list[] = $para['info_' . $vals['id']]; } } $rarray[] = $list; } $filename = "USER_" . date('Y-m-d', time()) . "_ACCLOG"; $head = array('用户名', '会员组', '注册时间', '最后活跃', '登录次数', '是否激活', '来源', '绑定邮箱', '绑定手机'); if ($paralist) { foreach ($paralist as $val) { $head[] = $val['name']; } } $csv = load::sys_class('csv', 'new'); $csv->get_csv($filename, $rarray, $head); }
/** * 加载插件 * @param string $plugin 需要加载的插件系统名 */ public static function plugin($plugin, $return = 0) { global $_M; if (!$_M['plugin']) { $query = "SELECT * FROM {$_M['table']['app_plugin']} WHERE effect='1' ORDER BY no_order DESC"; $plugins = DB::get_all($query); foreach ($plugins as $key => $val) { $_M['plugin'][$val['m_action']][] = $val['m_name']; } } foreach ($_M['plugin'][$plugin] as $key => $val) { $own = $_M['url']['own']; $_M['url']['own'] = $_M['url']['app'] . $val . '/'; if (file_exists(PATH_APP . 'app/' . $val . '/plugin/' . 'plugin_' . $val . '.class.php')) { require_once PATH_APP . 'app/' . $val . '/plugin/' . 'plugin_' . $val . '.class.php'; //self::_load_class(PATH_APP.'app/'.$val.'/plugin/', 'plugin_'.$val, $plugin); $name = 'plugin_' . $val; if (class_exists($name)) { $newclass = new $name(); if (method_exists($newclass, $plugin)) { if ($return == 1) { return call_user_func(array($newclass, $plugin)); } else { call_user_func(array($newclass, $plugin)); } } } } $_M['url']['own'] = $own; } }
<?php include 'functions.php'; $db = new DB(); $table_name = 'triggers_personality'; $result = $db->get_all($table_name); while ($row = mysql_fetch_array($result)) { ?> <h1><?php echo $row['name']; ?> </h1> <h3><?php echo $row['position']; ?> </h3> <h5><?php echo $row['desc']; ?> </h5> <hr> <?php }
public function get_para() { global $_M; $query = "SELECT * FROM {$_M['table']['shopv2_para']} WHERE value!=''"; $para = DB::get_all($query); foreach ($para as $val) { $valuelist = explode(',', $val['valuelist']); $paras[$val['value']] = $valuelist; } return $paras; }
/** * 获取模块编号 * @param int $module 模块编号 * @return string 返回记录后台导航栏目信息的数组 */ function modname($module) { global $_M; $metmodname = $module; switch ($module) { case 1: $metmodname = $_M['word']['mod1']; break; case 2: $metmodname = $_M['word']['mod2']; break; case 3: $metmodname = $_M['word']['mod3']; break; case 4: $metmodname = $_M['word']['mod4']; break; case 5: $metmodname = $_M['word']['mod5']; break; case 6: $metmodname = $_M['word']['mod6']; break; case 7: $metmodname = $_M['word']['mod7']; break; case 8: $metmodname = $_M['word']['mod8']; break; case 9: $metmodname = $_M['word']['mod9']; break; case 10: $metmodname = $_M['word']['mod10']; break; case 11: $metmodname = $_M['word']['mod11']; break; case 12: $metmodname = $_M['word']['mod12']; break; case 999: $metmodname = $_M['word']['modout']; break; case 100: $metmodname = $_M['word']['mod100']; break; case 101: $metmodname = $_M['word']['mod101']; break; default: $query = "SELECT * FROM {$_M['table']['applist']}"; $app = DB::get_all($query); foreach ($app as $key => $val) { if ($module == $val['no']) { $metmodname = get_word($val['appname']); } } break; } return $metmodname; }
<!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" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="css/list.css" media="all" /> <script type="text/javascript" src="../js/jquery.min.js"></script> <title>人人网微博应用</title> <style type="text/css"> body { behavior:url("../css/csshover3.htc"); } </style> </head> <body> <div id = 'content'> <p id="title">问卷调查数据整理</p> <?php $th = 3; $sql = "select `{$th}` , count(*) as choise from answers group by `{$th}` order by `{$th}` LIMIT 0, 30 "; $result = $db->get_all($sql); for ($i = 1; $i <= 5; $i++) { $choise[$i] = 0; } for ($i = 1; $i <= count($result); $i++) { $choise[$result[$i - 1][$th]] = $result[$i - 1]['choise']; } ?> <div class="eachitem"> <div class="eachquiz">是否希望在毕业时和同学朋友拍摄视频留念?</div> <div class="eachanwser"><span class="inspector">•</span>是<span id="percentage"><?php echo $choise[1] . '/' . $num;
<?php require_once "db.php"; //username if (isset($_GET['username']) && $_GET['username']) { $username = $_GET['username']; } else { $username = ''; } if ($username) { $db = new DB(); $allroomlist = ""; $sqlRowAll = $db->get_all("select * from ofMucRoom where roomID in(select roomID from ofMucAffiliation where jid='" . $username . "@211.149.195.30')"); foreach ($sqlRowAll as $k => $v) { $allroomlist = $allroomlist . $v['roomID'] . "|" . $v['name'] . "|" . $v['description'] . "|1" . "\$"; } unset($sqlRowAll); $sqlRowAll = $db->get_all("select * from ofMucRoom where roomID in(select roomID from ofMucMember where jid='" . $username . "@211.149.195.30')"); foreach ($sqlRowAll as $k => $v) { $allroomlist = $allroomlist . $v['roomID'] . "|" . $v['name'] . "|" . $v['description'] . "|0" . "\$"; } $allroomlist = rtrim($allroomlist, '$'); echo $allroomlist; }
public function dosetsave() { global $_M; $list = explode(",", $_M[form][allid]); $type = $_M[form][submit_type]; $i = 0; foreach ($list as $id) { if ($id) { $i++; if ($type == 'save' || !$type) { $name = $_M['form']['name-' . $id]; $defaultvalue = $_M['form']['defaultvalue-' . $id]; $valueinfo = $_M['form']['valueinfo-' . $id]; $type1 = $_M['form']['type-' . $id]; $tips = $_M['form']['tips-' . $id]; $selectd = $_M['form']['selectd-' . $id]; $style = $_M['form']['style-' . $id]; $no = $_M['form']['no']; $pos = $_M['form']['pos-' . $id]; $no_order = $i; if ($pos != $_M['form']['pos']) { $counter = DB::counter($_M['table']['templates'], " WHERE no='{$_M['form']['no']}' and pos='{$pos}' and lang='{$_M['form']['lang']}'", '*'); $no_order = $no_order + $counter; } $query = "\n\t\t\t\t\t\tno = '{$no}',\n\t\t\t\t\t\tpos = '{$pos}',\n\t\t\t\t\t\tno_order = '{$no_order}',\n\t\t\t\t\t\tname = '{$name}',\n\t\t\t\t\t\tdefaultvalue = '{$defaultvalue}',\n\t\t\t\t\t\tvalueinfo = '{$valueinfo}',\n\t\t\t\t\t\ttype\t = '{$type1}',\n\t\t\t\t\t\ttips\t = '{$tips}',\n\t\t\t\t\t\tselectd\t = '{$selectd}',\n\t\t\t\t\t\tstyle\t = '{$style}',\n\t\t\t\t\t\tlang = '{$_M['form']['lang']}'\n\t\t\t\t\t"; if (is_number($id)) { //修改 $query = "UPDATE {$_M['table']['templates']} SET {$query} WHERE id = '{$id}' "; } else { //新增 $query = "INSERT INTO {$_M['table']['templates']} SET value = '{$defaultvalue}', {$query} "; } } elseif ($type == 'del') { //删除 if (is_number($id)) { $query = "DELETE FROM {$_M['table']['templates']} WHERE id='{$id}' and pos = '{$_M['form']['pos']}' and lang='{$_M['form']['lang']}' "; } } DB::query($query); } } /*同步到其它语言*/ $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id"; $tems = DB::get_all($query); foreach ($_M['langlist']['web'] as $key => $val) { if ($key != $_M['form']['lang']) { $query = "DELETE FROM {$_M['table']['templates']} WHERE no='{$_M['form']['no']}' AND lang='{$key}'"; DB::query($query); foreach ($tems as $keytems => $valtems) { $query = "INSERT INTO {$_M['table']['templates']} SET no='{$valtems['no']}',pos ='{$valtems['pos']}',no_order='{$valtems['no_order']}',type='{$valtems['type']}',style='{$valtems['style']}',selectd='{$valtems['selectd']}',name ='{$valtems['name']}',value='{$valtems['value']}',defaultvalue='{$valtems['defaultvalue']}',valueinfo ='{$valtems['valueinfo']}',tips='{$valtems['tips']}',lang='{$key}'"; DB::query($query); } } } /*生成安装文件*/ load::sys_func('file'); $file = "templates/{$_M['form']['no']}/install/install.class.php"; makefile($file); $query = "SELECT * FROM {$_M['table']['skin_table']} where skin_file='{$_M['form']['no']}'"; $tem = DB::get_one($query); $query = "SELECT * FROM {$_M['table']['templates']} where no='{$_M['form']['no']}' AND lang='{$_M['form']['lang']}' ORDER BY no_order,id"; $tems = DB::get_all($query); foreach ($tems as $keytems => $valtems) { $sql[] = "pos ='{$valtems['pos']}',no_order='{$valtems['no_order']}',type='{$valtems['type']}',style='{$valtems['style']}',selectd='{$valtems['selectd']}',name ='{$valtems['name']}',value='{$valtems['defaultvalue']}',defaultvalue='{$valtems['defaultvalue']}',valueinfo ='{$valtems['valueinfo']}',tips='{$valtems['tips']}'"; } $sql_info = var_export($sql, true); $info .= "\n\$sql = {$sql_info};\n\$no='{$_M['form']['no']}';\n\$devices='{$tem['devices']}';"; $str = file_get_contents(PATH_OWN_FILE . 'file/install.class.php'); $str = str_replace('/*<!--sql-->*/', $info, $str); file_put_contents(PATH_WEB . $file, $str); turnover("{$_M[url][own_form]}a=doset&no={$_M['form']['no']}&pos={$_M['form']['pos']}", '操作成功'); }
<tr> <th>Group_ID</th> <th>Group Name</th> </tr> </thead> <tbody> <?php session_start(); include 'functions.php'; $uid = $_SESSION['uid']; $db = new DB(); $table1 = "test_groups"; $result = $db->get_all($table1); while ($arr = mysql_fetch_assoc($result)) { $k[$arr['Group_ID']] = $arr['Group_Name']; } foreach ($k as $key => $value) { ?> <tr> <td><?php echo $key; ?> </td> <td><a href='data_entry_3_pre_back.php?group=<?php echo $key; ?> ' class="col-sm-4 control-label" for="textinput"><?php
function tminisave($have) { global $_M; //新方法 $this->iniclass->tminisave($have); $wap_ok = 0; $cglist = $this->configlist; if ($have['mobile'] == '1') { $have['wap_skin_user'] = $have['met_skin_user']; $have['wap_skin_css'] = $have['met_skin_css']; $cglist = $this->mobile_configlist; //$have['flash_10001'] = $_M['config']['flash_10001']; $have['flash_10001'] = '1|' . $have['met_flash_10001_y']; $wap_ok = 1; } else { /*备用字段*/ $preview['otherinfo']['imgurl1'] = $have['imgurl1']; $preview['otherinfo']['imgurl2'] = $have['imgurl2']; $query = "update {$_M[table][otherinfo]} SET "; for ($i = 1; $i <= 10; $i++) { $infoval = $have['info' . $i]; if (isset($have['info' . $i])) { $query .= "info{$i} = '{$infoval}',"; } } $query .= "\n\t\t\t\timgurl1 = '{$have['imgurl1']}',\n\t\t\t\timgurl2 = '{$have['imgurl2']}'\n\t\t\t\twhere id='{$have['otherinfoid']}'\n\t\t\t"; DB::query($query); load::sys_func('file'); delfile(PATH_WEB . "cache/otherinfo_{$this->lang}.inc.php"); $have['flash_10001'] = '1|' . $have['met_flash_10001_x'] . '|' . $have['met_flash_10001_y'] . '|' . $have['met_flash_10001_imgtype']; } $cglist[] = 'met_productTabok'; $cglist[] = 'met_productTabname'; $cglist[] = 'met_productTabname_1'; $cglist[] = 'met_productTabname_2'; $cglist[] = 'met_productTabname_3'; $cglist[] = 'met_productTabname_4'; configsave($cglist, $have, $this->lang); /*保存系统配置*/ /*保存banner设置*/ $nowidold = array(); $bannerid = DB::get_all("select * from {$_M[table][flash]} where wap_ok='{$wap_ok}' and (module like '%,10001,%' or module = 'metinfo') and lang='{$this->lang}' and img_path!='' order by no_order "); foreach ($bannerid as $key => $val) { $nowidold[] = $val['id']; } $nowidnew = array(); $have['indexbannerlist'] = str_replace("\\", "", $have['indexbannerlist']); $bannerlist = json_decode($have['indexbannerlist'], true); foreach ($bannerlist as $key => $val) { if ($val['img_path'] != '') { if (!strstr($val['img_path'], "../")) { $val['img_path'] = '../' . $val['img_path']; } if ($val['id']) { $query = "update {$_M[table][flash]} SET \n\t\t\t\t\timg_title = '{$val['img_title']}',\n\t\t\t\t\timg_path = '{$val['img_path']}',\n\t\t\t\t\timg_link = '{$val['img_link']}',\n\t\t\t\t\tno_order = '{$key}'\n\t\t\t\t\tWHERE id = '{$val['id']}'"; $nowidnew[] = $val['id']; } else { $query = "INSERT INTO {$_M[table][flash]} SET \n\t\t\t\t\timg_title = '{$val['img_title']}',\n\t\t\t\t\timg_path = '{$val['img_path']}',\n\t\t\t\t\timg_link = '{$val['img_link']}',\n\t\t\t\t\tno_order = '{$key}',\n\t\t\t\t\tmodule = ',10001,',\n\t\t\t\t\twap_ok = '{$wap_ok}',\n\t\t\t\t\tlang = '{$this->lang}'"; } DB::query($query); } } $nowid = array_diff($nowidold, $nowidnew); if ($nowid) { foreach ($nowid as $key => $val) { $query = "delete from {$_M[table][flash]} where id='{$val}'"; DB::query($query); } } }
protected function add_power($no) { global $_M; $query = "SELECT * FROM {$_M['table']['admin_table']} WHERE usertype='3'"; $admins = DB::get_all($query); foreach ($admins as $key => $val) { if (is_strinclude($val['admin_type'], 's1505') && !is_strinclude($val['admin_type'], 'a' . $no)) { $val['admin_type'] = str_replace('s1505', 's1505-a' . $no, $val['admin_type']); $query = "UPDATE {$_M['table']['admin_table']} SET admin_type='{$val['admin_type']}' WHERE id='{$val['id']}'"; DB::query($query); } } }
<?php session_start(); require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'requires.php'; if (!empty($_POST['username']) && !empty($_POST['pwd'])) { $db = new DB(); $sql = "SELECT `id` ,`username` FROM `" . DAPRE . "account` WHERE `password` LIKE '" . md5(trim($_POST['pwd'])) . "'AND `username` LIKE '" . $_POST['username'] . "'"; $result = $db->get_one($sql); if ($result) { // 主用户登陆信息写入 $_SESSION['login'] = true; $_SESSION['parentusername'] = $result['username']; //用户多账号信息写入 $sql = "SELECT `id`, `name` FROM `" . DAPRE . "user` WHERE `parentusername` = '" . $_SESSION['parentusername'] . "'"; $account = $db->get_all($sql); $_SESSION['account'] = $account; //多账户写入account header("Location: home.php"); //初始化完毕。进入用户界面 } else { $result = false; } }
//载入model基础类,其他所有的model都是继承自MODEL类 include_once END_SYSTEM_DIR . 'library/model.php'; //载入当前模块下的config.php if (file_exists(END_MODULE_DIR . 'config.php')) { include_once END_MODULE_DIR . 'config.php'; } //连接数据库 //$db变量会贯穿程序的整个执行过程,以统计整个页面运行了多少次 SQL 查询 $db = new DB(); $db->connect($mysql['server'], $mysql['username'], $mysql['password'], $mysql['database']); //从数据库中读取config信息,覆盖掉$config变量 //这样做的好处就是,在config.php中可以写默认值,可以在后台添加一个同名的设置变量,就可以覆盖该值 if (!is_array($config)) { $config = array(); } $__arr = $db->get_all("SELECT * FROM " . END_MYSQL_PREFIX . "config"); if ($__arr) { foreach ($__arr as $__c) { $config[$__c['name']] = $__c['value']; } } //钩子 function_exists('end_on_after_db') && end_on_after_db(); //发送header声明页面编码 header("CONTENT-TYPE:text/html; CHARSET=" . END_CHARSET); //根据url中的p变量来确定对应的controller $_page = $_GET['p'] ? $_GET['p'] : 'index'; $_page = preg_replace('/[^a-zA-Z0-9_]/', '', $_page); define('END_CONTROLLER', $_page); $_controller = $_page . '.php'; $_viewer = $_page . '.' . END_VIEWER_EXT;
$sql = "DELETE FROM " . DAPRE . "message WHERE id = " . $deletenumber; $db->query($sql); } if (isset($_SESSION['name']) && isset($_SESSION['friendname'])) { // 获取总聊天记录数 $sql = "select count(*) as result_num from chatlog_message where fromname = " . $_SESSION['name'] . " and toname = " . $_SESSION['friendname'] . " and parentusername = '******'parentusername'] . "'"; $result = $db->get_one($sql); // 当结果为0,自动初始化为小于一页的记录 if ($result['result_num'] > 0) { $pg = new page(10, $result['result_num']); } else { $pg = new page(10, 1); } // 获取用户与好友聊天记录 $sql = "select * from chatlog_message where fromname = " . $_SESSION['name'] . " and toname = " . $_SESSION['friendname'] . " and parentusername = '******'parentusername'] . "'and time > " . $_SESSION['searchbytime'] . " order by time desc LIMIT " . $pg->show_page_result() . " , 10"; $message = $db->get_all($sql); } // 处理返回结果给前台 foreach ($message as $key => $item) { // 返回主说话者姓名与被说话者姓名 if ($item['flag']) { $item['fromname'] = $_SESSION['name']; $item['toname'] = $_SESSION['friendname']; } else { $item['fromname'] = $_SESSION['friendname']; $item['toname'] = $_SESSION['name']; } $displaymessage[$key]['fromname'] = $item['fromname']; $displaymessage[$key]['toname'] = $item['toname']; $displaymessage[$key]['message'] = $item['message']; $displaymessage[$key]['time'] = date('Y-m-d h:i:s', $item['time']);
<button>确定</button> <?php include 'include/Db.php'; $dbClass = new DB(); $dbClass->connect('localhost', 'root', '123', 'mynewsql'); //$query="SELECT * FROM 'userinfo' WHERE 1=1"; $sql = "SELECT * from userinfo WHERE 1=1"; //插入1 //$mydata = array('userName'=>'地道'); //print_r($mydata); //$dbClass->insert("userinfo",$mydata); //插入2 //$sqln = "INSERT INTO userinfo('userName') VALUES ('人间道')"; //$sqln = "INSERT INTO userinfo(userName) VALUES ('人间道')"; //$dbClass->query($sqln); $rt = $dbClass->get_all($sql); //print_r($rt);//显示数组 while (list($index, $content) = each($rt)) { //读取二维数组 while (list($key, $val) = each($content)) { ?> <div class="data"> <?php if ($key == "userName") { echo "{$key}: "; echo "{$val}"; } ?> </div> <?php }
public function dohome() { global $_M; /*获取统计数据*/ function statime($ymd, $day = '') { $day = $day == '' ? time() : strtotime($day); $time = strtotime(date($ymd, $day)); return $time; } $stat = array(); for ($i = 1; $i <= 5; $i++) { $stats = $i == 1 ? statime("Y-m-d") : statime("Y-m-d", 0 - $i + 1 . " day"); $query = "select * from {$_M[table][visit_summary]} WHERE stattime ='{$stats}'"; $stat[$i] = DB::get_one($query); if (!$stat[$i]) { $stat[$i]['pv'] = 0; $stat[$i]['alone'] = 0; $stat[$i]['ip'] = 0; } $stat[$i]['day'] = date('Y-m-d', $stats); if ($i == 1) { $stat[$i]['day'] = $_M['word']['today']; } if ($i == 2) { $stat[$i]['day'] = $_M['word']['yesterday']; } } /*图表数据*/ $dm = date('H', time()); $dt = $dm - 8; $dt = $dt < 0 ? $dt + 24 : $dt; for ($i = 0; $i <= 23; $i++) { if ($i <= $dm && $i >= $dt) { $d = $i < 10 ? '0' . $i : $i; $chartdata['labels'][] = "{$d}:59"; } } $chartcolor[0] = "#23b7e5"; $chartcolor[1] = "#7266ba"; $chartcolor[2] = "#23ad44"; foreach ($chartcolor as $key => $val) { $chartdata['datasets'][$key]['fillColor'] = $val; $chartdata['datasets'][$key]['strokeColor'] = $val; $chartdata['datasets'][$key]['pointColor'] = $val; $chartdata['datasets'][$key]['pointStrokeColor'] = '#fff'; } $nowcrt = explode("|", $stat[1]['parttime']); $i = 0; foreach ($nowcrt as $val) { if ($i <= $dm && $i >= $dt) { $aowcrt = ''; if ($val) { $aowcrt = explode("-", $val); $val = array(); $val[0] = $aowcrt[0]; $val[1] = $aowcrt[1]; $val[2] = $aowcrt[2]; } else { $val[0] = 0; $val[1] = 0; $val[2] = 0; } $chartdata['datasets'][0]['data'][] = $val[0]; $chartdata['datasets'][1]['data'][] = $val[1]; $chartdata['datasets'][2]['data'][] = $val[2]; } $i++; } $chartdata = jsonencode($chartdata); /*我的应用*/ $query = "select * from {$_M['table']['admin_column']} where bigclass='44'"; $app_in = DB::get_all($query); $privilege = background_privilege(); require $this->template('tem/home'); }
<?php require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'lib' . DIRECTORY_SEPARATOR . 'requires.php'; require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mcontrol.php'; $db = new DB(); $friends = array(); // print_r($_SESSION['account']); //获取用户好友列表 if (isset($_SESSION['account'])) { foreach ($_SESSION['account'] as $key => $item) { $sql = " SELECT `id` , `toname` FROM `" . DAPRE . "friend` WHERE `fromname` = " . $item['name'] . " and `parentusername` = '" . $_SESSION['parentusername'] . "'"; $friend = $db->get_all($sql); //修改id和name foreach ($friend as $kr => $fr) { $friend[$kr]['touid'] = $fr['toname']; $friend[$kr]['name'] = $fr['toname']; $friend[$kr]['id'] = $fr['toname']; } $friends[$key] = $friend; $friends[$key]['name'] = $item['name']; $friends[$key]['id'] = $item['name']; //id已经没有用了。现在以name来查找 } //echo json_encode($friends[0]); echo json_encode($friends); // print_r($friends); }
die('Curl failed: ' . curl_error($ch)); } curl_close($ch); return $result; } $db = new DB(); if (isset($_POST['message']) && isset($_POST['title']) && isset($_POST['cluster']) && isset($_POST['event_name']) && isset($_POST['type']) && isset($_POST['internalgcmpin'])) { $msg = $_POST['message']; $title = $_POST['title']; $cluster = $_POST['cluster']; $type = $_POST['type']; $event = $_POST['event_name']; $gcmpin = $_POST['internalgcmpin']; if ($gcmpin == $_ENV["INTERNAL_GCM_PIN"]) { $chunk_size = 300; $result = $db->get_all($_ENV["GCM_TABLE"]); $reg_ids = array(); while ($row = mysql_fetch_assoc($result)) { array_push($reg_ids, $row['gcm_id']); } $size = sizeof($reg_ids); $msg_arr = array("text" => $msg, "title" => $title, "cluster" => $cluster, "type" => $type, "event" => $event); $reg_id_chunks = array_chunk($reg_ids, $chunk_size); $db = new DB(); $db->insert($_ENV["MESSAGE_TABLE"], array("message" => $msg, "title" => $title, "type" => $type, "cluster" => $cluster, "event" => $event, "sent_to" => $size)); for ($i = 0; $i < sizeof($reg_id_chunks); $i++) { sendPushNotificationToGCM($reg_id_chunks[$i], $msg_arr); } $response = array("status_code" => 200, "description" => "Success"); echo json_encode($response); } else {
$config = array('db_config' => $dbConfig, 'limit' => intval($_POST['limit'])); //87数据库配置判断 $srcDb = new DB($dbConfig['src_host'], $dbConfig['src_port'], $dbConfig['src_username'], $dbConfig['src_password'], $dbConfig['src_dbname'], $dbConfig['src_dbpre']); //nextwind数据库配置判断 $link = @mysql_connect("{$dbConfig['host']}:{$dbConfig['port']}", $dbConfig['username'], $dbConfig['password'], true); if ($link) { if (!@mysql_select_db($dbConfig['dbname'], $link)) { if (!@mysql_query("CREATE DATABASE " . $dbConfig['dbname'] . " DEFAULT CHARSET=" . $charset, $link)) { showError('数据库' . $dbConfig['dbname'] . ' 创建失败! 请检查是否有权限! '); } } } else { showError("Access denied for user '{$dbConfig['username']}'@'{$dbConfig['host']}' (using password: YES)"); } //获得分表配置 $_list = $srcDb->get_all("SELECT * FROM pw_config WHERE db_name IN ('db_plist','db_tlist')", MYSQL_ASSOC, 'db_name'); $config['db_plist'] = $config['db_tlist'] = array(); foreach ($_list as $_k => $value) { $_list = unserialize($value['db_value']); if (is_array($_list)) { $_list = array_keys($_list); sort($_list); $config[$_k] = $_list; } } //获得ftp配置 $_list = $srcDb->get_all("SELECT * FROM pw_config WHERE db_name LIKE '%ftp%'", MYSQL_ASSOC, 'db_name'); $config['db_ftp'] = array(); $config['db_ftp']['db_ifftp'] = $_list['db_ifftp']['db_value']; if ($_list['db_ifftp']['db_value']) { $config['db_ftp']['db_ftpweb'] = $_list['db_ftpweb']['db_value'];