ok
Direktori : /home2/selectio/www/y1jobportal.in/apps-api/ |
Current File : //home2/selectio/www/y1jobportal.in/apps-api/get-company-list.php |
<?php include_once('config/config.php'); include_once('config/custom-functions.php'); include 'config/send-sms.php'; $fn = new custom_functions(); date_default_timezone_set('Asia/Kolkata'); $today=date('d-m-Y h:m:s A'); try{ $client_id=0;$client_name=''; $where = ''; $offset = (isset($_POST['offset']) && !empty(trim($_POST['offset'])) && is_numeric($_POST['offset'])) ? trim($fn->xss_clean($_POST['offset'])) : 0; $limit = (isset($_POST['limit']) && !empty(trim($_POST['limit'])) && is_numeric($_POST['limit'])) ? trim($fn->xss_clean($_POST['limit'])) : 5; $sort = (isset($_POST['sort']) && !empty(trim($_POST['sort']))) ? trim($fn->xss_clean($_POST['sort'])) : 'id'; $order = (isset($_POST['order']) && !empty(trim($_POST['order']))) ? trim($fn->xss_clean($_POST['order'])) : 'DESC'; $id = (isset($_POST['id']) && !empty(trim($_POST['id']))) ? trim($fn->xss_clean($_POST['id'])) : ''; $date=date('Y-m-d'); $conditions=''; if($id!=''){ $conditions.=" and emp_id='".$id."'"; } $total_=0; $statement = $pdo->prepare("SELECT COUNT(id) as total,(select count(id) from client where plan_id=1 $conditions ) as none FROM `client` where 1=1 $conditions"); $statement->execute(); $res = $statement->fetchAll(PDO::FETCH_ASSOC); if (isset($_POST['search']) && !empty($_POST['search'])) { $search = $fn->xss_clean($_POST['search']); $conditions .= " and company_name like '%" . $search . "%' OR mobile like '%" . $search . "%'"; } if (!empty($res)) { foreach ($res as $row) $total = $row['total']; $total_=$row['none']; $sql=''; $sql.="SELECT id,firstname,lastname,mobile,gender,email,company_name,logo,address_line1 as address,password,category_id,state_id,district_id,business_type,payment_status,(select name from category where id=client.category_id) as category_name, (select name from subscription where id=client.plan_id) as plan_name, (select amount from subscription where id=client.plan_id) as amount, (select name from follow_up_status where id=client.follow_up_id) as follow_up_name, latitude,longitude,dynamic_address,plan_id,follow_up_id FROM client where id!=0 "; $statement = $pdo->prepare($sql. $conditions . "order by id desc LIMIT " . $offset . ", " . $limit); $statement->execute(); $res = $statement->fetchAll(PDO::FETCH_ASSOC); $t=0; foreach($res as $rs){ if($rs['logo']==""){$rs['logo']="/upload/y1.png";} $res[$t]['logo']=$site_url.$rs['logo']; //$res[$t]['current_plan']='SILVER'; if($rs['payment_status']==1){ $res[$t]['payment_status']='Received'; }else{ $res[$t]['payment_status']='Payment Pending'; } if($rs['latitude']==''){ $res[$t]['latitude']="0";} $t++; } $response['error'] = false; $response['message'] = "Client fatched successfully."; $response['total'] = $total; $response['total_company'] = $total; $response['total_pending'] = $total_; $response['data'] = $res; } else { $response['error'] = true; $response['message'] = "Something went wrong, please try again leter."; } $pdo = null; print_r(json_encode($response)); }catch(Exception $e){ $response["error"] = true; $response["status_code"] = '403'; $response["status"] = 'Forbidden'.$e; $pdo = null; print_r(json_encode($response)); return 0; } ?>