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/shift-api.php

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

if(isset($_POST['type']) && $_POST['type']=='shift_create'){
     try{
         $shift_name = $_POST['shift_name'];
         $shift_timing = $_POST['shift_timing'];
         
         $statement = $pdo->prepare("INSERT INTO `tbl_shift_details`(`shift_name`, `shift_timing`, `created_by`) VALUES (?,?,?)");
         $result = $statement->execute(array($shift_name, $shift_timing, $session_id));
        
        if($result){    
            $return_arr['message']='Shift Details 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']=='shift_update'){
    error_log("Running");
     try{
         
         $shift_name = $_POST['shift_name'];
         $shift_timing = $_POST['shift_timing'];
         $ids = $_POST['ids'];
         
        $statement = $pdo->prepare("UPDATE `tbl_shift_details` SET `shift_name`=?, `shift_timing`=? WHERE id=?");
        $result = $statement->execute(array($shift_name, $shift_timing, $ids));
        
        if($result){    
            $return_arr['message']='Shift Details 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