Xom9ik

GetValue.php

May 10th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <?php
  2.  
  3. require 'db.php';
  4. $arrayData  = json_decode($_POST['arrayData'], true);
  5.  
  6. //echo "\n" . displayRecursiveResults($arrayData) . "\n";
  7. $playerID = $arrayData['uid'];
  8.  
  9. if(!isset($playerID)){
  10.     echo "Fail data";
  11.     exit;
  12. }
  13. else {
  14.     GetValue($playerID);
  15. }
  16.  
  17. function displayRecursiveResults($arrayObject) {
  18.     foreach($arrayObject as $key=>$data) {
  19.         if(is_array($data)) {
  20.             displayRecursiveResults($data);
  21.         } elseif(is_object($data)) {
  22.             displayRecursiveResults($data);
  23.         } else {
  24.             echo $key." => ".$data."\n";
  25.         }
  26.     }
  27. }
  28.  
  29. function GetValue($playerID) {
  30.     $user_data = R::findOne('users', 'UID = ?', [$playerID]);
  31.     if (isset($user_data)) {
  32.         $array = $user_data->export();
  33.         echo json_encode($array);
  34.     }
  35.     else {
  36.         echo "Not find this user";
  37.     }
  38. }
  39. ?>
Advertisement
Add Comment
Please, Sign In to add comment