Removing an "auto-redirect" in my index.php file?

My website is built with Concrete 5 and hosted by Just Host and my mobile website is built using Go Mobi.
I have auto-redirect code, provide by Go Mobi, inserted in my websites “public_html/index.php” file. When I try to remove/delete this code from my website “…index.php” it crashes my website (only loads a blank white screen). My .org is discontinuing the Go Mobi site, so I need to stop the auto-redirect. Any suggestions on how to do this?

This is the code that is in the index.php file:

[php]<?php define(‘MOBILE_SITE’, ‘http://m.wmsga.org’);
define(‘TABLET_SITE’, “http://m.wmsga.org”);
define(‘DA_USE_COOKIES’, true);
define(‘DA_USE_CACHE’, true);
define(‘COOKIE_EXPIRY_TIME’, 21600);
define(‘DA_CACHE_DIR’, sys_get_temp_dir() . DIRECTORY_SEPARATOR . ‘DeviceAtlasCache’ . DIRECTORY_SEPARATOR);
define(‘DA_URI’, ‘http://detect.deviceatlas.com/query?User-Agent=%s’);

$redirect = isset($_REQUEST[‘redirect’])?$_REQUEST[‘redirect’]:null;
$homepage_only = false;

if($redirect!=‘false’) {
$da_results = array(’_source’ => ‘none’);

$prevent_redirect = false;
if (DA_USE_COOKIES && isset($_COOKIE[‘Mobi_Mtld_DA_Prevent_Redirect’])) {

	//Clear the redirect-prevention cookie if we see redirect=true parameter
  if($redirect == 'true') {
        setcookie('Mobi_Mtld_DA_Prevent_Redirect', 'false', time()-3600);
  }
  else {
      $prevent_redirect = isset($_COOKIE['Mobi_Mtld_DA_Prevent_Redirect']);
      if($prevent_redirect) {
          $da_results['_source'] = 'prevent_redirect';
      }
  }

}

if (DA_USE_COOKIES && isset($_COOKIE[‘Mobi_Mtld_DA_Properties’])) {
$da_results = (array)json_decode($_COOKIE[‘Mobi_Mtld_DA_Properties’], true);
$da_results[’_source’] = ‘cookie’;
}

if (DA_USE_CACHE && $da_results[’_source’] === ‘none’) {
$da_cache_file = md5($_SERVER[“HTTP_USER_AGENT”]) . ‘.json’;

  if (!file_exists(DA_CACHE_DIR) && !@mkdir(DA_CACHE_DIR)) {
      $da_results['_error'] = "Unable to create cache directory: " . DA_CACHE_DIR . "\n";
  } else {
      $da_json = @file_get_contents(DA_CACHE_DIR . $da_cache_file);

      if ($da_json !== false) {
          $da_results = (array)json_decode($da_json, true);
          $da_results['_source'] = 'cache';

          if (DA_USE_COOKIES) {
              setcookie('Mobi_Mtld_DA_Properties', $da_json);
          }
      }
  }

}

if ($da_results[’_source’] === ‘none’) {
$url = sprintf(DA_URI, urlencode($_SERVER[“HTTP_USER_AGENT”]));

  $ch = curl_init($url);
  curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
  $da_json = curl_exec($ch);
  curl_close($ch);      

  if ($da_json !== false) {
      $da_results = array_merge(json_decode($da_json, true), $da_results);
      $da_results['_source'] = 'webservice';

      if (DA_USE_COOKIES) {
          setcookie('Mobi_Mtld_DA_Properties', $da_json);
      }

      if (DA_USE_CACHE) {
          if (@file_put_contents(DA_CACHE_DIR . $da_cache_file, $da_json) === false) {
              $da_results['_error'] .= "Unable to write cache file " . DA_CACHE_DIR . $da_cache_file . "\n";
          }
      }
  } else {
      $da_results['_error'] .= "Error fetching DeviceAtlas data from webservice.\n";
  }

}

if(!$prevent_redirect) {
$isTablet = isset($da_results[‘isTablet’]) && $da_results[‘isTablet’]==‘true’;
$tabletRedirect = defined(‘TABLET_SITE’) ? TABLET_SITE:’’;
if(defined(‘TABLET_SITE’) && $isTablet){
$redirect_url = TABLET_SITE;
}
else if(isset($da_results[‘mobileDevice’]) &&
$da_results[‘mobileDevice’]==‘true’ &&
!($isTablet && empty($tabletRedirect))){
$redirect_url = MOBILE_SITE;
if(!empty($_SERVER[“REQUEST_URI”]) && !$homepage_only){
$redirect_url .= “/w/” . $_SERVER[“HTTP_HOST”]. “/” . $_SERVER[“REQUEST_URI”];
}
}

if(isset($redirect_url)){
  header('Location: ' . $redirect_url);
  die();
}

}
}
else {
//Set a cookie so we remember not to redirect again in the future
if (DA_USE_COOKIES && !isset($_COOKIE[‘Mobi_Mtld_DA_Prevent_Redirect’])) {
setcookie(‘Mobi_Mtld_DA_Prevent_Redirect’, “true”, time() + COOKIE_EXPIRY_TIME);
}
}
require(‘concrete/dispatcher.php’);
?>[/php]

Well, what do you mean by “removing this code”? You can’t drop it all as you have embedded code that sets
up the link to your home page. You would need to only take out the parts that have to do with the redirects
to the mobi url. Not all of this code. Just remove the cookie sections that have to do with the mobi url and the
redirect sections, not all of it. The rest is the home page code…

Not sure if this helps or not.

Sponsor our Newsletter | Privacy Policy | Terms of Service