contract_proc.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/comm.php';
  3. include $_SERVER['DOCUMENT_ROOT'].'/common/lib/encrypt.php';
  4. $enc_passwd = "upro_contract";
  5. $RES = array("CODE" => "9999", "MSG" => "");
  6. $mode = $_POST['mode'];
  7. try {
  8. $login_data = $_POST['login_data'];
  9. $ds_agree1 = $_POST['ds_agree1'];
  10. $ds_agree2 = $_POST['ds_agree2'];
  11. $ds_agree3 = $_POST['ds_agree3'];
  12. switch($mode) {
  13. case 'dealer':
  14. if(empty($login_data)) {
  15. throw new Exception("로그인 정보가 없습니다.", "9998");
  16. }
  17. $dec_data = upro_decrypt(base64_decode($login_data), $enc_passwd);
  18. $dealer = json_decode($dec_data);
  19. if(empty($dealer->cd_dealer)) {
  20. throw new Exception("로그인 정보가 없습니다.", "9997");
  21. }
  22. if($ds_agree1 != "Y") {
  23. throw new Exception("[필수] 딜러 회원 계약서 항목에 동의해야 합니다.", "9995");
  24. }
  25. if($ds_agree2 != "Y") {
  26. throw new Exception("[필수] 개인정보 수집이용 항목에 동의해야 합니다.", "9995");
  27. }
  28. if($ds_agree3 != "Y") {
  29. throw new Exception("[필수] 회원 이용약관 항목에 동의해야 합니다.", "9995");
  30. }
  31. $table_name = "dealer_master a";
  32. $_whereis = " cd_dealer = '". $dealer->cd_dealer . "' and cd_dealerid = '". $dealer->cd_dealerid ."' ";
  33. $row = $dbCon->selectDAO("*, ifnull((select ds_status from dealer_master where cd_dealer = a.cd_dealer_p), '') ds_status_p ", $table_name, $_whereis);
  34. if (!$row['cd_dealer']) {
  35. throw new Exception("로그인 정보가 없습니다.", "9991");
  36. }
  37. $sql = "UPDATE dealer_master set dt_lastlogin = now(), ds_info_contract = 'Y', ds_info_privacy = 'Y', ds_info_service = 'Y' where cd_dealer = '". $row['cd_dealer'] . "'";
  38. $result = $dbCon->query($sql);
  39. $_SESSION['s_cd_dealerid']=$row[cd_dealerid];
  40. $_SESSION['s_nm_email']=$row[nm_email];
  41. $_SESSION['s_nm_name']=$row[nm_name];
  42. $_SESSION['s_nm_hp']=$row[nm_hp_01].$row[nm_hp_02].$row[nm_hp_03];
  43. $_SESSION['s_nm_hp_form']=$row[nm_hp_01]."-".$row[nm_hp_02]."-".$row[nm_hp_03];
  44. $_SESSION['s_ds_type']=$row[ds_type]; //$ds_type -> A0:개인,B0:업체,C0:비회원,D0:딜러,D1:딜러-관리자
  45. $_SESSION['s_ds_level']=$row[ds_level];
  46. $_SESSION['s_cd_dealer']=$row[cd_dealer];
  47. $_SESSION['s_cd_dealer_p']=$row[cd_dealer_p];
  48. $_SESSION['s_nm_area']=$row[nm_area];
  49. // $_SESSION['s_ds_area_sub']=$row[ds_area_sub];
  50. $_SESSION['s_ds_usertype']=$row[ds_usertype]; //$ds_usertype ds_type 상세 사용 가능 -> A0:개인,B0:업체,B1:업체1,B2:업체2,C0:비회원
  51. $_SESSION['s_ds_company_bp1']=$row[ds_company_bp1]; //관계사1
  52. $_SESSION['s_ds_branch1']=$row[ds_branch1]; //지점1
  53. $_SESSION['s_ds_company_bp2']=$row[ds_company_bp2]; //관계사2
  54. $_SESSION['s_ds_branch2']=$row[ds_branch2]; //지점2
  55. $_SESSION['s_ds_company_bp3']=$row[ds_company_bp3]; //관계사3
  56. $_SESSION['s_ds_branch3']=$row[ds_branch3]; //지점3
  57. $_SESSION['s_ds_kind']= substr($row[ds_type],0,1); //$s_ds_kind -> A:개인, D:딜러,딜러-관리자 예)(($row[ds_type] == "A0")?"D0":"D1");
  58. $_SESSION['s_ds_status_p']=$row[ds_status_p]; //총괄관리자(딜러) 승인여부 : Z0-승인, 이외-미승인
  59. break;
  60. //회원은 아직 사용안함
  61. case 'member':
  62. break;
  63. }
  64. $RES['CODE'] = "0000";
  65. $RES['MSG'] = "정상";
  66. }catch(Exception $e) {
  67. $RES['CODE'] = $e->getCode();
  68. $RES['MSG'] = $e->getMessage();
  69. }
  70. echo json_encode($RES);
  71. mysql_close($connect);
  72. ?>