ok
Direktori : /home2/selectio/public_html/saew.in/admin/api/ |
Current File : /home2/selectio/public_html/saew.in/admin/api/delete.php |
<?php include"../config/config.php"; if($_POST['type']=="consignor_delete"){ $statement = $pdo->prepare("UPDATE tbl_consignor 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']=="consignee_delete"){ $statement = $pdo->prepare("UPDATE tbl_consignee 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']=="department_delete"){ $statement = $pdo->prepare("UPDATE tbl_departement 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']=="leave_request_delete"){ $statement = $pdo->prepare("UPDATE tbl_leave_request 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']=="permission_delete"){ $statement = $pdo->prepare("UPDATE tbl_permision_request 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']=="role_delete"){ $statement = $pdo->prepare("UPDATE tbl_role 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']=="mobile_delete"){ $statement = $pdo->prepare("UPDATE tbl_employee 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']=="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']=="location_delete"){ $statement = $pdo->prepare("UPDATE tbl_exp_location 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']=="category_delete"){ $statement = $pdo->prepare("UPDATE tbl_category 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']=="dynamic_followup_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_follow_up WHERE id=$id;delete from tbl_follow_up_tracking WHERE follow_up_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; } if($_POST['type']=="dynamic_followup_history_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_follow_up_tracking 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; } if($_POST['type']=="dynamic_lead_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_lead WHERE id=$id;delete from tbl_payment WHERE lead_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; } if($_POST['type']=="dynamic_lead_payment_history_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from tbl_payment 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; } if($_POST['type']=="hard_delete"){ $id=$_POST['delete_id']; if(isset($_POST['image'])){ unlink("../".$_POST['image']); } $statement = $pdo->prepare("delete from ".$_POST['table_name']." 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; } /*HARD DELETE OF EVENT NEWS CONTENT START*/ if($_POST['type']=="news_delete"){ $id=$_POST['delete_id']; $statement = $pdo->prepare("delete from ".$_POST['table_name']." 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; } /*HARD DELETE OF EVENT NEWS CONTENT END*/ ?>