Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 18.63 KB | None | 0 0
  1. <?php
  2.  
  3. class GameController extends Controller
  4. {
  5.     /**
  6.      * Declares class-based actions.
  7.      */
  8.    public function filters()
  9.     {
  10.         return array(
  11.             'accessControl', // perform access control for CRUD operations
  12.         );
  13.     }
  14.  
  15.     /**
  16.      * Specifies the access control rules.
  17.      * This method is used by the 'accessControl' filter.
  18.      * @return array access control rules
  19.      */
  20.     public function accessRules()
  21.     {
  22.         return array(
  23.             array('allow',  // allow all users to perform 'index' and 'view' actions
  24.                 'actions'=>array('Login','PointFromPengawas','PointFromMap','GetCooldown','AddHistoriPemain',
  25.             'SetFaraway','CheckUpdate','PointFromPhoto','PointFromLocation','PointFromReading','Leaderboard','SubmitScore',
  26.             'SendMessage','CheckMessage','NewMessage','GetMessage','UpdateLocation'),
  27.                 'users'=>array('*'),
  28.             ),
  29.             array('allow', // allow authenticated user to perform 'create' and 'update' actions
  30.                 'actions'=>array('*'),
  31.                 'users'=>array('*'),
  32.             ),
  33.             array('allow', // allow admin user to perform 'admin' and 'delete' actions
  34.                 'actions'=>array('*'),
  35.                 'users'=>array('*'),
  36.             ),
  37.             array('deny',  // deny all users
  38.                 'users'=>array('*'),
  39.             ),
  40.         );
  41.     }
  42.  
  43.     public function actionSendMessage(){
  44.         if(isset($_POST['external'])){
  45.             $username = $_POST['username'];
  46.             $receiver = $_POST['receiver'];
  47.             $content = $_POST['content'];
  48.        
  49.             $new = new Message;
  50.             $new->tanggal = new CDbExpression('NOW()');
  51.             $new->sender = $username;
  52.             $new->receiver = $receiver;
  53.             $new->content = $content;
  54.    
  55.             if($new->save()){
  56.                 echo CJSON::encode(array(
  57.                                                     'result'=>'success',
  58.                                                     'data'=>''
  59.                                     ));
  60.             }else{
  61.                 echo CJSON::encode(array(
  62.                                                     'result'=>'failed',
  63.                                                     'data'=>$new->getErrors()
  64.                                     ));
  65.             }
  66.         }else{
  67.           echo "Who are you?";
  68.         }
  69.     }
  70.  
  71.     public function actionNewMessage(){
  72.         if(isset($_POST['external'])){
  73.             $username = $_POST['username'];
  74.             $sender = $_POST['sender'];
  75.        
  76.             $data = Message::Model()->findAll('receiver = "'.$username.'" and sender = "'.$sender.'" and is_read = 0  order by tanggal');
  77.             foreach ($data as $key => $value) {
  78.                 $value->is_read = 1;
  79.                 $value->save();
  80.             }
  81.            
  82.             if(count($data) > 0){
  83.                 echo CJSON::encode(array(
  84.                                                     'result'=>'success',
  85.                                                     'data'=>$data
  86.                                     ));
  87.             }else{
  88.                 echo CJSON::encode(array(
  89.                                                     'result'=>'failed',
  90.                                                     'data'=>''
  91.                                     ));
  92.             }
  93.         }else{
  94.           echo "Who are you?";
  95.         }
  96.     }
  97.  
  98.     public function actionGetMessage(){
  99.         if(isset($_POST['external'])){
  100.             $username = $_POST['username'];
  101.             $sender = $_POST['sender'];
  102.        
  103.             $data = Message::Model()->findAll('(receiver = "'.$username.'" and sender = "'.$sender.'"  and is_read = 1) or (receiver = "'.$sender.'" and sender = "'.$username.'") order by tanggal');
  104.            
  105.             if(count($data)){
  106.                 echo CJSON::encode(array(
  107.                                                     'result'=>'success',
  108.                                                     'data'=>$data
  109.                                     ));
  110.             }else{
  111.                 echo CJSON::encode(array(
  112.                                                     'result'=>'failed',
  113.                                                     'data'=>'',
  114.                                     ));
  115.             }
  116.         }else{
  117.           echo "Who are you?";
  118.         }
  119.     }
  120.  
  121.     public function actionCheckMessage()
  122.     {
  123.         if(isset($_POST['external'])){
  124.             $username = $_POST['username'];
  125.             $sender = $_POST['sender'];
  126.        
  127.             $count = Yii::app()->db->createCommand()->select('count(*) as jumlah')
  128.                     ->from('message')
  129.                     ->where('is_read = 0 and receiver = "'.$username.'" and sender = "'.$sender.'"')
  130.                     ->queryScalar();
  131.            
  132.             if($count > 0){
  133.                 echo CJSON::encode(array(
  134.                                                     'result'=>'success',
  135.                                                     'data'=>'1'
  136.                                     ));
  137.             }else{
  138.                 echo CJSON::encode(array(
  139.                                                     'result'=>'failed',
  140.                                                     'data'=>'0'
  141.                                     ));
  142.             }
  143.         }else{
  144.           echo "Who are you?";
  145.         }
  146.     }
  147.  
  148.   public function actionLogin()
  149.     {
  150.     if(isset($_POST['external'])){
  151.       $username = $_POST["username"];
  152.       $password = $_POST["password"];
  153.  
  154.       $user = MasterPengawas::model()->find('(username = "'.$username.'" or email = "'.$username.'") and password = "'.$password.'"');
  155.       if($user == null){
  156.  
  157.           $user = MasterPemain::model()->find('(username = "'.$username.'" or email = "'.$username.'") and password = "'.$password.'"');
  158.           if($user == null){
  159.             echo CJSON::encode(array(
  160.                                 'result'=>'failed',
  161.                                 'desc'=>""
  162.                         ));
  163.           }else{
  164.                             //pemain
  165.                             $pengawas = MasterPengawas::model()->find('id = (select id_pengawas from detail_pengawas where id_pemain = '.$user->id.')');
  166.                             $data = $user->attributes;
  167.                             $data['pengawas'] = $pengawas;
  168.                             echo CJSON::encode(array(
  169.                                 'result'=>'success',
  170.                                 'type'=>1,
  171.                                 'data'=>$data
  172.               ));
  173.           }
  174.       }else{
  175.             //pengawas
  176.             $data = $user->attributes;
  177.             echo CJSON::encode(array(
  178.                       'result'=>'success',
  179.                         'type'=>2,
  180.                       'data'=>$data
  181.             ));
  182.       }
  183.     }else{
  184.       echo "Who are you?";
  185.     }
  186.   }
  187.  
  188.     public function actionPointFromPengawas(){
  189.     if(isset($_POST['external'])){
  190.       $from = $_POST['from'];
  191.             $to = $_POST['to'];
  192.             $kode = $_POST['kode'];
  193.             $keterangan = $_POST['keterangan'];
  194.  
  195.             $point = MasterPoint::Model()->find('kode = "'.$kode.'"');
  196.             $pengawas = MasterPengawas::Model()->find('username = "'.$from.'"');
  197.             $pemain = MasterPemain::Model()->find('username = "'.$to.'"');
  198.  
  199.             $new = new HistoriPoint;
  200.             $new->tanggal = new CDbExpression('NOW()');
  201.             $new->id_point = $point->id;
  202.             $new->id_user = $pemain->id;
  203.             $new->id_pengawas = $pengawas->id;
  204.             $new->place_id = '';
  205.             $new->extra = $keterangan;
  206.             $new->jumlah = $point->jumlah;
  207.             $new->is_terima = 0;
  208.  
  209.             if($new->save()){
  210.                 echo CJSON::encode(array(
  211.                                                     'result'=>'success',
  212.                                                     'data'=>'Point berhasil dikirim.'
  213.                                     ));
  214.             }else{
  215.                 echo CJSON::encode(array(
  216.                                                     'result'=>'failed',
  217.                                                     'data'=>$new->getErrors()
  218.                                     ));
  219.             }
  220.     }else{
  221.       echo "Who are you?";
  222.     }
  223.   }
  224.  
  225.     public function actionPointFromMap(){
  226.     if(isset($_POST['external'])){
  227.       $username = $_POST['username'];
  228.             $kode = $_POST['kode'];
  229.             $place = $_POST["place"];
  230.             $namalokasi = $_POST["nama_lokasi"];
  231.  
  232.             $point = MasterPoint::Model()->find('kode = "'.$kode.'"');
  233.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  234.  
  235.             $new = new HistoriPoint;
  236.             $new->tanggal = new CDbExpression('NOW()');
  237.             $new->id_point = $point->id;
  238.             $new->id_user = $pemain->id;
  239.             $new->id_pengawas = 0;
  240.             $new->place_id = $place;
  241.             $new->extra = '';
  242.             $new->jumlah = $point->jumlah;
  243.             $new->is_terima = 1;
  244.  
  245.             if($new->save()){
  246.  
  247.                 $histori = new HistoriPemain;
  248.                 $histori->tanggal = new CDbExpression('NOW()');
  249.                 $histori->isi = 'Mengunjungi '.$namalokasi.' untuk '.$new->jumlah.' point.';
  250.                 $histori->keterangan = '';
  251.                 $histori->extra = '';
  252.                 $histori->id_pemain = $new->id_user;
  253.                 $histori->save();
  254.  
  255.                 if($this->AddSaldo($new->id_user,$new->id_point,$new->jumlah)){
  256.                     if($this->SetStatusLokasi($new->id_user,$new->place_id,$point->cooldown)){
  257.                         echo CJSON::encode(array(
  258.                                                             'result'=>'success',
  259.                                                             'data'=>'Point berhasil didapatkan.'
  260.                                             ));
  261.                     }else{
  262.                         echo CJSON::encode(array(
  263.                                                             'result'=>'failed',
  264.                                                             'data'=>'Menyimpan status gagal.'
  265.                                             ));
  266.                     }
  267.                 }else{
  268.                     echo CJSON::encode(array(
  269.                                                         'result'=>'failed',
  270.                                                         'data'=>'Menyimpan saldo gagal.'
  271.                                         ));
  272.                 }
  273.             }else{
  274.                 echo CJSON::encode(array(
  275.                                                     'result'=>'failed',
  276.                                                     'data'=>$new->getErrors()
  277.                                     ));
  278.             }
  279.     }else{
  280.       echo "Who are you?";
  281.     }
  282.   }
  283.  
  284.   public function actionPointFromLocation(){
  285.     if(isset($_POST['external'])){
  286.         $transaction = Yii::app()->db->beginTransaction();
  287.         $username = $_POST['username'];
  288.         $kode = $_POST['kode'];
  289.         $coordinate = $_POST["coordinate"];
  290.         $lokasi = $_POST["lokasi"];
  291.  
  292.         $point = MasterPoint::Model()->find('kode = "'.$kode.'"');
  293.         $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  294.  
  295.         $new = new HistoriPoint;
  296.         $new->tanggal = new CDbExpression('NOW()');
  297.         $new->id_point = $point->id;
  298.         $new->id_user = $pemain->id;
  299.         $new->data = "LOCATION:".$coordinate;
  300.         $new->extra = $lokasi;
  301.         $new->jumlah = 15;
  302.  
  303.         if($new->save()){
  304.             // $histori = new HistoriPemain;
  305.             // $histori->tanggal = new CDbExpression('NOW()');
  306.             // $histori->isi = 'Mengunjungi '.$namalokasi.' untuk '.$new->jumlah.' point.';
  307.             // $histori->keterangan = '';
  308.             // $histori->extra = '';
  309.             // $histori->id_pemain = $new->id_user;
  310.             // $histori->save();
  311.             $pemain->current_location = $coordinate;
  312.             $pemain->save();
  313.             if($this->AddSaldo($new->id_user,$new->id_point,$new->jumlah)){
  314.                 $transaction->commit();
  315.                 echo CJSON::encode(array(
  316.                                                         'result'=>'success',
  317.                                                         'data'=>$new->jumlah.' poin berhasil diterima.'
  318.                                         ));
  319.             }else{
  320.                 $transaction->rollback();
  321.                 echo CJSON::encode(array(
  322.                                                     'result'=>'failed',
  323.                                                     'data'=>'Menyimpan saldo gagal.'
  324.                                     ));
  325.             }
  326.         }else{
  327.             $transaction->rollback();
  328.             echo CJSON::encode(array(
  329.                                                 'result'=>'failed',
  330.                                                 'data'=>$new->getErrors()
  331.                                 ));
  332.         }
  333.     }else{
  334.       echo "Who are you?";
  335.     }
  336.   }
  337.  
  338.     public function AddSaldo($id,$point,$jumlah){
  339.         $saldo = SaldoPoint::Model()->find('id_user = '.$id.' and id_point = '.$point);
  340.         if($saldo == null){
  341.             $saldo = new SaldoPoint;
  342.             $saldo->id_user = $id;
  343.             $saldo->id_point = $point;
  344.             $saldo->jumlah = $jumlah;
  345.         }else{
  346.             $saldo->jumlah = $saldo->jumlah + $jumlah;
  347.         }
  348.         return $saldo->save();
  349.     }
  350.  
  351.     public function SetStatusLokasi($id,$place_id,$cooldown){
  352.             $status = StatusLokasi::Model()->find('id_pemain = '.$id.' and place_id = "'.$place_id.'"');
  353.             if($status == null){
  354.                 $status = new StatusLokasi;
  355.                 $status->id_pemain = $id;
  356.                 $status->place_id = $place_id;
  357.             }
  358.              $status->tgl_cooldown = new CDbExpression('DATE_ADD(NOW(), INTERVAL '.$cooldown.' SECOND)');
  359.              return $status->save();
  360.     }
  361.  
  362.     public function actionGetCooldown(){
  363.         if(isset($_POST['external'])){
  364.             $place = $_POST['place'];
  365.             $username = $_POST['username'];
  366.  
  367.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  368.             $status = StatusLokasi::Model()->find('id_pemain = '.$pemain->id.' and place_id = "'.$place.'"');
  369.  
  370.             if($status != null){
  371.                 $remaining = Yii::app()->db
  372.                 ->createCommand('SELECT TIME_TO_SEC(TIMEDIFF("'.$status->tgl_cooldown.'",(select NOW()))) diff')
  373.                 ->queryScalar();
  374.             }else{
  375.                 $remaining = 0;
  376.             }
  377.  
  378.             echo CJSON::encode(array(
  379.                                                 'result'=>'success',
  380.                                                 'data'=>$remaining
  381.                                 ));
  382.  
  383.         }else{
  384.             echo "Who are you?";
  385.         }
  386.     }
  387.  
  388.  
  389.     public function actionAddHistoriPemain(){
  390.         if(isset($_POST['external'])){
  391.             $username = $_POST['username'];
  392.             $isi = $_POST['isi'];
  393.  
  394.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  395.  
  396.             $histori = new HistoriPemain;
  397.             $histori->tanggal = new CDbExpression('NOW()');
  398.             $histori->isi = $isi;
  399.             $histori->keterangan = '';
  400.             $histori->extra = '';
  401.             $histori->id_pemain = $pemain->id;
  402.  
  403.             if($histori->save()){
  404.                 echo CJSON::encode(array(
  405.                                                     'result'=>'success',
  406.                                                     'data'=>'Histori berhasil disimpan.'
  407.                                     ));
  408.             }else{
  409.                 echo CJSON::encode(array(
  410.                                                     'result'=>'failed',
  411.                                                     'data'=>$new->getErrors()
  412.                                     ));
  413.             }
  414.         }else{
  415.             echo "Who are you?";
  416.         }
  417.     }
  418.  
  419.     public function actionSetFaraway(){
  420.         if(isset($_POST['external'])){
  421.             $username = $_POST['username'];
  422.             $status = $_POST['status'];
  423.  
  424.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  425.  
  426.             $pemain->is_faraway = $status;
  427.  
  428.             if($pemain->save()){
  429.                 echo CJSON::encode(array(
  430.                                                     'result'=>'success',
  431.                                                     'data'=>'Status faraway berhasil disimpan.'
  432.                                     ));
  433.             }else{
  434.                 echo CJSON::encode(array(
  435.                                                     'result'=>'failed',
  436.                                                     'data'=>$pemain->getErrors()
  437.                                     ));
  438.             }
  439.         }else{
  440.             echo "Who are you?";
  441.         }
  442.     }
  443.  
  444.     public function actionUpdateLocation(){
  445.         if(isset($_POST['external'])){
  446.             $username = $_POST['username'];
  447.             $x = $_POST['x'];
  448.             $y = $_POST['y'];
  449.  
  450.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  451.  
  452.             $pemain->current_location = $x.','.$y;
  453.  
  454.             if($pemain->save()){
  455.                 echo CJSON::encode(array(
  456.                                                     'result'=>'success',
  457.                                                     'data'=>'Update lokasi berhasil.'
  458.                                     ));
  459.             }else{
  460.                 echo CJSON::encode(array(
  461.                                                     'result'=>'failed',
  462.                                                     'data'=>$pemain->getErrors()
  463.                                     ));
  464.             }
  465.         }else{
  466.             echo "Who are you?";
  467.         }
  468.     }
  469.  
  470.  
  471.     public function actionCheckUpdate(){
  472.         if(isset($_POST['external'])){
  473.             $username = $_POST['username'];
  474.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  475.  
  476.             $data = array();
  477.  
  478.             $pendingPoints = HistoriPoint::Model()->findAll('is_terima = 0 and id_user = '.$pemain->id);
  479.             if(count($pendingPoints) > 0){
  480.                 foreach ($pendingPoints as $key => $value) {
  481.                     $value->is_terima = 1;
  482.                     if($value->save()){
  483.                             $this->AddSaldo($value->id_user,$value->id_point,$value->jumlah);
  484.                             array_push($data,array(
  485.                                 'tipe'=>'notification',
  486.                                 'from'=>$value->pengawas->nama,
  487.                                 'isi'=>$value->extra
  488.                             ));
  489.                     }
  490.                 }
  491.             }
  492.  
  493.             if(count($data) > 0){
  494.                 echo CJSON::encode(array(
  495.                                                     'result'=>'success',
  496.                                                     'data'=>$data
  497.                                     ));
  498.             }else{
  499.                 echo CJSON::encode(array(
  500.                                                     'result'=>'failed',
  501.                                                     'data'=>"Tidak ada data"
  502.                                     ));
  503.             }
  504.         }else{
  505.             echo "Who are you?";
  506.         }
  507.     }
  508.  
  509.     public function actionPointFromPhoto(){
  510.         if(isset($_POST['external'])){
  511.             $transaction = Yii::app()->db->beginTransaction();
  512.  
  513.             $username = $_POST['username'];
  514.             $kode = $_POST['kode'];
  515.            
  516.             $point = MasterPoint::Model()->find('kode = "'.$kode.'"');
  517.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  518.  
  519.             $new = new HistoriPoint;
  520.             $new->tanggal = new CDbExpression('NOW()');
  521.             $new->id_point = $point->id;
  522.             $new->id_user = $pemain->id;
  523.             $new->extra = $username;
  524.             $new->jumlah = 10;
  525.             $photo=CUploadedFile::getInstanceByName('photo');
  526.             $name = md5(date('Y-m-d h:i:s').$username).".".$photo->extensionName;
  527.             if(!empty($photo)){
  528.                 $new->data="PHOTO:".$name;
  529.             }else{$new->data=null;}
  530.  
  531.             if($new->save()){
  532.                 if(!empty($photo)){
  533.                   $photo->saveAs(Yii::app()->basePath.'/../images/pemain/'.$name);  // image will uplode to rootDirectory/
  534.                 }
  535.                 if($this->AddSaldo($new->id_user,$new->id_point,$new->jumlah)){
  536.                     $transaction->commit();
  537.                     echo CJSON::encode(array(
  538.                                                     'result'=>'success',
  539.                                                     'data'=>$new->jumlah.' poin berhasil diterima.'
  540.                                     ));
  541.                 }else{
  542.                     $transaction->rollback();
  543.                     echo CJSON::encode(array(
  544.                                                     'result'=>'failed',
  545.                                                     'data'=>'error'
  546.                                     ));
  547.                 }
  548.                
  549.             }else{
  550.                 $transaction->rollback();
  551.                 echo CJSON::encode(array(
  552.                                                     'result'=>'failed',
  553.                                                     'data'=>$new->getErrors()
  554.                                     ));
  555.             }
  556.         }else{
  557.           echo "Who are you?";
  558.         }
  559.     }
  560.  
  561.     public function actionPointFromReading(){
  562.         if(isset($_POST['external'])){
  563.             $transaction = Yii::app()->db->beginTransaction();
  564.  
  565.             $username = $_POST['username'];
  566.             $kode = $_POST['kode'];
  567.            
  568.             $point = MasterPoint::Model()->find('kode = "'.$kode.'"');
  569.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  570.  
  571.             $new = new HistoriPoint;
  572.             $new->tanggal = new CDbExpression('NOW()');
  573.             $new->id_point = $point->id;
  574.             $new->id_user = $pemain->id;
  575.             $new->data = "READ:500";
  576.             $new->jumlah = 25;
  577.            
  578.             if($new->save()){
  579.                 if($this->AddSaldo($new->id_user,$new->id_point,$new->jumlah)){
  580.                     $transaction->commit();
  581.                     echo CJSON::encode(array(
  582.                                                         'result'=>'success',
  583.                                                         'data'=>$new->jumlah.' poin berhasil diterima.'
  584.                                         ));
  585.                 }else{
  586.                     $transaction->rollback();
  587.                     echo CJSON::encode(array(
  588.                                                         'result'=>'failed',
  589.                                                         'data'=>'error'
  590.                                         ));
  591.                 }
  592.             }else{
  593.                 $transaction->rollback();
  594.                 echo CJSON::encode(array(
  595.                                                     'result'=>'failed',
  596.                                                     'data'=>$new->getErrors()
  597.                                     ));
  598.             }
  599.         }else{
  600.           echo "Who are you?";
  601.         }
  602.     }
  603.  
  604.     public function actionSubmitScore(){
  605.         if(isset($_POST['external'])){
  606.             $transaction = Yii::app()->db->beginTransaction();
  607.  
  608.             $username = $_POST['username'];
  609.             $score = $_POST['score'];
  610.            
  611.             $pemain = MasterPemain::Model()->find('username = "'.$username.'"');
  612.             if($score > $pemain->score)
  613.             {
  614.                 $pemain->score = $score;
  615.                 $result = $pemain->save();
  616.             }else{
  617.                 $result = TRUE;
  618.             }
  619.  
  620.             if($result){
  621.                 $saldo = SaldoPoint::Model()->findAll('id_user = '.$pemain->id);
  622.                 foreach ($saldo as $key => $each) {
  623.                     $each->jumlah = 0;
  624.                     $each->save();
  625.  
  626.                     $new = new HistoriPoint;
  627.                     $new->tanggal = new CDbExpression('NOW()');
  628.                     $new->id_point = $each->id_point;
  629.                     $new->id_user = $pemain->id;
  630.                     $new->data = "GAME:".$score;
  631.                     $new->jumlah = 0;
  632.                     $new->save();
  633.                 }
  634.                 $transaction->commit();
  635.                 echo CJSON::encode(array(
  636.                                     'result'=>'success',
  637.                                     'data'=>''
  638.                                     ));
  639.             }else{
  640.                 $transaction->rollback();
  641.                 echo CJSON::encode(array(
  642.                                                     'result'=>'failed',
  643.                                                     'data'=>$new->getErrors()
  644.                                     ));
  645.             }
  646.         }else{
  647.           echo "Who are you?";
  648.         }
  649.     }
  650.  
  651.     public function actionLeaderboard(){
  652.         if(isset($_POST['external'])){
  653.           $list = MasterPemain::Model()->
  654.           findAll(array(
  655.             'condition'=>'',
  656.             'order'=>'score desc',
  657.             'limit'=>5
  658.           ));
  659.           $result = array();
  660.           foreach ($list as $key => $value) {
  661.             array_push($result, $value->attributes);
  662.           }
  663.  
  664.           if(count($result) > 0){
  665.             echo CJSON::encode(array(
  666.                               'result'=>'success',
  667.                               'data'=>$result
  668.                       ));
  669.           }else{
  670.             echo CJSON::encode(array(
  671.                               'result'=>'failed',
  672.                               'data'=>"Tidak ada leaderboard."
  673.                       ));
  674.           }
  675.         }else{
  676.           echo "Who are you?";
  677.         }
  678.       }
  679.  
  680. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement