ok

Mini Shell

Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/old/apis/backups/
Upload File :
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/old/apis/backups/tasks.php

<?php 
ob_start();
session_start();
include "../config/config.php";
$session_id = $_SESSION['hrm']['id'];

if(isset($_POST['type']) && $_POST['type']=='task_add'){
    error_log("Running");
     try{
         
         $name = $_POST['task_name'];
         $timing = $_POST['task_timing'];
         $description = $_POST['task_description'];
         $project_id = $_POST['project_id'];
         
         
         $statement = $pdo->prepare("INSERT INTO `tbl_tasks`(`name`, `project_id`, `task_timing`, `description`) VALUES (?,?,?,?)");
         $result = $statement->execute(array($name, $project_id, $timing, $description));
        
        if($result){    
            $return_arr['message']='Task Added Successfully...';
            $return_arr['status']=200;
        } 
        else{
            $return_arr['message']='Something Went Wrong..';
            $return_arr['status']=400;
        }
         
    }catch(PDOException $e){
        $return_arr['message']="$e";
        $return_arr['status']=500;
        }   
    echo json_encode($return_arr);
}

if(isset($_POST['type']) && $_POST['type']=='task_update'){
    error_log("Running");
     try{
         
         $name = $_POST['task_name'];
         $timing = $_POST['task_timing'];
         $description = $_POST['task_description'];
         $project_id = $_POST['project_id'];
         $status = $_POST['status'];
         $ids = $_POST['ids'];
         
        $statement = $pdo->prepare("UPDATE `tbl_tasks` SET `name`=?, `project_id`=?, `task_timing`=?, `description`=?, `status`=? WHERE id=?");
        $result = $statement->execute(array($name, $project_id, $timing, $description, $status, $ids));
        
        if($result){    
            $return_arr['message']='Project Updated Successfully...';
            $return_arr['status']=200;
        } 
        else{
            $return_arr['message']='Something Went Wrong..';
            $return_arr['status']=400;
        }
         
    }catch(PDOException $e){
        $return_arr['message']="$e";
        $return_arr['status']=500;
        }   
    echo json_encode($return_arr);
}

?>

Zerion Mini Shell 1.0