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 : 13.59.116.142


Current Path : /var/www/html/univadmin/
Upload File :
Current File : /var/www/html/univadmin/oums_attapp_notif.php

<?php

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

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

$query = "SELECT fid, fmobappid, ftitle,fmobileno, fbody FROM logisys3_oums.pushnotif 
where ifnull(fmobileno,'') <> ''  
and ifnull(fstatus,'') <> 'T' and ifnull(fmobappid,'') <> ''";

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

if ($count > 0) {

    if($count <50)
    {
        while ($row = mysqli_fetch_assoc($result)) {
            $i = 0;
            $fmobileno = $row['fmobileno'];
            $registrationIds[$i] = $row['fmobappid'];
            // var_dump($registrationIds);
            
            $rgTrimedMobs[$i] = $fmobileno;

            $msg = array(
                'title'    => $row['ftitle'],
                'body'     => $row['fbody'],
                'icon'    => 'ic_launcher'
            );
            // var_dump($registrationIds);
            // var_dump($msg);
            $notifresp = sendNotification($registrationIds, $msg);
            echo $notifresp;
            echo $fmobileno;
            $srtImplodedMobs = implode("','",$rgTrimedMobs); 
            $strUpdateQuery = "update logisys3_oums.pushnotif set fstatus = 'T' 
            where  fmobileno in ('{$srtImplodedMobs}')";
            $result2 = mysqli_query($conn,$strUpdateQuery);
        }

    }else
    {
        $i = 0;
        while ($row = mysqli_fetch_assoc($result)) {
            // $to = $row['mobileno'];
            // $text = $row['fmessage'];
            $fmobileno = $row['fmobileno'];
            $registrationIds[$i] = $row['fmobappid'];
            // var_dump($registrationIds);
            
            $rgTrimedMobs[$i] = $fmobileno;
            
            if($i == 50)
            {
                $msg = array(
                    'title'    => $row['ftitle'],
                    'body'     => $row['fbody'],
                    'icon'    => 'ic_launcher'
                );
                // var_dump($registrationIds);
                // var_dump($msg);
            $notifresp = sendNotification($registrationIds, $msg);
                echo $notifresp;
                echo $fmobileno;
                $srtImplodedMobs = implode("','",$rgTrimedMobs); 
                $strUpdateQuery = "update logisys3_oums.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;
                // break;
            }
            $i++;
        }

        $msg = array(
            'title'    => $row['ftitle'],
            'body'     => $row['fbody'],
            'icon'    => 'ic_launcher'
        );
        // var_dump($registrationIds);
        // var_dump($msg);
        $notifresp = sendNotification($registrationIds, $msg);

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