<?php
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_DEPRECATED);
ob_start();
session_start();
if((($_SERVER['SERVER_ADDR']==$_SESSION['demo_server_ip']) && ($_SERVER['REMOTE_ADDR']!=$_SESSION['demo_developer_ip']) && ($_SESSION['id_user']==$_SESSION['demo_user_id'])) || ($_SESSION['sml_si']!=session_id())) {
    //DEMO CHECK
    die();
}
require_once("../../db/connection.php");
session_write_close();
$id = (int)$_POST['id'];
$query = "DELETE FROM sml_media_library WHERE id=$id;";
$result = $mysqli->query($query);
if($result) {
    $mysqli->query("ALTER TABLE sml_media_library AUTO_INCREMENT = 1;");
    require_once("../../services/clean_images.php");
    ob_end_clean();
    echo json_encode(array("status"=>"ok"));
} else {
    ob_end_clean();
    echo json_encode(array("status"=>"error"));
}