auth_chk.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. <?php
  2. if(empty($_SESSION['admin_cd_userid'])){
  3. if($_SERVER['HTTP_X_REQUESTED_WITH'] == "XMLHttpRequest") {
  4. if(strpos($_SERVER['HTTP_ACCEPT'], "application/json") === false) {
  5. ?>
  6. <html>
  7. <head>
  8. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  9. </head>
  10. <script>
  11. alert("본페이지는 관리자만 접근 가능합니다.");
  12. location.replace("<?=ADMIN_PATH?>index.php");
  13. </script>
  14. </head>
  15. </html>
  16. <?php
  17. exit;
  18. }else {
  19. $RES = array(
  20. 'CODE' => "4444"
  21. , "MSG" => "로그인세션이 만료되었습니다. 재로그인 후 이용하십시오"
  22. , "DATAS" => array(
  23. 'URL' => ADMIN_PATH."index.php"
  24. )
  25. );
  26. echo json_encode($RES);
  27. exit;
  28. }
  29. }else {
  30. ?>
  31. <html>
  32. <head>
  33. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  34. </head>
  35. <script>
  36. alert("본페이지는 관리자만 접근 가능합니다.");
  37. location.replace("<?=ADMIN_PATH?>index.php");
  38. </script>
  39. </head>
  40. </html>
  41. <?php
  42. }
  43. exit;
  44. ?>
  45. <html>
  46. <head>
  47. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  48. </head>
  49. <script>
  50. alert("본페이지는 관리자만 접근 가능합니다.");
  51. location.replace("<?=ADMIN_PATH?>index.php");
  52. </script>
  53. </head>
  54. </html>
  55. <?php
  56. }
  57. // echo str_replace("/manager/", "", $_SERVER['REQUEST_URI']);
  58. // echo "<br>";
  59. // echo substr(str_replace("/manager/", "", $_SERVER['REQUEST_URI']), 0, stripos(str_replace("/manager/", "", $_SERVER['REQUEST_URI']), "/"));
  60. $currAdminDir = substr(str_replace("/manager/", "", $_SERVER['REQUEST_URI']), 0, stripos(str_replace("/manager/", "", $_SERVER['REQUEST_URI']), "/"));
  61. switch($currAdminDir){
  62. case "admin":
  63. case "popup":
  64. $m = '1';
  65. break;
  66. case "class":
  67. case"model":
  68. case "car":
  69. $m = '2';
  70. break;
  71. case "consultant":
  72. $m = '3';
  73. break;
  74. case "simpleOrder":
  75. case "order":
  76. case "carReq":
  77. $m = '4';
  78. break;
  79. case "buyappr":
  80. $m = '5';
  81. break;
  82. case "sellappr":
  83. $m = '6';
  84. break;
  85. case "makeproduct":
  86. $m = '7';
  87. break;
  88. case "carbase":
  89. $m = '8';
  90. break;
  91. default:
  92. $m = '-1';
  93. }
  94. ?>