<?php include_once "../includes/main_back_inc.php"; $include = true; //不讓 index.php display的參數 $record["type"] = Now_file(); $cpos["pagecount"] = 30; //每頁顯示筆數 $cpos["table"] = PREFIX . "system_temp"; $cpos["listorderby"] = 'create_date desc'; //列表頁排序方式 $cpos["tablewhere"] = 'id=' . $_GET["id"]; $cpos["search"] = array('account' => 'keyword', 'FILE_URL' => 'keyword', 'create_date' => 'daterange'); //搜尋關聯欄位 $_SESSION["admin_info"]["file_url"] = $cpos["file_url"] = "../upload/products/"; $close["add"] = 0; $close["del"] = 0; $close["edit"] = 0; $close["copy"] = 1; $close["sort"] = 1; //if(@$_POST["act"]=="excel") include_once("excel_products.php"); if ($_GET["deleteall"]) { $am = $conn->Execute("delete from " . $cpos["table"]); //$am = $conn->Execute("drop table ".$cpos["table"]); if ($am) { alert('已重新記錄表單!! ', -1); } exit; } include_once "centerpoes.php"; if ($_GET["id"]) {
include_once APP_PATH . "includes/phpmailer/class.phpmailer.php"; $tpl = new Smarty(); $tpl->left_delimiter = '({'; $tpl->right_delimiter = '})'; $tpl->template_dir = APP_PATH . "templates/"; $tpl->compile_dir = APP_PATH . "templates_c/"; $tpl->config_dir = APP_PATH . "configs/"; $tpl->cache_dir = APP_PATH . "cache/"; //------語系 if ($_GET["lang"] != NULL && $_GET["lang"] != '') { $_SESSION["mode_lang"] = $_GET["lang"]; } else { $_SESSION["mode_lang"] = 'ch'; } $record["lang"] = $post["lang"] = $lang = $_SESSION["member_info"]["lang"] = $_SESSION["mode_lang"]; $page_name = Now_file(); define('LANG', $lang); $mail = new PHPMailer(); // 建立新物件 $mail->IsHTML(true); // 設定郵件內容為HTML $mail->CharSet = "utf-8"; // 設定郵件編碼 $mail->Encoding = "base64"; $mail->WordWrap = 50; // 每50個字元自動斷行 //網站設定 $web_set $sql = " select * from " . PREFIX . "setting WHERE lang = '" . quotes($lang) . "' order by id"; if ($connect_check) { $tmp = $conn->GetArray($sql); }
<?php include_once "../includes/main_back_inc.php"; //print_r(error_get_last()); //func.php 組成menu html樣式 //判斷權限 $menu_list_data = array('_sysmenu_set', 'system_temp', 'index'); if (Auth_check($conn) == false && !in_array(Now_file(), $menu_list_data)) { alert("無權限進入頁面!!", "index.php"); exit; } //左側選單 $menu_html = Make_menu($conn); if ($_SESSION["admin_info"]["open_menu"]) { $menu_html .= "<script>Open_menu('" . $_SESSION["admin_info"]["open_menu"] . "')</script>"; } //網站設定 //$id = $_SETUP["setting_id"][ $record["lang"] ]; $sql = " select * from " . PREFIX . "setting WHERE lang='" . quotes($record["lang"]) . "'"; $set = $conn->GetArray($sql); /*計算使用容量*/ $disk_array = array('0' => 'Bytes', '1' => 'KBytes', '2' => 'MBytes', '3' => 'GBytes', '4' => 'TBytes'); $now_file_disk = disk_data($ini_webset["web_set"]["now_file"]); $now_file_disk = number_format($now_file_disk['data'], 2) . $disk_array[$now_file_disk['depth']]; $max_file_disk = disk_data($ini_webset["web_set"]["upload_max_size"]); $max_file_disk = number_format($max_file_disk['data'], 2) . $disk_array[$max_file_disk['depth']]; $_SESSION["admin_info"]["file_size_total"] = $now_file_disk . ' / ' . $max_file_disk; $_SESSION["admin_info"]["size_bar_width"] = $ini_webset["web_set"]["now_file"] / $ini_webset["web_set"]["upload_max_size"] * 100; $_SESSION["admin_info"]["file_size_bar"] = $ini_webset["web_set"]["upload_check_status"]; /*資料庫使用空間*/ $db_total_disk = 0;
function Auth_check($conn) { $pass = false; //先撈出資料庫中目錄之資料 $sql = " select * from " . PREFIX . "sysmenu WHERE lang='" . $_SESSION["admin_info"]["lang"] . "'"; $menu = $conn->GetArray($sql); //判斷是否有帶著GET值的url 有的另外拉出組成have_get陣列 if ($menu) { foreach ($menu as $k => $v) { if (count(explode("?", $v["url"])) > 1) { $have_get[] = $v["url"]; } } } //抓取現在頁面網址檔案 xxx.php 或 xxx.php?get=xxx $now_url = explode("/", $_SERVER['REQUEST_URI']); $now_url = $now_url[count($now_url) - 1]; //判斷是否有 "?" if (count($temp = explode("?", $now_url)) > 1) { //判斷 "?" 後是否有值 無值便消除問號 有值另外處理 if ($temp[1] == "") { foreach ($menu as $k => $v) { if ($v["url"] == $temp[0]) { $url = $temp[0]; } } } else { //判斷後面所帶的 GET 值 是否為多個 if (count($get_array = explode("&", $temp[1])) > 1) { //現在頁面的 GET 值為複數的話 便與 have_get的 GET 全部比較 //get_array 現在網址 所帶值 //have_get 資料庫中網址 所帶值 if ($have_get && $get_array) { foreach ($have_get as $k => $v) { $tmp = explode("?", $v); $tmp2 = explode("&", $tmp["1"]); //id=lang 為 明細頁 $url_set = 0; foreach ($get_array as $k2 => $v2) { if ($temp[0] == $tmp[0] && $tmp[0] == 'category.php') { $unset_array = array('act', 's_query', 'page', 'id'); $sett = explode('=', $v2); if (in_array($sett[0], $unset_array, 0)) { continue; } } if (stripos($v2, 'id=', 0) !== false || stripos($v2, 'page=', 0) !== false || stripos($v2, 's_', 0) !== false) { continue; } if ($temp[0] == $tmp[0] && in_array($v2, $tmp2) == true) { $url_set = 1; } else { $url_set = 0; } } if ($url_set == 1) { $url = $v; } } } } else { // 比較這一個 GET 值 是否跟 have_get 值相同 if ($have_get) { foreach ($have_get as $k => $v) { if ($v == $now_url) { $url = $v; } } } } // 如果上面都沒設定 url 值 代表可能是 id 或其他可能的值 直接設定為 xxx.php 之值 if ($url == NULL) { $url = $temp[0]; } } } else { //沒有 "?" 值 直接比較 menu 的 url值 foreach ($menu as $k => $v) { if ($v["url"] == $now_url) { $url = $v["url"]; } } } // 只有index.php 不進行判定 將上面設定好的 url 拿來搜尋 menu 得出 lv 值 if ($now_url != "index.php") { //$sql = "select * from ".PREFIX."sysmenu WHERE url='".$url."'"; //$temp = $conn->GetRow($sql); if ($menu) { foreach ($menu as $k => $v) { if ($v["url"] === $url) { $lv = $v["lv"]; $title_name = $v["name"]; //頁面title顯示 //避免 不點選 目錄前往頁面 沒觸發到 Open_menu javascript foreach ($menu as $k2 => $v2) { if ($v2["lv"] == $v["parents"]) { $_SESSION["admin_info"]["open_menu"] = $v2["id"]; } } } } } $auth = explode(",", $_SESSION["admin_info"]["auth"]); //跟 $_SESSION 的 auth 比較 判斷是否有權限讀取此頁 foreach ($auth as $k => $v) { if ($lv == $v || $_SESSION["admin_info"]["control"] == '0' && Now_file() == 'admin_group') { $pass = true; $data_name = $conn->GetRow("select * from " . PREFIX . "sysmenu WHERE lv='" . $lv . "'"); if ($data_name) { $_SESSION["admin_info"]["title"] = $data_name["name"]; //頁面title顯示 } else { $_SESSION["admin_info"]["title"] = $title_name; //頁面title顯示 } } } } else { $pass = true; } return $pass; }