Advertisement
Guest User

Untitled

a guest
Apr 21st, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public function __construct() {
  2. log_message('debug','Accessing site_offline hook!');
  3. }
  4.  
  5. public function is_offline() {
  6. if(file_exists(APPPATH.'config/config.php')) {
  7. include(APPPATH.'config/config.php');
  8.  
  9. if(isset($config['is_offline']) && $config['is_offline']===TRUE) {
  10. $this->show_site_offline();
  11. exit;
  12. }
  13. }
  14. }
  15.  
  16. private function show_site_offline() {
  17. $this->load->view('common/header');
  18. $this->load->view('common/maintenance');
  19. $this->load->view('common/footer');
  20. }
  21. }
  22.  
  23. $allowed_ip = '192.168.1.1'; // Whatever your IP address is
  24.  
  25. if ($_SERVER['REMOTE_ADDR'] == $allowed_ip)
  26. {
  27. // Load the site
  28. }
  29. else
  30. {
  31. // Load the maintenance page
  32. }
  33.  
  34. $this->config->item('is_offline');
  35.  
  36. $config['is_offline']
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement