Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
egg.eemo.co.kr
/
public_html
/
super5
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/egg.eemo.co.kr/public_html/super5/pop_chk_push_send_do.php
<? session_cache_limiter('no-cache, must-revalidate'); session_start(); header("Pragma: no-cache"); header("Cache-Control: no-cache,must-revalidate"); header("Content-Type: text/html; charset=utf-8"); include_once("dbconn.php"); include_once("lib.php"); foreach($_GET as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } foreach($_POST as $key => $value) { ${$key}=mysql_real_escape_string(trim($value)); } $exp_val=explode("&",$str_val); $tokens = array(); foreach($exp_val as $ak => $av) { $rs_vmem=RS("select * from admin_member where no='$av' "); if($rs_vmem[fcm_token]) { $tokens[]=$rs_vmem[fcm_token]; } } function send_notification($tokens, $message) { $url = 'https://fcm.googleapis.com/fcm/send'; $fields = array( 'registration_ids' => $tokens, 'data' => $message ); $key = "AIzaSyCSyMt_dslz98MD0CzbmiiwG4eyGv-E7pc"; $headers = array( 'Authorization:key =' . $key, 'Content-Type: application/json' ); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields)); $response = curl_exec($ch); curl_close($ch); $json=json_decode($response,true); //NotRegistered = 앱삭제 if($json["success"]) { return "success"; } else { return $response; } } //echo "message" . nl2br($cont) ."title" . $title ."mode" . $mode ."sound" . $is_sound."tts" . $tts_cont."istts" . $istts; $message = array("message" => str_replace("\\r\\n","<br>",$cont),"title" => $title,"mode" => $mode,"sound" => $is_sound=="1"?"1":'-1',"tts" => str_replace("\\r\\n"," ",$tts_cont),"istts" => $istts=="1"?"1":'-1'); $rst=send_notification($tokens, $message); if($rst=="success") { //echo "insert into push_send_log set arr_admin_mem_no='$str_val', title='$title', con='$cont', tts_cont='$tts_cont', is_tts='$istts', mode='$mode', is_sound='$is_sound', regdate=now() "; mysql_query("insert into push_send_log set arr_admin_mem_no='$str_val', title='$title', cont='$cont', tts_cont='$tts_cont', is_tts='$istts', mode='$mode', is_sound='$is_sound', regdate=now(), mode2='1' ") or die(mysql_error()); echo "<script>alert('푸시 메시지 발송 성공');</script>"; } else { echo "<script>alert('".$rst."');</script>"; } echo "<script>window.close();</script>"; ?>