khoi01

simple route php

Nov 16th, 2020
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.55 KB | None | 0 0
  1. ///INDEX PHP
  2.  
  3. <?php
  4.  
  5. ////hide all error
  6. // error_reporting(0);
  7. // ini_set('display_errors', 0);
  8.  
  9. //show all error
  10. error_reporting(E_ALL);
  11. ini_set('display_errors', 1);
  12.  
  13. // ini_set('display_errors', 1);
  14. // ini_set('display_startup_errors', 1);
  15. // error_reporting(E_ALL);
  16.  
  17. // error_reporting(E_ALL);
  18. // ini_set('display_errors', 'On');
  19. include 'inc/init.php';
  20. global $serverAuth;
  21.  
  22. $module = $_GET['module'];
  23. $function = $_GET['function'];
  24. $auth = $_POST['auth'];
  25.  
  26.  
  27. $response = array(
  28.     "responseInfo" => array(
  29.         "module" => $module,
  30.         "function" => $function,
  31.         "status" => null,
  32.         "message" => null,
  33.     ),
  34. );
  35.  
  36. if($auth != $serverAuth){
  37.     $response['responseInfo']['status'] = 'failed';
  38.     $response['responseInfo']['message'] = 'not authorize to access.please contract administrator.';
  39.     header('Content-Type: application/json');
  40.     echo json_encode($response);
  41. }else{
  42.     if($module == "auth"){
  43.         include './route/auth.php';
  44.     }
  45.     if($module == "tender"){
  46.         include './route/tender.php';
  47.     }
  48.     if($module == "route"){
  49.         include './route/simple.php';
  50.     }
  51. }
  52.  
  53. ?>
  54.  
  55.  
  56. // route/simple.php
  57.  
  58. <?php
  59.  
  60. if($module == "route" && $function == "route"){
  61.     simpleRoute();
  62. }
  63.  
  64. function simpleRoute(){
  65.  
  66.  
  67.     $response['responseInfo']['status'] = 'Success';
  68.     $response['responseInfo']['message'] = 'Response from Server';
  69.     $response['responseInfo']['ssmNo'] = '567940-T';
  70.  
  71.     header('Content-Type: application/json');
  72.     echo json_encode($response);
  73. }
  74.  
  75.  
  76. ?>
Advertisement
Add Comment
Please, Sign In to add comment