| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/New folder/New folder/software/Services/PHP/ |
Upload File : |
<?php
function sendMessage($message,$header,$url,$app_id,$player_id){
$content = array(
"en" => $message
);
$headings = array(
"en" => $header
);
$large_icon =$url;
if ($url != ""){
$fields = array(
'app_id' => $app_id,
'include_player_ids' => array($player_id),
'headings' => $headings,
'large_icon' => $large_icon,
'contents' => $content
);
}else{
$fields = array(
'app_id' => $app_id,
'include_player_ids' =>array($player_id),
'headings' => $headings,
'contents' => $content
);
}
$fields = json_encode($fields);
print("\nJSON sent:\n");
print($fields);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://onesignal.com/api/v1/notifications");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json; charset=utf-8'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_HEADER, FALSE);
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
include "general.php";
include "connect.php";
$cnt = 1;
while($cnt ==1){
$id = array();
$player_id;
//check if there is any message to send
$query = "select sn from processpenpalNotifications where status ='0' order by sn limit 1";
//echo $query
$sn =getQuery1($query);
if($sn !="#"){
//get the email
$query = "select email from processpenpalNotifications where sn ='$sn'";
$email =getQuery1($query);
//get the domain
$query = "select domain from processpenpalNotifications where sn ='$sn'";
$domain =getQuery1($query);
//loop playerID
$playerID="";
//check penpalfriends first leg
$query= "select email_f from penpalfriends where email_u='$email' and deleteaccount='0' and domain ='$domain'";
//echo $query;
//$cnt ="#";
$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
// //echo mysqli_error($con);
//echo "-1";
return '#';
die();
}
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
while($row = mysqli_fetch_array($result))
{
//geat the player ID
$query = "select playerID from penpalonesignal where email ='$row[0]'";
$playerID =getQuery1($query);
array_push($id, $playerID);
}//end of loop for $player_ID
//var_dump($id);
}// else
//check penpalfriends for the second leg:
$query= "select email_u from penpalfriends where email_f='$email' and deleteaccount='0' and domain ='$domain'";
//echo $query;
//$cnt ="#";
$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
// //echo mysqli_error($con);
//echo "-1";
return '#';
die();
}
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
while($row = mysqli_fetch_array($result))
{
//geat the player ID
$query = "select playerID from penpalonesignal where email ='$row[0]'";
$playerID =getQuery1($query);
array_push($id, $playerID);
}//end of loop for $player_ID
//var_dump($id);
}// else
// get the fans list;
$query= "select email_u from penpalfollowers where email_f='$email' and deleteaccount='0' and domain ='$domain'";
//echo $query;
//$cnt ="#";
$con=mysqli_connect("127.0.0.1","smsEngine","guEnaR28T","smartsmsrouter");
///Check connection
if (mysqli_connect_errno())
{
// //echo mysqli_error($con);
//echo "-1";
return '#';
die();
}
if(!$result= mysqli_query($con,$query))
{
mysqli_close($con);
return "#";
}
else
{
while($row = mysqli_fetch_array($result))
{
//geat the player ID
$query = "select playerID from penpalonesignal where email ='$row[0]'";
$playerID =getQuery1($query);
array_push($id, $playerID);
}//end of loop for $player_ID
$player_id = array_unique($id);
//var_dump($player_id);
}// else
//define static terms
if($domain =="penpalamerica.com"){
$header = "Penpal America";
$app_id="1bdd80c5-cabb-4296-9e59-ef5fa8638eed";
}
$query = "select photoUpload from penpal where email='$email' and domain='$domain'";
$photoUpload =getQuery1($query);
if($photoUpload=="true"){
$query = "select photo_url1 from penpal where email='$email' and domain='$domain'";
$url =getQuery1($query);
}else{
$url="";
}
$query = "select name from penpal where email='$email' and domain='$domain'";
$name =getQuery1($query);
$query = "select gender from penpal where email='$email' and domain='$domain'";
$gender =getQuery1($query);
if($gender=="M"){
$message= "$name is online, you can chat with him now";
}else{
$message= "$name is online, you can chat with her now";
}
foreach ($player_id as $value){
$response = sendMessage($message,$header,$url,$app_id,$value);
echo $response;
}
$query = "update processpenpalNotifications set status ='1' where sn = $sn ";
$queryresponse = updateQuery($query);
}//end of if stattement
echo "\nWaiting next operation...". date("Y-m-d h:i:s",time())."\n";
sleep(15);
}//end main while
?>