Exemplo n.º 1
0
        // check orders..
        $sql = "SELECT * FROM orders where status <> 'deleted' and banner_id=" . $_REQUEST['banner_id'];
        //echo $sql;
        $res = mysql_query($sql) or die(mysql_error());
        if (mysql_num_rows($res) == 0) {
            $sql = "DELETE FROM blocks WHERE banner_id='" . $_REQUEST['banner_id'] . "' ";
            mysql_query($sql) or die(mysql_error() . $sql);
            $sql = "DELETE FROM prices WHERE banner_id='" . $_REQUEST['banner_id'] . "' ";
            mysql_query($sql) or die(mysql_error() . $sql);
            $sql = "DELETE FROM banners WHERE banner_id='" . $_REQUEST['banner_id'] . "' ";
            mysql_query($sql) or die(mysql_error() . $sql);
            // DELETE ADS
            $sql = "select * FROM ads where banner_id='" . $_REQUEST['banner_id'] . "' ";
            $res2 = mysql_query($sql) or die(mysql_error());
            while ($row2 = mysql_fetch_array($res2)) {
                delete_ads_files($row2['ad_id']);
                $sql = "DELETE from ads where ad_id='" . $row2['ad_id'] . "' ";
                mysql_query($sql) or die(mysql_error() . $sql);
            }
            @unlink(SERVER_PATH_TO_ADMIN . "../banners/main" . $_REQUEST['banner_id'] . ".jpg");
            @unlink(SERVER_PATH_TO_ADMIN . "../banners/main" . $_REQUEST['banner_id'] . ".png");
            @unlink(SERVER_PATH_TO_ADMIN . "temp/background" . $_REQUEST['banner_id'] . ".png");
        } else {
            echo "<font color='red'><b>Cannot delete</b></font> - this grid contains some orders in the database.<br>";
        }
    }
}
function get_banner_image_data($b_row, $image_name)
{
    $uploaddir = SERVER_PATH_TO_ADMIN . "temp/";
    //print_r($_FILES);
Exemplo n.º 2
0
function delete_ad($ad_id)
{
    delete_ads_files($ad_id);
    $sql = "delete FROM `ads` WHERE `ad_id`='" . $ad_id . "' ";
    $result = mysql_query($sql) or die(mysql_error() . $sql);
}
Exemplo n.º 3
0
function delete_order($order_id)
{
    global $label;
    $sql = "SELECT * FROM orders where order_id='{$order_id}' ";
    $result = mysql_query($sql) or die(mysql_error());
    $order_row = mysql_fetch_array($result);
    if ($order_row['status'] != 'deleted') {
        $now = gmdate("Y-m-d H:i:s");
        $sql = "UPDATE orders set status='deleted', date_stamp='{$now}' WHERE order_id='" . $order_id . "'";
        mysql_query($sql) or die(mysql_error() . $sql);
        // DELETE BLOCKS
        if ($order_row['blocks'] != '') {
            $sql = "DELETE FROM blocks where order_id='{$order_id}' and banner_id=" . $order_row['banner_id'];
            mysql_query($sql) or die(mysql_error() . $sql);
            /*
            $blocks = explode (",", $order_row['blocks']);
            foreach ($blocks as $key => $val) {
            	if ($val!='') {
            		$sql = "DELETE FROM blocks where block_id='$val' and banner_id=".$order_row['banner_id'];
            		mysql_query ($sql) or die (mysql_error().$sql);
            	}
            
            }
            */
        }
        // DELETE ADS
        if (!function_exists('delete_ads_files')) {
            require_once "ads.inc.php";
        }
        delete_ads_files($order_row['ad_id']);
        $sql = "DELETE from ads where ad_id='" . $order_row['ad_id'] . "' ";
        mysql_query($sql) or die(mysql_error() . $sql);
    }
}