RyukiChan

home

May 23rd, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.92 KB | None | 0 0
  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Home extends CI_Controller {
  3.     public function __construct ()
  4.     {
  5.         parent::__construct();
  6.         $this->load->helper("html");
  7.        
  8.  function detect_mobile()
  9. {
  10.   if(preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|playbook|sagem|sharp|sie-|silk|smartphone|sony|symbian|t-mobile|telus|up.browser|up.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $_SERVER['HTTP_USER_AGENT']))
  11.         return true;
  12.     else
  13.         return false;
  14. }      
  15. }
  16. function index(){
  17. $mobile = detect_mobile();
  18. if($mobile === true)
  19.    {
  20.         $data["title"]="Mobile";
  21.         $this->load->view("v_mobile",$data);
  22.        
  23.   }else{
  24.         $data["title"]="Dekstop";
  25.         $this->load->view("v_dekstop",$data);  
  26. }
  27. }
  28.  
  29. }
  30. ?>
Add Comment
Please, Sign In to add comment