예제 #1
0
echo "<input type=\"hidden\" name=\"sort_by\" id=\"sort_by\" class=\"hidden\" value=\"" . $sort_by . "\" /> \n";
echo "<input type=\"hidden\" name=\"search\" id=\"search\" class=\"hidden\" value=\"" . $search_parameter . "-" . $search_value . "\" /> \n";
// DATA VARIABLE
$inspiration_id = $_POST['inspiration_id'];
// LISTING ACTION
if (isset($_POST['btn_index_inspiration'])) {
    if (!empty($inspiration_id)) {
        // DELETE
        if ($_POST['option-action'] == "delete") {
            foreach ($inspiration_id as $inspiration_id) {
                // DELETING IMAGES
                delete_inspiration_image($inspiration_id);
                // DELETING FEATURED
                delete_inspiration_featured($inspiration_id);
                // DELETING INSPIRATION
                delete_inspiration($inspiration_id);
            }
            $_SESSION['alert'] = "success";
            $_SESSION['msg'] = "Success delete item(s)";
        } else {
            if ($_POST['option-action'] == "visibility") {
                foreach ($inspiration_id as $inspiration_id) {
                    $get_data = get_inspiration($inspiration_id);
                    // PREDEFINED VALUE
                    $name = "";
                    $description = "";
                    $active = "";
                    $visibility = $_POST['option-option'];
                    if ($visibility == "yes") {
                        update_inspirations(1, $inspiration_id);
                    } else {
예제 #2
0
<?php

include "../../../static/general.php";
include "../../../../static/general.php";
// DEFINED VARIABLE
$ajx_id = $_POST['bid'];
function get_inspiration($post_ins_id)
{
    $conn = connDB();
    $sql = "SELECT * FROM tbl_inspiration_image WHERE `inspiration_image_id` = '{$post_ins_id}'";
    $query = mysql_query($sql, $conn);
    $result = mysql_fetch_array($query);
    return $result;
}
function delete_inspiration($post_ins_id)
{
    $conn = connDB();
    $sql = "DELETE FROM tbl_inspiration_image WHERE `inspiration_image_id` = '{$post_ins_id}'";
    $query = mysql_query($sql, $conn);
    $result = mysql_fetch_array($query);
    return $result;
}
// CALL FUNCTION
$get_inspiration = get_inspiration($ajx_id);
if (!empty($ajx_id)) {
    unlink("../../../../../" . $get_inspiration['image']);
    delete_inspiration($ajx_id);
}