ok
Direktori : /proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/old/apis/backups/ |
Current File : //proc/self/root/home2/selectio/www/tnpsctestbatch.com/admin/old/apis/backups/info-g-apis.php |
<?php ob_start(); session_start(); include "../config/config.php"; $session_id = $_SESSION['hrm']['id']; if(isset($_POST['type']) && $_POST['type']=='department_add'){ error_log("Running"); try{ $department = $_POST['department_name']; $status = $_POST['status']; $statement = $pdo->prepare("INSERT INTO `tbl_department` (`department`,`status`) VALUES (?,?)"); $result = $statement->execute(array($department,$status)); if($result){ $return_arr['message']='Department 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']=='department_edit'){ error_log("Running"); try{ $department = $_POST['department_name']; $status = $_POST['status']; $ids = $_POST['ids']; $statement = $pdo->prepare("UPDATE `tbl_department` SET `department`=?, `status`=? WHERE id=?"); $result = $statement->execute(array($department,$status,$ids)); if($result){ $return_arr['message']='Department 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); } if(isset($_POST['type']) && $_POST['type']=='designation_add'){ error_log("Running"); try{ $department = $_POST['department_name']; $designation = $_POST['designation_name']; $status = $_POST['status']; $statement = $pdo->prepare("INSERT INTO `tbl_desgination` (`desgination`,`department_id`,`status`) VALUES (?,?,?)"); $result = $statement->execute(array($designation,$department,$status)); if($result){ $return_arr['message']='Designation 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']=='designation_edit'){ error_log("Running"); try{ $department = $_POST['department_name']; $designation = $_POST['designation_name']; $status = $_POST['status']; $ids = $_POST['ids']; $statement = $pdo->prepare("UPDATE `tbl_desgination` SET `desgination`=?,`department_id`=?,`status`=? WHERE id=?"); $result = $statement->execute(array($designation,$department,$status,$ids)); if($result){ $return_arr['message']='Designation 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); } ?>