ok

Mini Shell

Direktori : /home2/selectio/public_html/vijay-gases/api/
Upload File :
Current File : //home2/selectio/public_html/vijay-gases/api/delete.php

<?php include "../config/config.php";
// Soft Delete Here
if($_POST['type']=="soft_delete"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?");
$result=$statement->execute(array(0,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

// Luggage Tickets Here
if($_POST['type']=="delete_luggage"){
$statement = $pdo->prepare("DELETE FROM `tbl_luggage` WHERE id=?");
$result=$statement->execute(array($_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

if($_POST['type']=="payment_delete"){
    
$statement1 = $pdo->prepare("UPDATE `tbl_sell` SET `paid_amount`=paid_amount-".$_POST['del_amount']." WHERE `id`=".$_POST['del_sell_id']);
$result1=$statement1->execute();


$statement = $pdo->prepare("DELETE FROM ".$_POST['table']." WHERE id=? and type=2");
$result=$statement->execute(array($_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}


/*   Purchase Payment Delete Query Start Here   */


if($_POST['type']=="purchase_payment_delete"){
    
$statement1 = $pdo->prepare("UPDATE `tbl_purchase` SET `paid_amount`=paid_amount-".$_POST['del_amount']." WHERE `id`=".$_POST['del_purchase_id']);
$result1=$statement1->execute();

$statement = $pdo->prepare("DELETE FROM ".$_POST['table']." WHERE id=? and type=1");
$result=$statement->execute(array($_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}


/*    Purchaase Payment Delete Query Ends Here   */



if($_POST['type']=="dynamic_in_active"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?");
$result=$statement->execute(array(0,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

if($_POST['type']=="dynamic_active"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?");
$result=$statement->execute(array(1,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}


if($_POST['type']=="user_delete"){
$statement = $pdo->prepare("UPDATE tbl_user SET status=? WHERE id=?");
$result=$statement->execute(array(0,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

if($_POST['type']=="dynamic_delete"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?");
$result=$statement->execute(array(0,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}
if($_POST['type']=="dynamic_active"){
$statement = $pdo->prepare("UPDATE ".$_POST['table']." SET status=? WHERE id=?");
$result=$statement->execute(array(1,$_POST['delete_id']));
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}




if($_POST['type']=="hard_delete"){
    $id=$_POST['delete_id'];
    $statement = $pdo->prepare("delete from ".$_POST['table']." WHERE id=$id");
    $result=$statement->execute();
if($result==1)
	{
	    $message='Success..';
	    $error='1';
	}
	else
	{
	    $message='Failed..';
	    $error='0';
	}
		$datas[] = array('message' => $message, 'error' => $error);                   
        echo $message;
}

?>

Zerion Mini Shell 1.0