for ($i = 0; $i < $array_count; $i++) { if ($obj->count_subcat($result[$i]['id'])) { array_push($id_categories_havesub, $result[$i]['id']); } else { array_push($id_categories_DontHaveSub, $result[$i]['id']); } } // print_r($id_categories_havesub); // echo "<hr/>"; // print_r($id_categories_DontHaveSub); for ($i = 0; $i < count($id_categories_DontHaveSub); $i++) { $result = $obj->getcategories($id_categories_DontHaveSub[$i]); } try { if (isset($_GET['sub_id'])) { $array_product = $all_product->get_product_sub($_GET['sub_id']); } else { $array_product = $all_product->products(); } } catch (Exception $e) { } } else { echo "<meta http-equiv='Refresh' content='0; url=login.php' />"; // header('Location: http://www.example.com/'); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
// $response['data']=array('user'=>$pro); // $response['status'] = 'OK'; } else { $response['data'] = 'Product not found'; $rest = new product_server(); $rest->handle_response($response['data'], 400); // $response['data'] = 'user not found'; // $response['status'] = 'Bad Request'; } // $json_response = json_encode($response); // echo $json_response; } else { // get all users if (isset($_GET['cat_id'])) { $cat = new Product(); $data = $cat->get_product_sub($_GET['cat_id']); $rest = new product_server(); if (count($data) > 0) { $response['data'] = $data; $rest->handle_response($response['data'], 200); // $response['status']='OK'; // $json_response = json_encode($response); // echo $json_response; } else { $response['data'] = 'Product not found'; $rest->handle_response($response['data'], 400); } } else { $pro = new Product(); $data = $pro->products(); if (count($data) > 0) {