?????????????? ?????????????? ?????????????? ?????????????? query($sql1); // if ($result->num_rows == 0) { if(mysqli_num_rows($result)==0){ $sql = "INSERT INTO tracking_data (uid, emailTo,emailFrom,subject,event_type,sendTime,rereadcount) VALUES ('$uid', '$emailTo','$emailFrom','$subject','$eventType','$sendTime',0)"; if (mysqli_query($con, $sql)) { echo "Data Inserted"; } else { echo "Error: " . $sql . "
" . $con->error; } } }else{ $sql1 = "SELECT *FROM tracking_data WHERE uid='$uid'"; $result2= mysqli_query($con,$sql1); for ($i = 0; $i < mysqli_num_rows($result2); $i++) { $row = mysqli_fetch_assoc($result2); $count1 = $row["rereadcount"] + 1; $sql = "UPDATE tracking_data SET rereadcount = rereadcount + 1 WHERE uid = '$uid'"; $result = mysqli_query($con, $sql); $result1= $query=mysqli_query($con,"SELECT * FROM user WHERE email='$emailFrom' LIMIT 1"); if(mysqli_num_rows($result1)>=1) { $row= mysqli_fetch_assoc($result1); $token =$row["token"]; $body1 = 'The Email you have send to '.$emailTo.' at '.$sendTime.' has been read.'; //$count1 = $_GET['rereadcount'] + 1; echo $body1; // echo $count1; $body_encoded = urlencode($body1); $send_notification_url = 'http://192.168.100.200/php/send_notifications.php?token='.$token.'&title=EmailRead&body='.$body_encoded.'¬ificationType=Email%20Read&readCount='.$count1.''; // $response1 = file_get_contents($send_notification_url); // Initialize cURL //$encoded_url = urlencode($send_notification_url); //echo $encoded_url $ch = curl_init(); // Set the URL and other cURL options curl_setopt($ch, CURLOPT_URL, $send_notification_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $notification_params = array( 'token' => $token, 'title' => 'Email Read', 'body' => $body1, 'notificationType' => 'EmailRead', 'readCount' => $count1, ); $notification_params_query = http_build_query($notification_params); $send_notification_url_with_params = $send_notification_url . '?' . $notification_params_query; // Send the GET request and get the response $response = curl_exec($ch); } break; // exit the loop after processing the first row } $con->close(); } else { echo "Error: email and uniqueId parameters are required"; } ?>