get_data.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. include 'config.php';
  3. date_default_timezone_set('Europe/Vienna');
  4. $date = date('d/m/Y h:i:s a', time());
  5. error_log(" ".$_SERVER['HTTP_CPEE_LABEL'], 3, 'logs.log');
  6. error_log($date, 3, 'logs.log');
  7. error_log("\r\n", 3, 'logs.log');
  8. $rolle = $_POST['rolle'];
  9. $form = $_POST['form'];
  10. if (file_exists('../callbacks/DTC_EVENT.txt')) {
  11. $a =1;
  12. } else {
  13. $rolleFile = fopen("../callbacks/DTC_EVENT.txt", "w");
  14. $txt = "[]";
  15. fwrite($rolleFile, $txt);
  16. fclose($rolleFile);
  17. }
  18. $filename = $_SERVER['HTTP_CPEE_CALLBACK_ID'];
  19. $task = $_SERVER['HTTP_CPEE_LABEL'];
  20. $rolleArray = array('cbid'=> $filename,'role'=>$rolle, 'task'=> $task, 'form'=>$_POST['form']);
  21. $inp = file_get_contents('../callbacks/DTC_EVENT.txt');
  22. $tempArray = json_decode($inp);
  23. array_push($tempArray, $rolleArray);
  24. $data = json_encode($tempArray);
  25. $date = date('d/m/Y h:i:s a', time());
  26. error_log("save data to file", 3, 'logs.log');
  27. error_log($date, 3, 'logs.log');
  28. error_log("\r\n", 3, 'logs.log');
  29. file_put_contents('../callbacks/DTC_EVENT.txt', $data);
  30. $general = [];
  31. $general[] = $_SERVER;
  32. $general[] = $_POST;
  33. $general[1]["form"] = $formLocation.$form;
  34. $jsonData = json_encode($general, JSON_PRETTY_PRINT);
  35. file_put_contents('../callbacks/'.$filename.'.txt', $jsonData);
  36. header('CPEE_CALLBACK: true');
  37. exit;
  38. ?>