car_history.ajax.php 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. include $_SERVER['DOCUMENT_ROOT'].ADMIN_PATH.'common/auth_chk.php';
  4. $DATAS = array();
  5. $RES = array("CODE"=> '', "MSG" => '', 'DATAS' => '');
  6. $cd_userid = trim($_SESSION["admin_cd_userid"]);
  7. $mode = trim(avoid_crack($_REQUEST["mode"]));
  8. $nm_number = trim(avoid_crack($_REQUEST["nm_number"]));
  9. $cd_car_history = trim(avoid_crack($_REQUEST["cd_car_history"]));
  10. try {
  11. switch($mode) {
  12. case 'view':
  13. $r = mysql_query("SELECT s.*
  14. FROM car_history_master s
  15. where cd_car_history = '$cd_car_history'
  16. and ds_type = 'admin'
  17. LIMIT 1");
  18. $history_col = mysql_fetch_array($r);
  19. $r000 = $history_col["r000"];
  20. $r001 = $history_col["r001"];
  21. $r002 = $history_col["r002"];
  22. $r003 = $history_col["r003"];
  23. $r004 = $history_col["r004"];
  24. $r005 = $history_col["r005"];
  25. $r101 = $history_col["r101"];
  26. $r102 = $history_col["r102"];
  27. $r103 = $history_col["r103"];
  28. $r104 = $history_col["r104"];
  29. $r105 = $history_col["r105"];
  30. $r106 = $history_col["r106"];
  31. $r107 = $history_col["r107"];
  32. $r108 = $history_col["r108"];
  33. $r109 = $history_col["r109"];
  34. $r111 = $history_col["r111"];
  35. $r401 = $history_col["r401"];
  36. $r402 = $history_col["r402"];
  37. $r403 = $history_col["r403"];
  38. $r404 = $history_col["r404"];
  39. $r405 = $history_col["r405"];
  40. $r406_01 = $history_col["r406_01"];
  41. $r407 = $history_col["r407"];
  42. $r408_01 = $history_col["r408_01"];
  43. $r409 = $history_col["r409"];
  44. $r410_01 = $history_col["r410_01"];
  45. $r201 = $history_col["r201"];
  46. $r202 = $history_col["r202"];
  47. $r203 = $history_col["r203"];
  48. $r204 = $history_col["r204"];
  49. $r205 = $history_col["r205"];
  50. $r510 = $history_col["r510"];
  51. $r511_01 = $history_col["r511_01"];
  52. $r501 = $history_col["r501"];
  53. $r502 = $history_col["r502"];
  54. $r301 = $history_col["r301"];
  55. $r302 = $history_col["r302"];
  56. $r303 = $history_col["r303"];
  57. $r601 = $history_col["r601"];
  58. $r602 = $history_col["r602"];
  59. $r701 = $history_col["r701"];
  60. //차량 보험처리 이력 전체 정보
  61. include_once($_SERVER['DOCUMENT_ROOT'].'/common/inc/inc_car_history.php');
  62. exit;
  63. break;
  64. case 'user_view':
  65. $r = mysql_query("SELECT s.*
  66. FROM car_history_master s
  67. where cd_car_history = '$cd_car_history'
  68. and ds_type = 'user'
  69. LIMIT 1");
  70. $history_col = mysql_fetch_array($r);
  71. $r000 = $history_col["r000"];
  72. $r001 = $history_col["r001"];
  73. $r002 = $history_col["r002"];
  74. $r003 = $history_col["r003"];
  75. $r004 = $history_col["r004"];
  76. $r005 = $history_col["r005"];
  77. $r101 = $history_col["r101"];
  78. $r102 = $history_col["r102"];
  79. $r103 = $history_col["r103"];
  80. $r104 = $history_col["r104"];
  81. $r105 = $history_col["r105"];
  82. $r106 = $history_col["r106"];
  83. $r107 = $history_col["r107"];
  84. $r108 = $history_col["r108"];
  85. $r109 = $history_col["r109"];
  86. $r111 = $history_col["r111"];
  87. $r401 = $history_col["r401"];
  88. $r402 = $history_col["r402"];
  89. $r403 = $history_col["r403"];
  90. $r404 = $history_col["r404"];
  91. $r405 = $history_col["r405"];
  92. $r406_01 = $history_col["r406_01"];
  93. $r407 = $history_col["r407"];
  94. $r408_01 = $history_col["r408_01"];
  95. $r409 = $history_col["r409"];
  96. $r410_01 = $history_col["r410_01"];
  97. $r201 = $history_col["r201"];
  98. $r202 = $history_col["r202"];
  99. $r203 = $history_col["r203"];
  100. $r204 = $history_col["r204"];
  101. $r205 = $history_col["r205"];
  102. $r510 = $history_col["r510"];
  103. $r511_01 = $history_col["r511_01"];
  104. $r501 = $history_col["r501"];
  105. $r502 = $history_col["r502"];
  106. $r301 = $history_col["r301"];
  107. $r302 = $history_col["r302"];
  108. $r303 = $history_col["r303"];
  109. $r601 = $history_col["r601"];
  110. $r602 = $history_col["r602"];
  111. $r701 = $history_col["r701"];
  112. //차량 보험처리 이력 전체 정보
  113. include_once($_SERVER['DOCUMENT_ROOT'].'/common/inc/inc_car_history.php');
  114. exit;
  115. break;
  116. case 'search':
  117. default:
  118. include_once($_SERVER['DOCUMENT_ROOT']."/common/lib/class.carhistory.php");
  119. $g_bszUser_key = "db,f8,e7,7b,4b,53,28,04,fc,f8,99,62,70,d5,ad,bb";
  120. $g_bszIV = "26,8d,66,a7,35,a8,1a,81,6f,ba,d9,fa,36,16,25,01";
  121. $carHistory = new CarHistory();
  122. if(empty($nm_number)) {
  123. throw new Exception('차량번호가 넘어오질 않았습니다.', 9999);
  124. }
  125. // $nm_number = "28부5708"; //$nm_number
  126. // $nm_number = "53라9319"; //$nm_number
  127. $data = array();
  128. $data['sType'] = $carHistory->encrypt($g_bszIV, $g_bszUser_key, "1");
  129. $data['carNum'] = $carHistory->encrypt($g_bszIV, $g_bszUser_key, $nm_number);
  130. $data['memberId'] = $carHistory->encrypt($g_bszIV, $g_bszUser_key, $cd_userid);
  131. $data['carNumType'] = "0";
  132. $data['stdDate'] = date("Ymd");
  133. $carData = $carHistory->getHistory($data);
  134. if($_SERVER['REMOTE_ADDR'] == '220.86.24.199') {
  135. // print_r($carData);
  136. // exit;
  137. }
  138. if($carData['r000'] != "000") {
  139. throw new Exception('차량이력정보를 가져오는데 실패하였습니다.', 9998);
  140. }
  141. $car_data = array();
  142. $cur_date = date("Y-m-d H:i:s");
  143. $car_data['dt_insert'] = $cur_date;
  144. $car_data['nm_insert'] = $cd_userid;
  145. $car_data['dt_update'] = $cur_date;
  146. $car_data['nm_update'] = $cd_userid;
  147. $db_result = $carHistory->db_update(0, $car_data, 'admin');
  148. if (!$db_result) {
  149. throw new Exception('차량이력정보를 저장하는데 실패하였습니다.', 9997);
  150. }
  151. $DATAS = $carData;
  152. break;
  153. }
  154. $RES['CODE'] = '0000';
  155. $RES['MSG'] = '정상처리';
  156. $RES['DATAS'] = $DATAS;
  157. }catch(Exception $e) {
  158. $RES['CODE'] = $e->getCode();
  159. $RES['MSG'] = $e->getMessage();
  160. }
  161. echo json_encode($RES);
  162. exit;
  163. ?>