userbynum.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. if (ubRouting::get('action') == 'userbynum') {
  3. if (@$alterconf['USERBYNUM_ENABLED']) {
  4. if (ubRouting::checkGet('number')) {
  5. $number = ubRouting::get('number');
  6. $useCacheFlag = (ubRouting::get('nocache')) ? false : true;
  7. $telepathy = new Telepathy(false, true, true, $useCacheFlag);
  8. $telepathy->usePhones();
  9. $guessedLogin = $telepathy->getByPhoneFast($number, true, true);
  10. $result = array('result' => 0);
  11. if (!empty($guessedLogin)) {
  12. $allUserData = zb_UserGetAllDataCache();
  13. if (isset($allUserData[$guessedLogin])) {
  14. $result['result'] = 1;
  15. $result['userdata'] = $allUserData[$guessedLogin];
  16. if ($alterconf['OPENPAYZ_SUPPORT']) {
  17. $openPayz = new OpenPayz(false, false);
  18. $result['userdata']['paymentid'] = $openPayz->getCustomerPaymentId($guessedLogin);
  19. }
  20. }
  21. }
  22. header('Last-Modified: ' . gmdate('r'));
  23. header('Content-Type: application/json; charset=UTF-8');
  24. header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
  25. header("Pragma: no-cache");
  26. header('Access-Control-Allow-Origin: *');
  27. print(json_encode($result));
  28. die();
  29. } else {
  30. die('ERROR: EMPTY NUMBER');
  31. }
  32. } else {
  33. die('ERROR: USERBYNUM DISABLED');
  34. }
  35. }