algo_response.php 916 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. header("Expires: 0");
  3. session_start();
  4. $response = $_SESSION['login'];
  5. if (!$response) {
  6. return;
  7. }
  8. include 'auth.php';
  9. include 'functions.php';
  10. foreach (array_keys($_REQUEST) as $var) {
  11. ${$var} = $_REQUEST[$var];
  12. // echo "<b>$var:</b> ${$var} <br>";
  13. }
  14. if ($actname == 'select_project_type')
  15. {
  16. // echo "select_project_type";
  17. $retarr = array();
  18. $algos = algoList('project_type', $pt_id);
  19. //echo $pt_id;
  20. echo json_encode($algos);
  21. }
  22. function algoList($condition_target, $target_id)
  23. {
  24. global $link;
  25. $str = "select * from algo a join algo_conditions ac on a.condition_id = ac.c_id and ac.condition_target='$condition_target' join algo_actions aa on aa.a_id=a.action_id where a.condition_value_id = $target_id";
  26. $query = mysqli_query($link, $str);
  27. for ($data = []; $row = mysqli_fetch_object($query); $data[] = $row);
  28. return $data;
  29. }