Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. <?php
  2. require "db.php";
  3. header('Content-Type: application/json');
  4. $get_result = ['auth' => false];
  5. if (isset($_SESSION['logged_user'])) {
  6. // get SESSION user id
  7. $userid = $_SESSION['logged_user']->id;
  8. // get user date
  9. $user = R::Load('users', $userid);
  10.  
  11. foreach ($user->ownTestList as $test) {
  12. if ($test->name == $_POST['name']) {
  13. $progress = $test->progress;
  14. $time = $test->time;
  15. }
  16. }
  17.  
  18. //we transfer the obtained data to js
  19. $get_result = ['result' => $progress, 'time' => $time, 'auth' => true];
  20. }
  21. echo json_encode($get_result);
  22. die();
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement