mqnoy

[PHP] result.php

Jan 1st, 2018
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2. if(!empty($_GET['push'])){
  3.     if($_GET['push']=="11"){
  4.         $var1=1;
  5.         echo "{push:".$var1."}";
  6.     }else if($_GET['push']=="10"){
  7.         $var1=0;
  8.         echo "{push:".$var1."}";
  9.     }else{
  10.         $var1="unknown";
  11.         echo "{push:".$var1."}";
  12.     }
  13. }else{
  14.     echo "tidak ada";
  15.     $var1=0;
  16.  
  17. }
  18.  
  19.  
  20. $fileContent="$var1";
  21. // $fileContent="\n"."{status:".$var1.",code:200}";
  22. //$fileStatus =file_put_contents("myfile.txt",$fileContent,FILE_APPEND);
  23. $fileStatus =file_put_contents("myfile.txt",$fileContent);
  24. if($fileStatus !=false)
  25. {
  26.     $notif=true;
  27.     //$myTextFileHandler = @fopen("myfile.txt","r+");
  28.  
  29.     //truncate the file to zero
  30.     //or you could have used the write method and written nothing to it
  31.     //@ftruncate($myTextFileHandler, 0);
  32. }
  33. else{
  34.     $notif=false;
  35.     //echo "gagal nulis :(";
  36. }
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment