oyazhuryachna

constanta_ci_with_array

Jun 22nd, 2019
887
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.06 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Display Debug backtrace
  7. |--------------------------------------------------------------------------
  8. |
  9. | If set to TRUE, a backtrace will be displayed along with php errors. If
  10. | error_reporting is disabled, the backtrace will not display, regardless
  11. | of this setting
  12. |
  13. */
  14. defined('SHOW_DEBUG_BACKTRACE') OR define('SHOW_DEBUG_BACKTRACE', TRUE);
  15.  
  16. /*
  17. |--------------------------------------------------------------------------
  18. | File and Directory Modes
  19. |--------------------------------------------------------------------------
  20. |
  21. | These prefs are used when checking and setting modes when working
  22. | with the file system.  The defaults are fine on servers with proper
  23. | security, but you may wish (or even need) to change the values in
  24. | certain environments (Apache running a separate process for each
  25. | user, PHP under CGI with Apache suEXEC, etc.).  Octal values should
  26. | always be used to set the mode correctly.
  27. |
  28. */
  29. defined('FILE_READ_MODE')  OR define('FILE_READ_MODE', 0644);
  30. defined('FILE_WRITE_MODE') OR define('FILE_WRITE_MODE', 0666);
  31. defined('DIR_READ_MODE')   OR define('DIR_READ_MODE', 0755);
  32. defined('DIR_WRITE_MODE')  OR define('DIR_WRITE_MODE', 0755);
  33.  
  34. /*
  35. |--------------------------------------------------------------------------
  36. | File Stream Modes
  37. |--------------------------------------------------------------------------
  38. |
  39. | These modes are used when working with fopen()/popen()
  40. |
  41. */
  42. defined('FOPEN_READ')                           OR define('FOPEN_READ', 'rb');
  43. defined('FOPEN_READ_WRITE')                     OR define('FOPEN_READ_WRITE', 'r+b');
  44. defined('FOPEN_WRITE_CREATE_DESTRUCTIVE')       OR define('FOPEN_WRITE_CREATE_DESTRUCTIVE', 'wb'); // truncates existing file data, use with care
  45. defined('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE')  OR define('FOPEN_READ_WRITE_CREATE_DESTRUCTIVE', 'w+b'); // truncates existing file data, use with care
  46. defined('FOPEN_WRITE_CREATE')                   OR define('FOPEN_WRITE_CREATE', 'ab');
  47. defined('FOPEN_READ_WRITE_CREATE')              OR define('FOPEN_READ_WRITE_CREATE', 'a+b');
  48. defined('FOPEN_WRITE_CREATE_STRICT')            OR define('FOPEN_WRITE_CREATE_STRICT', 'xb');
  49. defined('FOPEN_READ_WRITE_CREATE_STRICT')       OR define('FOPEN_READ_WRITE_CREATE_STRICT', 'x+b');
  50.  
  51. /*
  52. |--------------------------------------------------------------------------
  53. | Exit Status Codes
  54. |--------------------------------------------------------------------------
  55. |
  56. | Used to indicate the conditions under which the script is exit()ing.
  57. | While there is no universal standard for error codes, there are some
  58. | broad conventions.  Three such conventions are mentioned below, for
  59. | those who wish to make use of them.  The CodeIgniter defaults were
  60. | chosen for the least overlap with these conventions, while still
  61. | leaving room for others to be defined in future versions and user
  62. | applications.
  63. |
  64. | The three main conventions used for determining exit status codes
  65. | are as follows:
  66. |
  67. |    Standard C/C++ Library (stdlibc):
  68. |       http://www.gnu.org/software/libc/manual/html_node/Exit-Status.html
  69. |       (This link also contains other GNU-specific conventions)
  70. |    BSD sysexits.h:
  71. |       http://www.gsp.com/cgi-bin/man.cgi?section=3&topic=sysexits
  72. |    Bash scripting:
  73. |       http://tldp.org/LDP/abs/html/exitcodes.html
  74. |
  75. */
  76. defined('EXIT_SUCCESS')        OR define('EXIT_SUCCESS', 0); // no errors
  77. defined('EXIT_ERROR')          OR define('EXIT_ERROR', 1); // generic error
  78. defined('EXIT_CONFIG')         OR define('EXIT_CONFIG', 3); // configuration error
  79. defined('EXIT_UNKNOWN_FILE')   OR define('EXIT_UNKNOWN_FILE', 4); // file not found
  80. defined('EXIT_UNKNOWN_CLASS')  OR define('EXIT_UNKNOWN_CLASS', 5); // unknown class
  81. defined('EXIT_UNKNOWN_METHOD') OR define('EXIT_UNKNOWN_METHOD', 6); // unknown class member
  82. defined('EXIT_USER_INPUT')     OR define('EXIT_USER_INPUT', 7); // invalid user input
  83. defined('EXIT_DATABASE')       OR define('EXIT_DATABASE', 8); // database error
  84. defined('EXIT__AUTO_MIN')      OR define('EXIT__AUTO_MIN', 9); // lowest automatically-assigned error code
  85. defined('EXIT__AUTO_MAX')      OR define('EXIT__AUTO_MAX', 125); // highest automatically-assigned error code
  86.  
  87. // ===========================INI ADALAH KONSTANTA TAMBAHAN YANG DIBUT !! ================================
  88. /* KONSTANTA BIASA */
  89. defined('NAMA_APLIKASI')      OR define('NAMA_APLIKASI', 'Form Input Mahasiswa');
  90.  
  91. /* KONSTANTA BERISI ARRAY */
  92.  
  93. /* Cara 1 : menggunkan serialisasi array */
  94.  
  95. defined('PROGRAM_STUDI')      OR define('PROGRAM_STUDI', serialize (array ('AK'=>'Akuntansi', 'MNJ'=>'Manajemen','SI'=>'Sistem Informasi')));
  96. defined('JENIS_KELAMIN')      OR define('JENIS_KELAMIN', serialize (array ('L'=>'Laki-laki', 'P'=>'Perempuan')));
  97.  
  98. /* Cara 2 : menggunkan json_encode */
  99. defined('PEKERJAAN_ORTU')     OR define('PEKERJAAN_ORTU', json_encode(array ('PNS', 'TNI/POLRI','Karyawan Swasta','Wiraswasta','Pelajar/Mahasiswa','Ibu Rumah Tangga','Lainnya')));
Advertisement
Add Comment
Please, Sign In to add comment