ok

Mini Shell

Direktori : /home2/selectio/public_html/y1jobportal.in/apps-api/
Upload File :
Current File : /home2/selectio/public_html/y1jobportal.in/apps-api/update-profile.php

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

/*login*/
if ((isset($_POST['type'])) && ($_POST['type'] == 'update_customer')) {
    if (empty(($_POST['state_id']))) {
        $response['error'] = true;
        $response['message'] = "state id required!";
        print_r(json_encode($response));
        return false;
        exit();
    }
    if (empty(($_POST['district_id']))) {
        $response['error'] = true;
        $response['message'] = "district id required!";
        print_r(json_encode($response));
        return false;
        exit();
    }
    if (empty(($_POST['id']))) {
        $response['error'] = true;
        $response['message'] = "id required!";
        print_r(json_encode($response));
        return false;
        exit();
    }
    $firstname = (isset($_POST['firstname']) && !empty(trim($_POST['firstname']))) ? trim($fn->xss_clean($_POST['firstname'])) : '';
    $lastname = (isset($_POST['lastname']) && !empty(trim($_POST['lastname']))) ? trim($fn->xss_clean($_POST['lastname'])) : '';
    $email = (isset($_POST['email']) && !empty(trim($_POST['email']))) ? trim($fn->xss_clean($_POST['email'])) : '';
    $dob = (isset($_POST['dob']) && !empty(trim($_POST['dob']))) ? trim($fn->xss_clean($_POST['dob'])) : '';
    $state_id = (isset($_POST['state_id']) && !empty(trim($_POST['state_id']))) ? trim($fn->xss_clean($_POST['state_id'])) : '';
    $district_id = (isset($_POST['district_id']) && !empty(trim($_POST['district_id']))) ? trim($fn->xss_clean($_POST['district_id'])) : '';
    $city = (isset($_POST['city']) && !empty(trim($_POST['city']))) ? trim($fn->xss_clean($_POST['city'])) : '';
    $address = (isset($_POST['address']) && !empty(trim($_POST['address']))) ? trim($fn->xss_clean($_POST['address'])) : '';
    $gender = (isset($_POST['gender']) && !empty(trim($_POST['gender']))) ? trim($fn->xss_clean($_POST['gender'])) : '';
    $education = (isset($_POST['education']) && !empty(trim($_POST['education']))) ? trim($fn->xss_clean($_POST['education'])) : '';
   
    $id=$_POST['id'];
    $statement = $pdo->prepare("UPDATE `customer` SET process=2,cust_firstname=?,cust_lastname=?,email=?,dob=?,address_line1=?,state_id=?,district_id=?,city=?,gender=?,qualification=? where id=$id");
    $result=$statement->execute(array($firstname,$lastname,$email,$dob,$address,$state_id,$district_id,$city,$gender,$education));
    
    if($result){
        $response["error"]   = false;
        $response["message"] = "Profile Updated Updated";
    }else{
        $response['error'] = true;
        $response['message'] = "Something Went Wrong...";
    }
    print_r(json_encode($response));
    
}else if ((isset($_POST['type'])) && ($_POST['type'] == 'update_category')) {
    if (empty(($_POST['category_id']))) {
        $response['error'] = true;
        $response['message'] = "category_id required!";
        print_r(json_encode($response));
        return false;
        exit();
    }
    if (empty(($_POST['subcategory_id']))) {
        $response['error'] = true;
        $response['message'] = "subcategory_id required!";
        print_r(json_encode($response));
        return false;
        exit();
    }
    if (empty(($_POST['id']))) {
        $response['error'] = true;
        $response['message'] = "id required!";
        print_r(json_encode($response));
        return false;
        exit();
    }
    
    $category_id = (isset($_POST['category_id']) && !empty(trim($_POST['category_id']))) ? trim($fn->xss_clean($_POST['category_id'])) : '';
    $subcategory_id = (isset($_POST['subcategory_id']) && !empty(trim($_POST['subcategory_id']))) ? trim($fn->xss_clean($_POST['subcategory_id'])) : '';
   
    $id=$_POST['id'];
    $statement = $pdo->prepare("UPDATE `customer` SET process=3,category_id=?,subcategory_id=? where id=?");
    $result=$statement->execute(array($category_id,$subcategory_id,$id));
    
    if($result){
        $response["error"]   = false;
        $response["message"] = "You'r Designation is Updated";
    }else{
        $response['error'] = true;
        $response['message'] = "Something Went Wrong...";
    }
    print_r(json_encode($response));
    
}else{
    $response['error'] = true;
    $response['message'] = "Function not Call...";
    print_r(json_encode($response));
}

Zerion Mini Shell 1.0