Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. <?
  2. session_start();
  3. if($_SESSION["t_ewidencja"] > 0 || $_SESSION["t_newcars"] > 0 || $_SESSION["t_autorent"] > 0) {
  4. require_once("/subdomain_check.php");
  5. require_once("/klient/".$subdomena."/ustawienia.inc.php");
  6. require_once("/helpers/DB.php");
  7. require_once("/helpers/Form.php");
  8. require_once("/plugins/carapi/carapi.php");
  9. $db = new DB($opts["db"]);
  10. if(!$db->ok()) { die("Wystąpił błąd podczas połączenia z bazą danych."); }
  11. $response = CarAPIService::request("dictionary", array());
  12. header("Access-Control-Allow-Origin: *");
  13. header("Content-type: application/json; charset=utf-8");
  14. if($response["status"] == 200) {
  15. //echo json_encode(array(["status" => 200, "data" => $response["data"]]));
  16. foreach ($response["data"]["dictionary"] as $row) {
  17. $row2 = $db->select_one("car_dictionary", array("*"), "id = ".intval($row["id"]));
  18. if($row2) {
  19. //update
  20. } else {
  21. print_r($row);
  22. //$db->insert("car_dictionary", $row);
  23. }
  24. }
  25. } else {
  26. echo json_encode(array(["status" => 500]));
  27. }
  28. }
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement