예제 #1
0
            {
                $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;
            }
            $category_id[] = $id;
            //取得項目下的產品ID及刪除產品
            $product_id = get_product_id($category_id);
            if ($product_id != null) {
                if (!del_product($product_id)) {
                    json_encode_return(0, '刪除產品時發生錯誤,請重新操作。', URL_ADMIN2_ROOT . 'category/');
                }
                if (!del_product_meta($product_id)) {
                    json_encode_return(0, '刪除產品描述時發生錯誤,請重新操作。', URL_ADMIN2_ROOT . 'category/');
                }
            }
            //刪除項目
            del_category($category_id) ? json_encode_return(1, '刪除資料完成', URL_ADMIN2_ROOT . 'category/') : json_encode_return(0, '刪除失敗', URL_ADMIN2_ROOT . 'category/');
            break;
        default:
            json_encode_return(0, '流程異常,請重新操作[ACT#2]');
            break;
    }
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);
예제 #2
0
파일: index.php 프로젝트: bcawosxy/pindelta
<?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']);
예제 #3
0
파일: admin.php 프로젝트: bcawosxy/pindelta
<?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']);
예제 #4
0
파일: login.php 프로젝트: bcawosxy/pindelta
}
$query = query_despace('select * from `admin` where `admin_account` = "' . $account . '" and `admin_password` = "' . $password . '"');
$result = mysql_query($query);
//驗證帳秘
if (mysql_num_rows($result) < 1) {
    json_encode_return(0, '帳號或密碼錯誤,請重新輸入。');
} else {
    while ($row = mysql_fetch_array($result)) {
        $_SESSION['admin']['id'] = $row['id'];
        $_SESSION['admin']['account'] = $row['admin_account'];
        //找到此帳號
        $_SESSION['admin']['passwd'] = $row['admin_password'];
        //將密碼丟進去
        $_SESSION['admin']['name'] = $row['admin_name'];
        $_SESSION['admin']['email'] = $row['admin_email'];
    }
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ip = $_SERVER['HTTP_CLIENT_IP'];
    } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
    } else {
        $ip = $_SERVER['REMOTE_ADDR'];
    }
    $query = 'update `admin` set last_login_time = NOW() , 
		last_login_ip = "' . $ip . '"
		where id = "' . $_SESSION['admin']['id'] . '" limit 1;';
    $query = query_despace($query);
    if ($result = mysql_query($query)) {
        json_encode_return(1, '登入成功', URL_ADMIN2_ROOT . 'charts');
    }
}
예제 #5
0
파일: index.php 프로젝트: bcawosxy/pindelta
<?php

$config = dirname(dirname(dirname(__FILE__)));
include $config . '/config/global.php';
include $config . '/config/function_admin2.php';
$class = $_GET['class'];
$function = $_GET['function'];
$file = './' . $class . '/' . $function . '.php';
file_exists($file) ? include $file : json_encode_return(0, 'Bad request!', null);
예제 #6
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']);
예제 #7
0
파일: index.php 프로젝트: bcawosxy/pindelta
<?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] => url, v0[1] => sort , v0[2] => act(on/off) , 
     */
    foreach ($data as $k0 => $v0) {
        $v0[2] = $data[$k0][2];
        if (!is_url($v0[0])) {
            json_encode_return(0, '非法的URL連結 [Error id:' . $v0[0] . ']', URL_ADMIN2_ROOT . 'sociallink');
        }
        $query = 'update `sociallink` set `url` = "' . $v0[0] . '",';
        $query .= '`sort` = "' . $v0[1] . '", `status` = "' . $v0[2] . '", `modifytime` = NOW() where `id`  = "' . ($k0 + 1) . '" ;';
        $result = mysql_query(query_despace($query));
        if (!$result) {
            json_encode_return(0, '修改失敗. [Error id:' . ($k0 + 1) . ']', URL_ADMIN2_ROOT . 'sociallink');
        }
    }
    json_encode_return(1, '修改成功', URL_ADMIN2_ROOT . 'sociallink');
}
header('Content-type: text/html; charset=utf-8');
header('Location: http://' . $_SERVER['SERVER_NAME']);