ok
Direktori : /home2/selectio/www/y1jobportal.in/admin/api/ |
Current File : /home2/selectio/www/y1jobportal.in/admin/api/edit-slider.php |
<?php include_once('config/config.php'); include_once('config/custom-functions.php'); include 'config/send-sms.php'; $fn = new custom_functions(); /* ------------------------------------------- APIs for Speedconnect ------------------------------------------- 2. add pickup address 3. Edit pickup address 4. delete pickup address ------------------------------------------- */ if(isset($_POST['type']) && $_POST['type']=='edit_slider'){ try{ $ids = $_POST['ids']; $status = $_POST['status']; if(isset($_FILES['slider_image']) && $_FILES["slider_image"]["name"]!=""){ $file_name = $_FILES['slider_image']['name']; $tmp = explode('.', $file_name); $extension = end($tmp); $photo = rand(10,1000000000)."-image." . $extension; $upload = move_uploaded_file($_FILES['slider_image']['tmp_name'], '../upload/slider/' . $photo); $upload_photo = 'upload/slider/' . $photo; } else{ $upload_photo= $_POST['old_slider_image']; } $statement = $pdo->prepare("UPDATE `tbl_slider` SET `photo`=?, `status`=? WHERE id=?"); $result=$statement->execute(array($upload_photo, $status, $ids)); if($result){ $return_arr['message']='State Updated Successfully...'; $return_arr['status']=200; } else{ $return_arr['message']='Something Went Wrong..'; $return_arr['status']=400; } }catch(PDOException $e){ $return_arr['message']="$e"; error_log("Query Error: ".$e); $return_arr['status']=500; $pdo->rollBack(); } echo json_encode($return_arr); } ?>