Exemple #1
0
function get_nav_category($id = null)
{
    $return = array();
    $query = 'select `category_id`,`category_name` from category where `categoryarea_id` = ' . $id . ' AND `category_status` = "open" order by `category_priority` asc ;';
    $query = query_despace($query);
    $result = mysql_query($query);
    //有'項目'才填充資料 - 讓左側的category項目填滿不用limit
    if (mysql_num_rows($result) > 0) {
        $nav_category = array();
        while ($row = mysql_fetch_array($result)) {
            $nav_category['id'] = $row['category_id'];
            $nav_category['name'] = $row['category_name'];
            $return[] = $nav_category;
        }
    }
    return $return;
}
Exemple #2
0
<?php

if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $value = !empty($_POST['value']) ? $_POST['value'] : null;
    if ($value == null) {
        json_encode_return(0, '未輸入內容');
    }
    $value = stripslashes(htmlspecialchars($value));
    $new_id = 3;
    $query = 'UPDATE `about` SET  `value` =  \'' . $value . '\' , `modify_name` = "' . $_SESSION['admin']['name'] . '" ,`modify_time` = NOW() WHERE  `about`.`id` = "' . $new_id . '" LIMIT 1 ; ';
    $query = query_despace($query);
    $result = mysql_query($query);
    !$result ? json_encode_return(0, '修改失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'about') : json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'about');
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);
Exemple #3
0
<!DOCTYPE html>
<html>
<?php 
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
	<?php 
include '../header.php';
?>
	<?php 
include '../navbar.php';
?>
	<?php 
$query = query_despace('select * from `contact` where status != "delete" order by `inserttime` desc;');
$result = mysql_query($query);
$data = array();
$a_contact_open = array();
$a_contact_archive = array();
while ($row = mysql_fetch_assoc($result)) {
    $data[] = $row;
}
foreach ($data as $k => $v) {
    $v['read'] = $data[$k]['read'] == 'read' ? '<span class="label label-success">Read</span>' : '<span class="label label-warning">Unread</span>';
    if ($v['status'] == 'open') {
        $a_contact_open[] = $v;
    } else {
        $a_contact_archive[] = $v;
    }
}
Exemple #4
0
 function get_product_id(array $category_id)
 {
     $query = 'select `product_id` from product where `product_status` != "delete" and product_category_id IN (' . implode(',', $category_id) . ') ;';
     $query = query_despace($query);
     $result = mysql_query($query);
     $product_id_list = array();
     while ($row = mysql_fetch_assoc($result)) {
         $product_id_list[] = $row['product_id'];
     }
     return !empty($product_id_list) ? $product_id_list : null;
 }
Exemple #5
0
<!DOCTYPE html>
<html>
<?php 
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
	<?php 
include '../header.php';
?>
	<?php 
include '../navbar.php';
?>
	<?php 
$query = query_despace('select * from `admin`;');
$result = mysql_query($query);
if (!$result) {
    redirect_php(URL_ADMIN2_ROOT);
}
$a_admin = array();
while ($row = mysql_fetch_assoc($result)) {
    $a_admin[] = $row;
}
?>
	<div class="content-wrapper">
		<section class="content-header">
			<div class="box-body"><h2>管理員設定</h2></div>
			<h1>				
				<small><p class="text-light-blue">(若不需修改密碼請將該欄位留空)</p></small>
			</h1>
Exemple #6
0
 function del_product_meta(array $product_id_list)
 {
     $query = 'DELETE FROM product_meta WHERE product_id IN (' . implode(',', $product_id_list) . ') ;';
     $query = query_despace($query);
     return mysql_query($query);
 }
Exemple #7
0
$num = 20;
$start_page = ($page - 1) * $num;
//只取有`category`的area且ID不重複
$query = 'select DISTINCT `categoryarea`.`categoryarea_id` AS id , `categoryarea`.`categoryarea_name` AS name, `categoryarea`.`categoryarea_description` AS description ,`categoryarea`.`categoryarea_cover` AS cover
			from category inner join `categoryarea` on `categoryarea`.`categoryarea_id` = `category`.`categoryarea_id` 
			where `categoryarea_status` = "open" and `category`.`category_id` != "" and `category`.`category_status` = "open" 
			order by `categoryarea_priority` 
			asc limit ' . $start_page . ',' . $num . ';';
$query = query_despace($query);
$result = mysql_query($query);
$n_query = $query = 'select DISTINCT `categoryarea`.`categoryarea_id` AS id , `categoryarea`.`categoryarea_name` AS name, `categoryarea`.`categoryarea_description` AS description ,`categoryarea`.`categoryarea_cover` AS cover
			from category inner join `categoryarea` on `categoryarea`.`categoryarea_id` = `category`.`categoryarea_id` 
			where `categoryarea_status` = "open" and `category`.`category_id` != "" and `category`.`category_status` = "open" 
			order by `categoryarea_priority` 
			asc ;';
$n_query = query_despace($n_query);
$n_result = mysql_query($n_query);
$num_rows = mysql_num_rows($n_result);
if (!$result) {
    echo 'Error!';
    exit;
}
$categoryarea = array();
$n = 1;
while ($row = mysql_fetch_array($result)) {
    $categoryarea[$n]['categoryarea_id'] = $row['id'];
    $categoryarea[$n]['categoryarea_name'] = $row['name'];
    $categoryarea[$n]['categoryarea_description'] = $row['description'];
    $categoryarea[$n]['categoryarea_cover'] = $row['cover'];
    $n++;
}
Exemple #8
0
<!DOCTYPE html>
<html>
<?php 
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
	<?php 
include '../header.php';
?>
	<?php 
include '../navbar.php';
?>
	<?php 
$query = query_despace('select * from `categoryarea` where `categoryarea_status` != "delete" order by `categoryarea_insert_time` desc;');
$result = mysql_query($query);
$data = array();
while ($row = mysql_fetch_assoc($result)) {
    $data[] = $row;
}
foreach ($data as $k => $v) {
    $data[$k]['categoryarea_status'] = $data[$k]['categoryarea_status'] == 'open' ? '<span class="label label-success">Open</span>' : '<span class="label label-warning">Close</span>';
}
?>
	<div class="content-wrapper">
		<section class="content-header">
			<div class="box-body"><h2>產品類別管理</h2></div>
			<h1>				
				<small><p class="text-light-blue"></p></small>
			</h1>
Exemple #9
0
<?php

if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $data = !empty($_POST['data']) ? $_POST['data'] : null;
    if ($data == null) {
        json_encode_return(0, '未輸入內容');
    }
    $data = json_decode($data, true);
    /**
     *  v0[0] => admin_account, v0[1] => admin_password , v0[2] => admin_name , v0[3] => admin_email , v0[4] => id 
     */
    foreach ($data as $k0 => $v0) {
        $query = 'update `admin` set `admin_account` = "' . $v0[0] . '",';
        if (!empty($v0[1]) && $v0[1] != '') {
            $query .= '`admin_password` = "' . $v0[1] . '",';
        }
        $query .= '`admin_name` = "' . $v0[2] . '", `admin_email` = "' . $v0[3] . '" where `id`  = "' . $v0[4] . '" ;';
        $result = mysql_query(query_despace($query));
        if (!$result) {
            json_encode_return(0, '修改失敗. [Error id:' . $v0[4] . ']', URL_ADMIN2_ROOT . 'system/admin.php');
        }
    }
    json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'system/admin.php');
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);
Exemple #10
0
<!DOCTYPE html>
<html>
<?php 
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
	<?php 
include '../header.php';
?>
	<?php 
include '../navbar.php';
?>
	<?php 
$query = query_despace('select * from `system`;');
$result = mysql_query($query);
if (!$result) {
    redirect_php(URL_ADMIN2_ROOT);
}
$row = mysql_fetch_assoc($result);
$flat_check = null;
$birman_check = null;
$classic_check = null;
$single_check = null;
$horizontal_check = null;
switch ($row['social_skin']) {
    case 'flat':
        $flat_check = 'checked="true"';
        break;
    case 'birman':
Exemple #11
0
<!DOCTYPE html>
<html>
<?php 
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
	<?php 
include '../header.php';
?>
	<?php 
include '../navbar.php';
?>
	<?php 
$query = query_despace('select `product`.* , `category`.`category_name` from `product` left JOIN `category` on product.product_category_id = category.category_id where `product`.`product_status` != "delete" order by `product_modify_time` desc');
$result = mysql_query($query);
$data = array();
while ($row = mysql_fetch_assoc($result)) {
    $data[] = $row;
}
foreach ($data as $k => $v) {
    $data[$k]['product_status'] = $data[$k]['product_status'] == 'open' ? '<span class="label label-success">Open</span>' : '<span class="label label-warning">Close</span>';
}
?>
	<div class="content-wrapper">
		<section class="content-header">
			<div class="box-body"><h2>產品管理</h2></div>
			<h1>				
				<small><p class="text-light-blue"></p></small>
			</h1>
Exemple #12
0
<!DOCTYPE html>
<html>
<?php 
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
	<?php 
include '../header.php';
?>
	<?php 
include '../navbar.php';
?>
	<?php 
$query = query_despace('select * from `sociallink`;');
$result = mysql_query($query);
if (!$result) {
    redirect_php(URL_ADMIN2_ROOT);
}
$a_sociallink = array();
while ($row = mysql_fetch_assoc($result)) {
    $a_sociallink[] = $row;
}
foreach ($a_sociallink as $k => $v) {
    $a_sociallink[$k]['status'] = $a_sociallink[$k]['status'] == 'open' ? 'On' : 'Off';
}
$a_icon = ['fa-google', 'fa-facebook', 'fa-flickr', 'fa-twitter', 'fa-google', 'fa-instagram', 'fa-linkedin', 'fa-pinterest', 'fa-tumblr'];
?>
	<div class="content-wrapper">
		<section class="content-header">
Exemple #13
0
<!DOCTYPE html>
<html>
<?php 
include '../head.php';
?>
<body class="hold-transition skin-blue sidebar-mini">
<!-- Site wrapper -->
<div class="wrapper">
	<?php 
include '../header.php';
?>
	<?php 
include '../navbar.php';
?>
	<?php 
$query = query_despace('select * from about where id = 3');
$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result)) {
    $data = $row;
}
?>
	
	<div class="content-wrapper">
		<section class="content-header">
			<div class="box-body"><h2>關於品利興</h2></div>
			<h1>				
				<small><p class="text-light-blue">(建議上傳圖片格式: PNG / JPEG / JPG)</p></small>
			</h1>
			<ol class="breadcrumb">
				<li><a href="<?php 
echo URL_ADMIN2_ROOT;
Exemple #14
0
/**
 * 0108 透過product_id取得前台產品的連結網址
 */
function get_product_url($id = null)
{
    $return = null;
    if ($id != null) {
        $query = query_despace('select * from `product` where `product_id` = ' . $id . ' ;');
        $result = mysql_query($query);
        $product = mysql_fetch_assoc($result);
        if (empty($product)) {
            return $return;
        }
        $query = query_despace('select * from `category` where `category_status` = "open" and `category_id` = ' . $product['product_category_id'] . ' ;');
        $result = mysql_query($query);
        $category = mysql_fetch_assoc($result);
        if (empty($category)) {
            return $return;
        }
        $query = query_despace('select * from `categoryarea` where `categoryarea_status` = "open" and `categoryarea_id` = ' . $category['categoryarea_id'] . ' ;');
        $result = mysql_query($query);
        $categoryarea = mysql_fetch_assoc($result);
        if (empty($categoryarea)) {
            return $return;
        }
        $param = 'goods=' . base64_encode($categoryarea['categoryarea_id']) . '&category=' . base64_encode($category['category_id']) . '&items=' . base64_encode($product['product_id']);
        $return = '<a target="_blank" href="' . URL_ROOT . 'product?' . $param . '">' . $product['product_name'] . '</a>';
    }
    return $return;
}
Exemple #15
0
<?php

if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $contact_id = !empty($_POST['contact_id']) ? $_POST['contact_id'] : null;
    $act = !empty($_POST['act']) ? $_POST['act'] : null;
    if ($contact_id == null || $act == null) {
        json_encode_return(0, '[Error] 資料錯誤請重新操作');
    }
    switch ($act) {
        case 'archive':
            $query = query_despace('UPDATE `contact` SET `status` = "archive" where `id` = "' . $contact_id . '" limit 1');
            $result = mysql_query($query);
            !$result ? json_encode_return(0, '修改失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'contact/content.php?contact_id=' . $contact_id) : json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'contact/content.php?contact_id=' . $contact_id);
            break;
        case 'delete':
            $query = query_despace('UPDATE `contact` SET `status` = "delete" where `id` = "' . $contact_id . '" limit 1');
            $result = mysql_query($query);
            !$result ? json_encode_return(0, '刪除資料失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'contact') : json_encode_return(1, '刪除資料成功', URL_ADMIN2_ROOT . 'contact');
            break;
    }
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);
Exemple #16
0
<?php

if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
    $inquiry_id = !empty($_POST['inquiry_id']) ? $_POST['inquiry_id'] : null;
    $act = !empty($_POST['act']) ? $_POST['act'] : null;
    if ($inquiry_id == null || $act == null) {
        json_encode_return(0, '[Error] 資料錯誤請重新操作');
    }
    switch ($act) {
        case 'archive':
            $query = query_despace('UPDATE `inquiry` SET `status` = "archive" where `id` = "' . $inquiry_id . '" limit 1');
            $result = mysql_query($query);
            !$result ? json_encode_return(0, '修改失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'inquiry/content.php?inquiry_id=' . $inquiry_id) : json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'inquiry/content.php?inquiry_id=' . $inquiry_id);
            break;
        case 'delete':
            $query = query_despace('UPDATE `inquiry` SET `status` = "delete" where `id` = "' . $inquiry_id . '" limit 1');
            $result = mysql_query($query);
            !$result ? json_encode_return(0, '刪除資料失敗,請確認您輸入的資料是否有誤', URL_ADMIN2_ROOT . 'inquiry') : json_encode_return(1, '刪除資料成功', URL_ADMIN2_ROOT . 'inquiry');
            break;
    }
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);