ok

Mini Shell

Direktori : /home2/selectio/public_html/y1jobportal.in/admin/api/
Upload File :
Current File : /home2/selectio/public_html/y1jobportal.in/admin/api/delete.php

<?php
include_once 'config/config.php';
include_once 'config/custom-functions.php';
include 'config/send-sms.php';
$fn = new custom_functions();


if(isset($_POST['type']) && $_POST['type']=='soft_delete'){
    try{ 
        
        $table = $_POST['table'];
        $delete_id = $_POST['delete_id'];
       
        
        $statement = $pdo->prepare("UPDATE ".$table." SET status=0 WHERE id=".$delete_id);
    	$result = $statement->execute();
    
    	if($result){
		    $response['error']=false;
		    $response['message']="Success";
		}else{
		    $response['error']=true;
		    $response['message']='Failed';
	}
	
	
}catch(Exception $e){
    $response['error']=true;
    $response['message']='Something Went Wrong :'.$e;
    error_log($e);
}   
echo json_encode($response);
}



if(isset($_POST['type']) && $_POST['type']=='hard_delete'){
    try{ 
        
        $table = $_POST['table'];
        $delete_id = $_POST['delete_id'];
       
        
        $statement = $pdo->prepare("DELETE FROM ".$table." WHERE id=".$delete_id);
    	$result = $statement->execute();
    
    	if($result){
		    $response['error']=false;
		    $response['message']="Deleted Success";
		}else{
		    $response['error']=true;
		    $response['message']='Failed';
	}
	
	
}catch(Exception $e){
    $response['error']=true;
    $response['message']='Something Went Wrong :'.$e;
    error_log($e);
}   
echo json_encode($response);

}


if(isset($_POST['type']) && $_POST['type']=='dynamic_active'){
    try{ 
        
        $table_name = $_POST['table'];
        $delete_id = $_POST['delete_id'];
       
        
        $statement = $pdo->prepare("UPDATE ".$table_name." SET status=1 WHERE id=".$delete_id);
    	$result = $statement->execute();
    
    	if($result){
		    $response['error']=false;
		    $response['message']="Success";
		}else{
		    $response['error']=true;
		    $response['message']='Failed';
	}
	
	
}catch(Exception $e){
    $response['error']=true;
    $response['message']='Something Went Wrong :'.$e;
    error_log($e);
}   
echo json_encode($response);

}

if(isset($_POST['type']) && $_POST['type']=='dynamic_in_active'){
    try{ 
        
        $table_name = $_POST['table'];
        $delete_id = $_POST['delete_id'];
       
        
        $statement = $pdo->prepare("UPDATE ".$table_name." SET status=0 WHERE id=".$delete_id);
    	$result = $statement->execute();
    
    	if($result){
		    $response['error']=false;
		    $response['message']="Success";
		}else{
		    $response['error']=true;
		    $response['message']='Failed';
	}
	
	
}catch(Exception $e){
    $response['error']=true;
    $response['message']='Something Went Wrong :'.$e;
    error_log($e);
}   
echo json_encode($response);

}
?>

Zerion Mini Shell 1.0