Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?
- session_start();
- if($_SESSION["t_ewidencja"] > 0 || $_SESSION["t_newcars"] > 0 || $_SESSION["t_autorent"] > 0) {
- require_once("/subdomain_check.php");
- require_once("/klient/".$subdomena."/ustawienia.inc.php");
- require_once("/helpers/DB.php");
- require_once("/helpers/Form.php");
- require_once("/plugins/carapi/carapi.php");
- $db = new DB($opts["db"]);
- if(!$db->ok()) { die("Wystąpił błąd podczas połączenia z bazą danych."); }
- $response = CarAPIService::request("dictionary", array());
- header("Access-Control-Allow-Origin: *");
- header("Content-type: application/json; charset=utf-8");
- if($response["status"] == 200) {
- //echo json_encode(array(["status" => 200, "data" => $response["data"]]));
- foreach ($response["data"]["dictionary"] as $row) {
- $row2 = $db->select_one("car_dictionary", array("*"), "id = ".intval($row["id"]));
- if($row2) {
- //update
- } else {
- print_r($row);
- //$db->insert("car_dictionary", $row);
- }
- }
- } else {
- echo json_encode(array(["status" => 500]));
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement