$value) { if($header=="PAAYASMILKAPPV1") { $httpHeader=$value; } } if($httpHeader!="MakeInGtracAppV1") { die(); }*/ if($_GET) { $masterObj = new master(); $data = array(); if(empty($_GET['token'])) { $arr=array ( 'status' => 0, 'message' => "Feilds are Empty. Kindly Check.", ); array_push($data,$arr); } else { $groupid = addslashes($_GET['token']); $userid = addslashes($_GET['userid']); if($groupid=="54470" || $groupid=="59278" || $groupid=="50225" ) { $groupid = 6364; } //echo $userid; $getalrts = $masterObj->getAlertsforpopups($groupid); //echo "SELECT users.id as user_id,mobile_app_token matrix.users WHERE users.id='".$userid."' and users.sys_active=1";die; //db__select_staging62("SELECT users.id as user_id,mobile_app_token matrix.users WHERE users.id='".$userid."' and users.sys_active=1", $condition); $servername = "203.115.101.62"; $username = "website"; $password = "web@web1234"; $dbname = "matrix"; // Create connection $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } echo $sql = "SELECT users.id as user_id, mobile_app_token FROM matrix.users WHERE users.id = '$userid' AND users.sys_active = 1"; $result = $conn->query($sql); if ($result && $result->num_rows > 0) { $row = $result->fetch_assoc(); $mobileToken=$row['mobile_app_token']; } else { //echo "No user found or inactive user."; } //$conn->close(); print_R($mobileToken);die; if (count($getalrts) > 0) { $response = array( 'status' => 200, 'alerts' => $getalrts, 'user_tokens' => $mobileToken ); } else { $response = array( 'status' => 404, 'message' => "No Alerts Found.", 'user_tokens' => $mobileToken // You can still include this if needed ); } echo json_encode($response); die; } } ?>