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_sendpush_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"); foreach($_GET as $key => $value) { ${$key}=stripslashes(iconv("utf-8","UTF-8",$value)); } foreach($_POST as $key => $value) { ${$key}=stripslashes(iconv("utf-8","UTF-8",$value)); } ini_set('max_execution_time',86400); include_once("dbconn.php"); include_once("lib.php"); function gcm_push($id,$title,$cont,$gcm_id) { $rsmem=RS("select * from member where id='$id' "); $headers = array('Content-Type:application/json ; charset=UTF-8', 'Authorization:key=AIzaSyB-aWt6UGw7izizkcU5WBLbQ49W5FYSIgE'); $arr = array(); $arr['data'] = array(); $arr['data']['notification'] = array(); $arr['data']['payload'] = "anything you like"; $arr['data']['notification']['alert'] = array(); $arr['data']['notification']['alert']['title'] = stripslashes($title); $arr['data']['notification']['alert']['body'] = stripslashes($cont); $arr['registration_ids'] = array(); $arr['registration_ids'][0] = $gcm_id; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send'); //curl_setopt($ch, CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr)); $response = curl_exec($ch); curl_close($ch); $json=json_decode($response,true); //NotRegistered = 앱삭제 if($json["success"]) { $cont=addslashes(iconv("UTF-8","utf-8",$cont)); mysql_query("insert into push_log set from_memno='0', to_memno='{$rsmem[no]}', to_gcmregid='$gcm_id', msg='$cont', regdate=now(), susin='1', mtype='1', jogun='$jogun', zom2='1',zom2_lang='$lg' ") or die(mysql_error()); } echo "<script>window.close();</script>"; /* $rsmem=RS("select * from member where id='$id' "); $headers = array('Content-Type:application/json ; charset=UTF-8', 'Authorization:key=AIzaSyB-aWt6UGw7izizkcU5WBLbQ49W5FYSIgE'); $arr = array(); $arr['data'] = array(); $arr['data']['text'] = $cont; $arr['data']['title'] = $title; //$arr['data']['user_data'] = array(); //$arr['data']['link'] = iconv("utf-8","UTF-8","http://zo-m.com/Korean/webview/bzom_agree.php"); $arr['data']['msg'] = $cont; //$arr['data']['msg'] = iconv("utf-8","UTF-8",''); $arr['registration_ids'] = array(); $arr['registration_ids'][0] = $gcm_id; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr)); $response = curl_exec($ch); curl_close($ch); $json=json_decode($response,true); //NotRegistered = 앱삭제 if(eregi("NotRegistered",$response)) { mysql_query("update member set push_os=null, zom2_token=null where id='$id' ") or die(); } else if(eregi("InvalidRegistration",$response)) { mysql_query("update member set push_os=null, zom2_token=null where id='$id' ") or die(); } else if($json["results"][0]['registration_id']) { mysql_query("update member set push_os=null, zom2_token=null where id='$id' ") or die(); $cont=addslashes(iconv("UTF-8","utf-8",$cont)); $title=addslashes(iconv("UTF-8","utf-8",$title)); $msg=iconv("UTF-8","utf-8","예전 GCM ID 임"); mysql_query("insert into push_log set from_memno='0', to_memno='{$rsmem[no]}', to_gcmregid='$gcm_id', msg='$cont', title='$title', regdate=now(), susin='1', mtype='1', respon='$msg', is_sudong='1' ") or die(mysql_error()); } else if($json["success"]) { $cont=addslashes(iconv("UTF-8","utf-8",$cont)); $title=addslashes(iconv("UTF-8","utf-8",$title)); mysql_query("insert into push_log set from_memno='0', to_memno='{$rsmem[no]}', to_gcmregid='$gcm_id', msg='$cont', title='$title', regdate=now(), susin='1', mtype='1', is_sudong='1' ") or die(mysql_error()); } echo "<script>window.close();</script>"; */ } $rsmem=RS("select * from member where id='$id' "); if(strtolower($rsmem[zom2_os])=="android") { //echo $rsmem[id].",".$title.",".$cont.",".$rsmem[push_regid]."<br>"; gcm_push($rsmem[id],$title,$cont,$rsmem[zom2_token]); } else { $badge=1; $sound='default'; ios_push($rsmem[id],$cont,$badge,$sound,$rsmem[zom2_token]); } function ios_push($id,$msg,$badge,$sound,$token) { $rsmem=RS("select * from member where id='$id' "); $ch = curl_init(); $data_to_post = array(); $data_to_post['msg'] = stripslashes($msg); $data_to_post['badge'] = $badge; $data_to_post['sound'] = $sound; $data_to_post['token'] = $token; //$par="msg=".$msg."&badge=".$badge."&sound=".$sound."&token=".$token; if($lg=='kor') { curl_setopt($ch, CURLOPT_URL, 'http://zo-m.com/zoajax/push_apn_zom2.php'); } else if($lg=='eng') { curl_setopt($ch, CURLOPT_URL, 'http://zo-m.com/zoajax/push_apn_zom2.php'); } curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, sizeof($data_to_post)); curl_setopt($ch, CURLOPT_POSTFIELDS,$data_to_post); $response = curl_exec($ch); $jsonData=json_decode($response); curl_close($ch); if($jsonData->rst=="1") { $cont=addslashes(iconv("UTF-8","utf-8",$msg)); mysql_query("insert into push_log set from_memno='0', to_memno='{$rsmem[no]}', to_gcmregid='$token', msg='$cont', regdate=now(), susin='1', mtype='1', is_ios='1', jogun='$jogun' , zom2='1',zom2_lang='$lg' ") or die(mysql_error()); } echo "<script>window.close();</script>"; /* $rsmem=RS("select * from member where id='$id' "); $ch = curl_init(); $data_to_post = array(); $data_to_post['msg'] = $msg; $data_to_post['badge'] = $badge; $data_to_post['sound'] = $sound; $data_to_post['token'] = $token; //$par="msg=".$msg."&badge=".$badge."&sound=".$sound."&token=".$token; $par="msg1=".$msg."&badge=".$badge."&sound=".$sound."&token=".$token; mysql_query("insert into tmp_qry set cont='$par', regdate=now() " ) or die(); curl_setopt($ch, CURLOPT_URL, 'https://zo-m.com/zoajax/push_apn.php'); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POST, sizeof($data_to_post)); curl_setopt($ch, CURLOPT_POSTFIELDS,$data_to_post); $response = curl_exec($ch); $jsonData=json_decode($response); curl_close($ch); echo $response; if($jsonData->rst=="1") { $cont=addslashes(iconv("UTF-8","utf-8",$msg)); mysql_query("insert into push_log set from_memno='0', to_memno='{$rsmem[no]}', to_gcmregid='$token', msg='$cont', regdate=now(), susin='1', mtype='1', is_ios='1' ") or die(mysql_error()); } echo "<script>window.close();</script>"; */ } /* $headers = array('Content-Type:application/json ; charset=UTF-8', 'Authorization:key=AIzaSyB-aWt6UGw7izizkcU5WBLbQ49W5FYSIgE'); $rs=RS("select * from member where id='$id' "); $rs_gcm=RS("select * from gcm_regid where mem_id='$id' order by no desc limit 0,1 "); if($curl) { if(eregi("?",$curl)) { $vurl=$curl."&id=".$id; } else { $vurl=$curl."?id=".$id; } $str_vno=base64_encode($vurl."#123,13,222!!!122".nl2br($cont)."#123,13,222!!!122".$id); } else { $str_vno=base64_encode(""."#123,13,222!!!122".nl2br($cont)."#123,13,222!!!122".$id); } $arr = array(); $arr['data'] = array(); $arr['data']['cont'] = iconv("utf-8","UTF-8",nl2br(stripslashes($cont))); $arr['data']['noticont'] = iconv("utf-8","UTF-8",$noticont); $arr['data']['vno'] = iconv("utf-8","UTF-8",$str_vno); $arr['data']['vurl'] = iconv("utf-8","UTF-8",$vurl); $arr['registration_ids'] = array(); $arr['registration_ids'][0] = $rs_gcm[reg_id] ; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, 'https://android.googleapis.com/gcm/send'); curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_POSTFIELDS,json_encode($arr)); $response = curl_exec($ch); //echo $response."\n"; curl_close($ch); if(!eregi("InvalidRegistration",$response)) { mysql_query("insert into gcm_log set from_memno='0', to_memno='{$rs[no]}', to_gcmregid='{$rs_gcm[reg_id]}', msg='$cont', regdate=now(), susin='1', mtype='1', vurl='$vurl' ") or die(mysql_error()); } else { mysql_query("delete from gcm_regid where reg_id='{$rs_gcm[reg_id]}' and appname='zom' ") or die(); } */ //echo "<script>window.close();</script>"; ?>